Expo Setup (New Architechture)
Set up AppsOnAir CodePush in your React Native app, including installation, configuration, and integration of the deployment key and server URL.
Check React Native Architecture
Android
Open android/gradle.properties and ensure:
newArchEnabled=true
iOS
Open ios/Podfile and ensure:
:fabric_enabled => true
iOS
-
Open
ios/Podfile. -
Look for this flag:
use_react_native!(
:fabric_enabled => true,
)
If true, new architecture is enabled.
Install CodePush SDK
Run the following command to install react-native-code-push in your React Native project:
- NPM
- Yarn
npm install @code-push-next/react-native-code-push
yarn add @code-push-next/react-native-code-push
Don't forgot to install pods! (for iOS)
Minimum deployment target: iOS 15.0
Configure Expo for New Architecture
This setup only works if your project is using the New Architecture.
Install expo-build-properties
This step is only required if your iOS minimum deployment target is below 15.5, as codepush with Expo requires iOS 15.5 or above.
npx expo install expo-build-properties
Update app.json
{
"expo": {
"plugins": [
[
"expo-build-properties",
{
"ios": {
"deploymentTarget": "15.5"
}
}
],
[
"@code-push-next/react-native-code-push/expo",
{
"android": {
"CodePushDeploymentKey": "YOUR_ANDROID_KEY",
"CodePushServerURL": "https://codepush.appsonair.com"
},
"ios": {
"CodePushDeploymentKey": "YOUR_IOS_KEY",
"CodePushServerURL": "https://codepush.appsonair.com"
}
}
]
]
}
}
Replace <YOUR_ANDROID_KEY> and <YOUR_IOS_KEY> with your actual deployment keys.
Create or Update metro.config.js
To support .cjs files used by the CodePush plugin, update your metro.config.js:
const { getDefaultConfig } = require("@expo/metro-config");
const config = getDefaultConfig(__dirname);
config.resolver.sourceExts.push("cjs");
module.exports = config;
Install @react-native-community/cli as Dev Dependency
- NPM
- Yarn
npm install @react-native-community/cli --save-dev
yarn add -D @react-native-community/cli
Prebuild Native Projects
Generate native iOS and Android code based on your updated config and plugins:
npx expo prebuild --clean
This command applies all plugin changes and prepares the native environment.
Expo is now configured to support CodePush with New Architecture. You can skip native setup and move on to Project Setup.