|
| 1 | +--- |
| 2 | +id: release-levels |
| 3 | +title: Release Levels |
| 4 | +--- |
| 5 | + |
| 6 | +React Native provides the community with the ability to adopt individual new features as soon as their design and implementation are nearly complete, even before they are included in a stable release. This approach is known as **release levels**. |
| 7 | + |
| 8 | +You can configure the release level of React Native so that your React Native instance will initialize with Feature Flags set to either `EXPERIMENTAL`, `CANARY`, or `STABLE` modes. |
| 9 | + |
| 10 | +:::note |
| 11 | +This approach is similar to [Canary and Experimental releases in React](https://react.dev/blog/2023/05/03/react-canaries), but with a key difference: regardless of the release level, the same version of React JS and React Native code is used. |
| 12 | +React Native is also not using `@canary` or `@experimental` NPM tags, as release levels are available for both stable and nightly releases of React Native. |
| 13 | +::: |
| 14 | + |
| 15 | +Moreover, setting the release level to `EXPERIMENTAL` or `CANARY` will **not** result in consuming `react@nightly` or `react@canary` due to how react-native is consuming the React version ([you can read more about it here](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Renderer/README.md#react--react-native-versions)). |
| 16 | + |
| 17 | +## When to Use Each Release Level |
| 18 | + |
| 19 | +- **`STABLE`**: |
| 20 | + - Use for all production apps and libraries that do not need early access to unreleased features. |
| 21 | + - This is the default level for stable and nightly releases. |
| 22 | +- **`CANARY`:** |
| 23 | + - Use if you are a framework author, advanced app developer, or need to test or adopt new features before they are released in stable. |
| 24 | + - Not recommended for production or user-facing applications. |
| 25 | +- **`EXPERIMENTAL`:** |
| 26 | + - Use only for testing and providing feedback for new features in the early stages of development |
| 27 | + - Not recommended for production or user-facing applications. |
| 28 | + |
| 29 | +## How to initialize React Native using Canary & Experimental |
| 30 | + |
| 31 | +### Android |
| 32 | + |
| 33 | +The `DefaultNewArchitectureEntryPoint` class now has a `releaseLevel` property (default: `STABLE`). |
| 34 | +The feature flag system uses this property to select the appropriate set of feature flags for the chosen release level. |
| 35 | + |
| 36 | +```kotlin title="Example usage" |
| 37 | +DefaultNewArchitectureEntryPoint.releaseLevel = ReleaseLevel.CANARY |
| 38 | +DefaultNewArchitectureEntryPoint.load() |
| 39 | +``` |
| 40 | + |
| 41 | +The build system generates different feature flag override classes for each release level, ensuring the correct features are enabled for each stage. |
| 42 | + |
| 43 | +### iOS |
| 44 | + |
| 45 | +The `RCTReactNativeFactory` class now has an initializer that accepts a `releaseLevel` parameter. The feature flag setup uses this parameter to select the correct feature flag overrides. |
| 46 | + |
| 47 | +```objc title="Example usage" |
| 48 | +[[RCTReactNativeFactory alloc] initWithDelegate:delegate releaseLevel:Canary]; |
| 49 | +``` |
| 50 | +
|
| 51 | +The system ensures that only one release level is active per app instance, and will crash if multiple factories are created with different release levels. |
0 commit comments