diff --git a/docs/appendix.md b/docs/appendix.md index 3322edb..02f6116 100644 --- a/docs/appendix.md +++ b/docs/appendix.md @@ -169,8 +169,6 @@ Callback functions are not type checked, and are generalized as `Object`s. ## IV. Invoking the code-gen during development -> This section contains information specific to v0.66 of React Native. - The Codegen is typically invoked at build time, but you may find it useful to generate your native interface code on demand for troubleshooting. If you wish to invoke the Codegen manually, you have three options: @@ -262,10 +260,6 @@ In the above example, the code-gen script will generate several files: `MyLibSpe This guide provides instructions for migrating an application that is based on the default app template that is provided by React Native. If your app has deviated from the template, or you are working with an application that was never based off the template, then the following sections might help. -### Finding your bridge delegate - -This guide assumes that the `AppDelegate` is configured as the bridge delegate. If you are not sure which is your bridge delegate, then place a breakpoint in `RCTBridge` and `RCTCxxBridge`, run your app, and inspect `self.delegate`. - --- > [!IMPORTANT] diff --git a/docs/enable-apps.md b/docs/enable-apps.md index 1f67269..6abfd96 100644 --- a/docs/enable-apps.md +++ b/docs/enable-apps.md @@ -6,11 +6,14 @@ This page will help you create or migrate a React Native app that uses the New A > If you're using Expo or plan to use Expo, you can't enable the New Architecture at the moment and will have to wait for a future release of the Expo SDK. ### Prerequisites + 1. Use or upgrade to the latest React Native version. This guide is written with the expectation that you’re using the [**latest** React Native release](https://github.com/facebook/react-native/releases/latest). 2. If you previously installed a global `react-native-cli` package, please remove it as it may cause unexpected issues: + ```shell npm uninstall -g react-native-cli @react-native-community/cli ``` + 3. Enable Hermes. If you are using React Native 0.70 or above, it is already the [default JS engine](https://reactnative.dev/blog/2022/07/08/hermes-as-the-default) so no action is needed. ### Create a React Native app @@ -22,12 +25,13 @@ If following the setup guide, stop when you reach the section **Running your Rea Then, create a new React Native project from the template: ```shell -npx react-native@latest init AwesomeProject +npx react-native@latest init AwesomeProject --skip-install ``` ### Enable New Architecture for iOS #### For new apps created from React Native CLI + Navigate to the `ios` directory and run the following: ```shell @@ -36,12 +40,15 @@ bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install ``` Then build and run the app as usual: + ```shell yarn ios ``` -#### For existing apps +#### For existing apps + You'll need to reinstall your pods by running `pod install` with the right flag: + ```shell # Run pod install with the flag: RCT_NEW_ARCH_ENABLED=1 bundle exec pod install @@ -58,6 +65,7 @@ You will need to run `pod install` each time a dependency with native code chang "pod-install": "RCT_NEW_ARCH_ENABLED=1 bundle exec pod install" } ``` + and run it with `yarn pod-install`. Note that `bundle install` does not need to run a second time, as long as the Gemfile has not changed. ##### Use Xcode to rename files in the `ios` folder @@ -79,6 +87,7 @@ If you see a build failure from `react-native run-ios`, there may be cached file > You may notice longer build times with the New Architecture due to additional step of C++ compilation with the Android NDK. To improve your build time, see [Speeding Up Your Build Phase](https://reactnative.dev/docs/build-speed). #### For new apps created from React Native CLI + Set the `newArchEnabled` property to `true` by **either**: - Changing the corresponding line in `android/gradle.properties` @@ -91,6 +100,7 @@ yarn android ``` #### For existing apps + You will only need to update your `android/gradle.properties` file as follows: ```diff diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 4c32e32..5e8a732 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -21,16 +21,6 @@ The CocoaPods integration will see frequent updates as we rollout the New Archit 3. Delete `node_modules` and re-run `yarn install`. 4. Delete your codegen artifacts and re-run `pod install` (or `arch -x86_64 pod install`, in case of a Mac M1), then clean and build your Xcode project. -## Folly Version - -As it happens, the Folly version used in your podspec must match whatever version is used in React Native at this time. If you see the following error after running `pod install`: - -``` -[!] CocoaPods could not find compatible versions for pod "RCT-Folly": -``` - -...you may have a version-mismatch. Take a look at your `node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec.podspec` file and make note of the `folly_version` used there. Go back to your own podspec and set your `folly_version` to match. - ## Android build is failing with `OutOfMemoryException` If your Android Gradle builds are failing with: `OutOfMemoryException: Out of memory: Java heap space.` or similar errors related to low memory, you might need to increase the memory allocated to the JVM.