Skip to main content

Expo Setup

Installation

npm install --save @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties

Expo Plugin Setup

  1. Add the following to your app.json or app.config.ts file:
note

Turbopush SDK requires a minimum deployment target of 15.5, if you're using a higher version, you can ignore the expo-build-properties plugin.

{
"plugins": [
[
"expo-build-properties",
{
"ios": {
"deploymentTarget": "15.5",
},
},
],
[
"@turbopush/turbopush-expo-plugin",
{
"android": {
"CodePushDeploymentKey": "YOUR_ANDROID_CODE_PUSH_KEY", // generated in the create app step
},
"ios": {
"CodePushDeploymentKey": "YOUR_IOS_CODE_PUSH_KEY", // generated in the create app step
},
}
]
]
}
note

For the sake of simplicity, we're using the deployment key hardcoded in the app.json file. However, we recommend using environment variables to store your deployment keys. e.g. process.env.EXPO_PUBLIC_TURBOPUSH_ANDROID_KEY and process.env.EXPO_PUBLIC_TURBOPUSH_IOS_KEY.

Prebuild

Run npx expo prebuild to generate the native code for your app.

Basic JavaScript configuration

In your main app file (e.g., App.js):

import codePush from "@turbopush/react-native-code-push";

const App = () => {
// Your app component
};

export default codePush(App);

For advanced configuration, refer to the JavaScript API Reference.

6. First Release

Creating a Release (Expo)

Use the specific command that automatically generates the bundle:

npm turbopush release-expo myapp-ios ios 1.0.0

or

npm turbopush release-expo myapp-android android 1.0.0

Important release parameters

  • --deploymentName or -d: Specifies the deployment (default: "Staging")
  • --description or --des: Description of changes
  • --mandatory or -m: Marks as mandatory update
  • --rollout or -r: Sets rollout percentage (e.g., --rollout 25)

Example with parameters

npm turbopush release-expo myapp-ios ios 1.0.0 --deploymentName Production --description "Critical bug fixes" --mandatory --rollout 50

Read more about Releasing Updates.