Skip to content

Commit

Permalink
Merge pull request #159 from reactwg/nits-to-docs
Browse files Browse the repository at this point in the history
Minor updates to New Architecture docs
  • Loading branch information
lunaleaps authored Mar 2, 2024
2 parents 9b4c6f6 + 6964346 commit 7316c2e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
6 changes: 0 additions & 6 deletions docs/appendix.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,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:
Expand Down Expand Up @@ -264,10 +262,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]
Expand Down
16 changes: 14 additions & 2 deletions docs/enable-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,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
Expand All @@ -24,12 +27,15 @@ 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
cd AwesomeProject
yarn install
```

### Enable New Architecture for iOS

#### For new apps created from React Native CLI

Navigate to the `ios` directory and run the following:

```shell
Expand All @@ -38,12 +44,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
Expand All @@ -60,6 +69,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
Expand All @@ -81,6 +91,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`
Expand All @@ -93,6 +104,7 @@ yarn android
```

#### For existing apps

You will only need to update your `android/gradle.properties` file as follows:

```diff
Expand Down
10 changes: 0 additions & 10 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,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.
Expand Down

0 comments on commit 7316c2e

Please sign in to comment.