Setup
Expo Setup Guide
Complete guide to setting up Turbopush OTA updates in your Expo React Native app.
Installation
npm install --save @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-propertiesyarn add @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-propertiespnpm add @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-propertiesExpo Plugin Setup
- Add the following to your
app.jsonorapp.config.tsfile:
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
},
}
]
]
}
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 this command to generate the native code for your app.
npx expo prebuildyarn expo prebuildpnpm expo prebuildBasic JavaScript configuration
In your main app file:
import codePush from "@turbopush/react-native-code-push";
const App = () => {
// Your app component
};
export default App;
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:
npx turbopush release-expo myapp-ios ios "1.0.0"yarn turbopush release-expo myapp-ios ios "1.0.0"pnpm turbopush release-expo myapp-ios ios "1.0.0"or
npx turbopush release-expo myapp-android android "1.0.0"yarn turbopush release-expo myapp-android android "1.0.0"pnpm turbopush release-expo myapp-android android "1.0.0"Important release parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
--deploymentName, -d | No | Staging | Specifies the deployment |
--description, --des | No | - | Description of changes |
--mandatory, -m | No | false | Marks as mandatory update |
--rollout, -r | No | 100 | Sets rollout percentage |
Example with parameters
npx turbopush release-expo myapp-ios ios "1.0.0" \
--deploymentName "Production" \
--description "Critical bug fixes" \
--mandatory \
--rollout 50yarn turbopush release-expo myapp-ios ios "1.0.0" \
--deploymentName "Production" \
--description "Critical bug fixes" \
--mandatory \
--rollout 50pnpm turbopush release-expo myapp-ios ios "1.0.0" \
--deploymentName "Production" \
--description "Critical bug fixes" \
--mandatory \
--rollout 50Read more about Releasing Updates.
How is this guide?