Expo Setup
Installation
- npm
- yarn
npm install --save @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties
yarn add @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties
Expo Plugin Setup
- Add the following to your
app.jsonorapp.config.tsfile:
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
- yarn
npx turbopush release-expo myapp-ios ios 1.0.0
yarn turbopush release-expo myapp-ios ios 1.0.0
or
- npm
- yarn
npx turbopush release-expo myapp-android android 1.0.0
yarn turbopush release-expo myapp-android android 1.0.0
Important release parameters
--deploymentNameor-d: Specifies the deployment (default: "Staging")--descriptionor--des: Description of changes--mandatoryor-m: Marks as mandatory update--rolloutor-r: Sets rollout percentage (e.g.,--rollout 25)
Example with parameters
- npm
- yarn
npx turbopush release-expo myapp-ios ios 1.0.0 --deploymentName Production --description "Critical bug fixes" --mandatory --rollout 50
yarn turbopush release-expo myapp-ios ios 1.0.0 --deploymentName Production --description "Critical bug fixes" --mandatory --rollout 50
Read more about Releasing Updates.