React Native Brownfield provides first-class support for Objective-C.
The library is meant to work with auto linking. In case you can't use this feature, please check out the following options:
react-native link
Run the following command in your terminal: react-native link @callstack/react-native-brownfieldCocoaPods
Add the following line to your `Podfile`: pod 'ReactNativeBrownfield', :path => '../node_modules/@callstack/react-native-brownfield/ios'Manually link the library on iOS
Drag ReactNativeBrownfield.xcodeproj to your project on Xcode (usually under the Libraries group on Xcode):
Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag the static library from the Products folder inside the Library you are importing to Link Binary With Libraries (or use the + sign and choose library from the list):
You can import the object from:
#import <ReactNativeBrownfield/ReactNativeBrownfield.h>Statics:
shared
A singleton that keeps an instance of ReactNativeBrownfield object.
Examples:
[ReactNativeBrownfield shared]Properties:
| Property | Type | Default | Description |
|---|---|---|---|
| bridge | RCTBridge | nil | Launch options, typically passed from AppDelegate. |
| entryFile | NSString | index | Path to JavaScript root. |
| fallbackResource | NSString | nil | Path to bundle fallback resource. |
| bundlePath | NSString | main.jsbundle | Path to bundle fallback resource. |
Methods:
startReactNative
Starts React Native, produces an instance of a bridge. You can use it to initialize React Native in your app.
Params:
| Param | Required | Type | Description |
|---|---|---|---|
| onBundleLoaded | No | void(^)(void) | Callback invoked after JS bundle is fully loaded. |
| launchOptions | No | NSDictionary | Launch options, typically passed from AppDelegate. |
Examples:
[[ReactNativeBrownfield shared] startReactNative]; [[ReactNativeBrownfield shared] startReactNative:^(void){
NSLog(@"React Native started");
}]; [[ReactNativeBrownfield shared] startReactNative:^(void){
NSLog(@"React Native started");
}, launchOptions];A view controller that's rendering RCTRootView within its bounds. It automatically uses an instance of a bridge created in startReactNative method. It works well with exposed JavaScript module. It's the simplest way to embed React Native into your navigation stack.
You can import it from:
#import <ReactNativeBrownfield/ReactNativeViewController.h>Constructors:
[ReactNativeViewController initWithModuleName:moduleName andInitialProperties:initialProps]
| Param | Required | Type | Description |
|---|---|---|---|
| moduleName | Yes | NSString | Name of React Native component registered to AppRegistry. |
| initialProperties | No | NSString | Initial properties to be passed to React Native component. |
Examples:
[[ReactNativeViewController alloc] initWithModuleName:@"ReactNative"] [[ReactNativeViewController alloc] initWithModuleName:@"ReactNative" andInitialProperties:@{@"score": 12}]You can find an example app here.

