This repository is a simple playground presenting how to use @rnx-kit/react-native-host
with brownfield apps.
There are two branches:
main
- standard way of integrating React Native with existing appreact-native-host
- integrating React Native with existing app using@rnx-kit/react-native-host
- Clone the repository
- Checkout
react-native-host
branch - Run
yarn install
- Run
pod install
inios
folder - Run
yarn start
- Open
ReactNativeExample.xcworkspace
in Xcode and run the app
- Update React Native version to 0.72 in
package.json
- Run
yarn install
- Run
yarn add @react-native/metro-config --dev
and createmetro.config.js
with this content (breaking change in 0.72) - Run
pod install
inios
folder - Run
yarn start
- Open
ReactNativeExample.xcworkspace
in Xcode and run the app
After opening the RN screen, you should see 0.72 version in the top right corner.
- Run
RCT_NEW_ARCH_ENABLED=1 pod install
inios
folder - Run
yarn start
- Open
ReactNativeExample.xcworkspace
in Xcode and run the app
After opening the RN screen, you should see in Metro logs that Fabric renderer is enabled. No changes in the codebase required to switch to New Architecture with React Native Host ๐