0

My react native app is working ok, but now need to add code push,

my question is where to add the

CodePush

On the "App"

Here my code,

const App = () => (
  
  <Provider store={store}>
    <NavigationContainer>
      <SafeAreaProvider>
        <View style={styles.container}>
          <Main/>
        </View>
      </SafeAreaProvider>
    </NavigationContainer>
  </Provider>
);

// let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_START };

// App = CodePush(codePushOptions)(App);

export default App;

But if I uncomment

let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_START };

App = CodePush(codePushOptions)(App);

export default App;

is Crashing...

How to properly add the CodePush to my App?

manuelBetancurt
  • 15,428
  • 33
  • 118
  • 216

2 Answers2

2

You dont have to set the value to the App, you can directly return like below

let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_START };

export default CodePush(codePushOptions)(App);
Guruparan Giritharan
  • 15,660
  • 4
  • 27
  • 50
0

You need to declare a new variable. You cant use App because App is already declared and used.

MyApp = codePush(App);
export default MyApp;