React Native CodePush

CodePush is a magical service that lets you update your app on the fly! It means that when you find a bug in your app you can push the code instantly to your users and update their apps / release new features.

Why should I care?

With Native apps you have to go through app review process every time you release a new version. Sometimes its fast, sometimes its not. But with CodePush you can update JS part of the app bypassing the review!

Me wants!

Setup is actually quite easy and documentation pretty good. You  need to:

  1. Install CLI tools
  2. Register your app
  3. Install CodePush in your app
    npm install --save react-native-code-push
    react-native link react-native-code-push
    
  4. Wrap your top-level component in a codepush wrapper
    import codePush from "react-native-code-push";
    class TeamParrot extends Component {
    ...
    }
    export default codePush( TeamParrot );
    
  5. Add deployment keys to your project
    1. iOS: add to info.plist:
      
      CodePushDeploymentKey
      your key
  6. To update and rollback your app:
    code-push release-react TeamParrot-ios ios
    code-push promote TeamParrot-ios Staging Production
    code-push rollback TeamParrot-ios Production
    
  7. Profit

React Native Isomorphic app over the weekend

This article is part of my “React Native Isomorphic app over the weekend” series. It shares the problems I encountered during development of TeamParrot and Headstart Journal.