React Native - __DEV__ is undefined

I have a project react-native@0.26.2. I deleted the node_modules folder and after I gave the following commands:

npm i react-native upgrade 

but I get this error:

 react-native.js:15 ReferenceError: __DEV__ is not defined 

How can i fix it?

+7
npm reactjs react-native
source share
4 answers

Maybe this? https://github.com/facebook/react-native/issues/7814

Removing .babelrc seems to fix the problem.

My.babelrc:

{"presets": ["response-native"]}

+6
source share

The .babelrc file is hidden in the folder.
I just delete it and then react to work with my native project.

0
source share

Since this is the first search result, I wanted to drop another hint for those who encounter this problem with a native-network reaction and a joke.

As described in detail at https://github.com/facebookincubator/create-react-app/issues/1085 , if you map react-native to react-native-web in your system assembly (webpack, for me) then you will also need this mapping in your jest configuration.

I have seen

 ReferenceError: __DEV__ is not defined 

when I ran tests through a joke. Adding

 moduleNameMapper: { '^react-native$': 'react-native-web', } 

to jest.config.js fixed this for me.

0
source share

Adding "babel-preset-react-native" to devDependencies solved this problem

0
source share

All Articles