A monorepo demonstrating React Native brownfield integration with native iOS (Swift/UIKit) and Android (Kotlin) calculator apps.
| iOS | Android |
|---|---|
![]() |
![]() |
brownfield/
├── ios/
│ ├── BrownfieldCalculator/ # Main RN app
│ └── ReactBrownfield/ # Framework for brownfield integration
├── test-apps/
│ ├── ios/Calculator/ # Native iOS Calculator (Swift/UIKit)
│ └── android/Calculator/ # Native Android Calculator (Kotlin)
├── src/
│ └── screens/InfoScreen.tsx # React Native Info screen
├── scripts/
│ ├── build-xcframework.sh # Build iOS framework
│ ├── build-calculator.sh # Build iOS Calculator
│ └── run-calculator.sh # Run iOS Calculator
└── package.json
- Node.js >= 18.0.0
- Yarn
- Xcode 15+ (for iOS)
- Android Studio / Android SDK (for Android)
- CocoaPods
yarn installcd ios && pod install && cd ..# 1. Start Metro bundler (in separate terminal)
yarn start
# 2. Build the ReactBrownfield.xcframework
./scripts/build-xcframework.sh
# 3. Build and run Calculator
./scripts/build-calculator.sh
./scripts/run-calculator.sh-
Build the ReactBrownfield framework:
./scripts/build-xcframework.sh
-
Open Calculator in Xcode:
open test-apps/ios/Calculator/Calculator.xcodeproj
-
Build and run on simulator (Cmd+R)
-
In the Calculator app, tap the Info button in the top-right corner to navigate to the React Native screen
-
Tap ← Back to return to the native Calculator
# 1. Start Metro bundler (in separate terminal)
yarn start
# 2. Build and install Calculator
cd test-apps/android/Calculator
./gradlew assembleDebug installDebug
# 3. Launch the app
adb shell am start -n com.brownfield.calculator/.MainActivity-
Open Android Studio and import
test-apps/android/Calculator -
Wait for Gradle sync to complete
-
Run on emulator or device (Shift+F10)
-
In the Calculator app, tap the Info button in the toolbar to navigate to the React Native screen
-
Tap ← Back to return to the native Calculator
The Android app bundles the JS code during build, so Metro bundler is not required at runtime. However, you need Metro running if you modify the React Native code and want to rebuild.
- ReactBrownfield.xcframework - A framework containing React Native runtime and the
ReactBrownfieldRootViewManagerfor loading RN views - The native Calculator embeds this framework and uses it to present the Info screen
- Communication from RN to native (dismiss) uses the
ReactNativeBridgenative module
- React Native is integrated using standard
ReactApplicationandReactActivity SoLoader.init(this, OpenSourceMergedSoMapping)is critical for loading native libs in RN 0.76+- JS bundle is embedded in the APK assets
- Communication from RN to native uses the
ReactNativeBridgenative module
Run ./scripts/build-xcframework.sh first to build the framework.
Make sure the JS bundle is built. Run ./gradlew clean assembleDebug to rebuild.
Ensure you're using SoLoader.init(this, OpenSourceMergedSoMapping) in the Application class.
MIT

