0

My team recently added CodePush to our React Native app, and while it works perfectly fine on the original local repository, when I pull the changes I get the error

Cannot read property 'CheckFrequency' of undefined

This occurs after installing react-native-code-push and linking it properly. All answers I found for similar questions seemed to have this error when using Jest, but we are not using Jest and this error happens any time I run react-native run-ios

The code looks like this:

CodePush is imported

import codePush from "react-native-code-push";

And later in the same file, the error occurs on

let codePushOptions = {
  checkFrequency: codePush.CheckFrequency.MANUAL, // error here
  updateDialog: false,
  installMode: codePush.InstallMode.IMMEDIATE
}
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Sam Hollenbach
  • 652
  • 4
  • 19

2 Answers2

0

Try changing import to

import * as CodePush from 'react-native-code-push';
Anurag Chutani
  • 591
  • 1
  • 4
  • 15
0

In my case that was because I didn't link the package properly. once you link "react-native-codepush" properly (either automatic or using rnpm or manually) codePush won't be undefined.

Amir Gorji
  • 2,809
  • 1
  • 21
  • 26