0

HI I want to run some code only when It is a production build like sentry or google analystics .

I have checked Is there a way to keep debug code out of a release build in React Native? this post but

if(__DEV__) {
    this.setState({username: 'Niel', password: 'Test'});
}

__DEV__ gives me undefined variable name.

Is not working.

can someone help me out of it?

Thanks

cakePHP
  • 296
  • 3
  • 14

1 Answers1

0

Checkout https://github.com/facebook/react-native/issues/7814

Removing .babelrc seems to fix the problem.

My .babelrc:

{ "presets": ["react-native"] }
Nooruddin Lakhani
  • 6,507
  • 2
  • 16
  • 35