Native UI integration layer
Generated bindings create native views like any other object; this layer shows them inside the framework's view tree. It is the only part of the project that uses the Flutter plugin API / React Native view managers. Everything else stays plugin-free.
Flutter — runtimes/flutter/native_api_ui#
dependencies:
native_api_ui: ^0.1.0-beta.1 # pub.dev
// Android: any binding of an android.view.View subclass.
final label = TextView(appContext)..setText$CharSequence('Hi'.toJString());
NativeView.android(view: label);
// iOS: any binding of a UIView subclass.
final view = ios.UILabel.new$()..text = 'Hi'.toNSString();
NativeView.ios(view: view);
- Android:
AndroidView(texture-layer hybrid composition). TheViewis registered inNabViewRegistryover JNI and picked up by the platform view factorydev.nativeapibindgen/view; the registry entry is removed when the widget is disposed. Consumer ProGuard rules keep the registry. - iOS:
UiKitView; the widget keeps theUIViewalive while it is shown and passes its address to the factory, which borrows it. - Create views on the platform thread (the root isolate on Android and iOS).
React Native — NativeView (exported by the generated library)#
import { NativeView, TextView, applicationContext } from './native-api-bindings';
const tv = TextView.new(applicationContext());
tv.setText$CharSequence('Hi');
<NativeView view={tv} style={{ width: 200, height: 48 }} />
- Runtime builtins
registerView/unregisterViewkeep the view while the component is mounted; the view managerNabNativeView(AndroidNabNativeViewManager, iOSNabNativeViewManager) adds it to its container. React Native's interop layer serves these view managers to the New Architecture (Fabric). - Android: add
NabUiPackage()to the app's packages (see the example'sMainApplication.kt). iOS: compiled from the generated pod.
Tested (2026-10-05)#
| Target | Device | Test |
|---|---|---|
| Flutter Android | API 37 emulator | TextView attached to the window, text and non-zero width (examples/flutter/android_slice) |
| Flutter iOS | iPhone 17 simulator, iOS 26.4 | UILabel in a window, text and non-zero width (examples/flutter/ios_slice) |
| React Native Android | API 37 emulator (release) | TextView attached, text (examples/react-native/slice) |
| React Native iOS | iPhone 17 simulator, iOS 26.4 (release) | UILabel in a window, text, width |
Not covered: gestures/accessibility forwarding beyond what platform views
provide, multiple simultaneous hosts of one view, and UI classes that are not
View/UIView subclasses (not embeddable).
Source:
docs/native-ui.md