Skip to content
Preview: packages are not published yet.

Examples

The repository has five example apps under apps/. Three are React projects and two are native apps that consume a packaged artifact. They are the best way to see a complete project before you write your own.

Before you run anything, install the dependencies once at the repository root.

Terminal window
bun install
App Platform What it is
apps/playground iOS and Android A plain Nitro UI app, used as a test bed for the library.
apps/host-ios iOS A React project with five surfaces, and the UIKit host that loads them from source.
apps/host-ios-binary iOS The same host, consuming the packaged XCFramework.
apps/host-android Android A React project with six surfaces, and the Android host that loads them from source.
apps/host-android-binary Android The same host, consuming the packaged AAR.

apps/host-ios and apps/host-android register their surfaces in src/surfaces.tsx with registerSurface. The iOS app has the first five below and the Android app adds KeyboardProbe. Each one stands for a case the library has to handle.

Surface What it shows
Profile A full-screen surface pushed on the native navigation stack, with a userName prop.
Counter An embedded block whose props the native screen changes while it is on screen.
Wizard A surface with two internal steps, driven by a navigation stack inside the surface.
Cart Two instances alive at once that read the same module store.
Crasher A surface that throws while rendering when asked to, to show the failure path.
KeyboardProbe Android only. A surface for checking keyboard behavior.

apps/playground is a Nitro UI app without a native host of its own. It renders a single screen and holds the harness tests of the library. Run it with the Nitro UI CLI scripts from its package.json.

Terminal window
cd apps/playground
bun run ios # iOS simulator
bun run android # Android emulator

The React project is apps/host-ios; the native app is apps/host-ios-binary.

To build the dependency the native app uses, package the React project. The first run compiles Hermes and the engine and takes several minutes.

Terminal window
cd apps/host-ios
bun run nuib package

bun run nuib package writes a Swift package that apps/host-ios-binary links as HostUI. To work on the React code with the native app running on the booted simulator, use the development loop.

Terminal window
cd apps/host-ios
bun run nuib dev ios

The app is named by brownfield.hosts.ios in the project’s package.json. See Run and develop for the options.

The React project is apps/host-android; the native app is apps/host-android-binary. Both appear in their package.json files: the project’s brownfield key names the host app and the Maven registry directory.

Terminal window
cd apps/host-android
bun run nuib package
bun run nuib dev android

bun run nuib package writes the AAR to a local Maven repository that apps/host-android-binary reads. bun run nuib dev android needs a running emulator or a connected device and a debuggable build of the native app.