500Docs
  • React Libraries
  • SSR
  • React Native

›React Native

React Libraries

  • Calendar

Server-Side Rendering

  • Setup
  • Redux Integration

React Native

  • Tools
  • Setup (iOS)
  • Setup (Android)
  • Running a Project
  • Linking Libraries
  • Debugging
  • Appcenter
  • Detox
  • Bugsnag
  • Notifications
  • Routing
  • Splash Screen
  • RTL
  • Animations
  • Common Problems

Appcenter

Setup

Follow Appcenter's 'Getting start' guide

You can opt-out of using the appcenter-crashes library, as it's not the most convenient service for crash reporting there is - simply don't install it. We suggest using Bugsnag instead.

Building iOS app

Follow Appcenter's guide for iOS builds

Building Android app

Follow Appcenter's guide for iOS builds

Codepush integration

Follow Appcenter's guide for CodePush

Run appcenter login in your terminal, then run appcenter apps list, to get a list of your available apps in Appcenter:

$ appcenter apps list

  OrganizationName/ProjectName-iOS
  OrganizationName/ProjectName-Android
  UserName/ProjectName

Open package.json, and add these commands in your scripts (remember to change 'OrganizationName/ProjectName' to one of the names from what you've got above):

"codepush-staging-ios": "appcenter codepush release-react -a OrganizationName/ProjectName-iOS -d Staging",
"codepush-staging-android": "appcenter codepush release-react -a OrganizationName/ProjectName-Android -d Staging",
"codepush-production-ios": "appcenter codepush release-react -a OrganizationName/ProjectName-iOS -d Production",
"codepush-production-android": "appcenter codepush release-react -a OrganizationName/ProjectName-Android -d Production",

Remember, because you're creating 2 'different' apps for iOS & Android, you're going to have 2 different deployment keys for CodePush update.

Use RN's Platform module to decide, which key to use:

#index.js

import { Platform } from 'react-native';

....

const DEPLOYMENT_KEYS = Platform.select({
  ios: {
    PRODUCTION: 'SerPQj9cGtwmgaE_m91dBSnAUmRaS1_EyMzXV',
    STAGING: '_YtLhvP8UKl9FSyWsCpIGpZI6pYbB1O4JfMQ4'
  },
  android: {
    PRODUCTION: 'zM2A_MkY67bfsSzOKCb95E07yKapB1_RcZ7m4',
    STAGING: 'EUNHVbivPpHK7xB29TBh8QXZ447nBJ_A5bXm4'
  }
});

Also, remember not to wrap your app with CodePush in development env, as you're app is going to be updated while you're working on it:

#index.js

...

const wrappedApp = __DEV__
  ? Root
  : codePush({
      updateDialog: true,
      checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
      installMode: codePush.InstallMode.IMMEDIATE,
      deploymentKey: DEPLOYMENT_KEYS.STAGING
    })(Root);

AppRegistry.registerComponent(appName, () => wrappedApp);
Last updated on 1/29/2019 by Vova Porton
← DebuggingDetox →
  • Setup
  • Building iOS app
  • Building Android app
  • Codepush integration
Copyright © 2020 500Tech