0

I need use code-push service in react-native on iOS platform. Version is 1.17.3-beta.

Local already deployed code-push service. then run the command line to import code-push plug-in.

As shown below.

npm install --save react-native-code-push

react-native link react-native-code-push

Loading code-push module in js.

import codePush from 'react-native-code-push'

There is a problem. prompt codePush is undefined. And I can not call apis for example checkForUpdate() sync().

componentDidMount(){
      AppState.addEventListener("change", (newState) => {
        newState === "active" && codePush.sync();
      });
    },

The documents of code-push can be found in node_modules directory,but why not be identified ?

Can any one help please ? Thanks.

dangxy
  • 11
  • 3

1 Answers1

0

Are you sure codePush is undefined?

Try this:

...
const codePushOptions = { checkFrequency: codePush.CheckFrequency.ON_APP_RESUME };
App = codePush(codePushOptions)(App);

AppRegistry.registerComponent('MyApp', () => App);
ostergaard
  • 3,377
  • 2
  • 30
  • 40