React Native New Architecture Sample
This repo contains several branches that will help you understand how to setup your project for the React Native New Architecture. This should considered as a support material of the official migration guide.
Here you will find runs of the migration guide on empty projects. Every commit is documented and allows to follow over on every step.
Some branches also have a RUN.md
(example: ios/20220309
) file that can help you follow the commits with additional context.
Please find a list of the branches below, with more information on which kind of setup they're addressing.
Branches
Branch name | Description | Android | iOS |
---|---|---|---|
run/from-0.67-to-0.69 |
A full migration from RN 0.67 to 0.69 | ✅ | ✅ |
run/from-0.67-to-0.70 |
A full migration from RN 0.67 to 0.70 | ✅ | ✅ |
run/pure-cxx-module |
A step-by-step guide on how to integrate a Pure C++ module in a React Native 0.71.0-RC.2 app. Thanks to @christophpurrer for the guide | ✅ | ✅ |
view-flattening-ios |
Examples of View Flattening on iOS | ✅ |
Sample Run
A sample run will have commits marked as [TurboModule]
or [Fabric]
to clarify which aspect of the New Architecture is involved.
For example, for the run/android/20220202
branch will look like the following:
- 582a8a7
[Fabric] Use the new Fabric custom component
- adeee8b
[Fabric] Register the MainComponentsRegistry
- 5e7d88f
[Fabric] Add a MainComponentsRegistry for the application
- 8afa19e
[Fabric] Add a React Package that will load the ViewManager
- c893370
[Fabric] Create the corresponding ViewManager
- 32885f5
[Fabric] Create a custom component spec file
- 5408f18
[Fabric] call setIsFabric(true) in the MainActivity
- 20a8378
[Fabric] Provide the JSI Module Package
- cf1378e
[TurboModule] Let's try to use this TurboModule
- a80cea1
[TurboModule] Enable TurboModule system in the Android App
- d8884c2
[TurboModule] Add the C++ implementation for MainApplicationTurboModuleManagerDelegate
- f6d2e81
[TurboModule] Register a new TurboModulePackage
- 7ae59dd
[TurboModule] Install the ReactPackageTurboModuleManagerDelegateBuilder
- 4dfcfa6
[TurboModule] Setup the NDK Build for the Android app
- a0cf888
[TurboModule] Implement the generated native spec interface
- ba3f2a4
[TurboModule] Configure the codegen with libraryname and Java package
- 7da902f
[TurboModule] Add a NativeModule Spec file
- cb0eceb
Setup the React Gradle Plugin
- 66ca29b
Build React Native from Source
- be102a1
Enable Hermes
- 4357af9
Bump React Native to a nightly version
- a3866a1
Result of npx react-native init
Older Branches
Here we collect older branches that are working, but no longer relevant.
Branch name | Description | Android | iOS |
---|---|---|---|
run/android/0.68.0-rc2 |
A run from an empty project on RN 0.68.0-rc2 using the New Architecture template | ✅ | |
run/android/20220202 |
A run from an empty project on RN 0.67.2, migrated to run on a RN nightly version 0.0.0-20211205-2008-583471bc4 . Here you can see all the step-by-step migration needed for an app coming from RN 0.67 |
✅ | |
run/android/0.68.0-rc3 |
A run from an empty project on RN 0.68.0-rc3 using the New Architecture template | ✅ | |
ios/20220309 |
A run from an empty project starting from 0.67.3 to an app with a Turbomodule and a Fabric component | ✅ | |
run/from-0.67-to-0.68 |
A full migration from RN 0.67 to 0.68 | ✅ | ✅ |
run/ios/0.68.0-rc.4-typescript |
A migration from RN 0.67 to RN 0.68 with typescript suppport for iOS | ✅ | |
run/android/0.68.0-rc.4-typescript |
A migration from RN 0.67 to RN 0.68 with typescript suppport for Android | ✅ |