Skip to main content

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:

Terminal
npm install @code-push-next/react-native-code-push
for IOS

Don't forgot to install pods! (for iOS)

Note

Minimum deployment target: iOS 15.0


Configure Expo for New Architecture​

Note

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.

Terminal
npx expo install expo-build-properties

Update app.json​

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​

Terminal
npm install @react-native-community/cli --save-dev

Prebuild Native Projects​

Generate native iOS and Android code based on your updated config and plugins:

Terminal
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.