Skip to content
Preview: packages are not published yet.

Introduction

Nitro UI Brownfield puts React screens inside a native iOS or Android app that already exists. The React team builds the screens. The native team receives them as one binary dependency per platform, with a Swift and Kotlin API generated from the React code.

A React screen delivered this way is called a surface. A surface can be a full screen, a card inside a native screen or a cell in a list. The native app creates the container and decides when the surface opens and closes.

Nitro UI Brownfield is built on Nitro UI, which renders React components to native views. It is an independent third-party library, not affiliated with or endorsed by Margelo. How it fits with Nitro UI says what each project provides, and Install takes a project to a working setup.

React team Native team
Writes Components, registered as surfaces Native screens that host surfaces
Tools Bun, the nuib command line, a Mac Xcode or Android Studio
Ships A versioned artifact per platform The app
Never needs The native app’s source code Bun, JavaScript, C++ or a bundler

The contract between the two is the list of surfaces and their props. It is written once, in TypeScript, and checked on both sides: nuib check tells the React team when a change would break the native app, and the native compiler stops on the exact line if it does.

  • One dependency. An XCFramework through Swift Package Manager, an AAR through Maven. No script phases, no C++ settings in the native project.
  • A typed API per surface. PointsHistory.viewController(userId: "42") in Swift, PointsHistory.fragment(userId = "42") in Kotlin. Props are parameters; a wrong name does not compile.
  • Full screens and embedded views. A surface can fill a view controller or fragment, or sit inside your own layout.
  • A boot you control. The runtime starts in stages. You choose whether to pay for them at launch or when the first surface opens.
  • Failures that stay contained. A missing bundle or a render exception puts one surface in a failed state with a typed cause. You show a fallback and decide whether to retry.
  • Restore after process death. On Android, a surface comes back with the same identity and its latest props.
  • A development loop. nuib dev ios and nuib dev android open the real native app with the React project live in it, with Fast Refresh.

The artifact also has platform limits you should know early: its Android native libraries are arm64-v8a only, and packaging runs on an Apple Silicon Mac.