I'm building react-native app with Exponent and do some logging with console.error
e.g. when network request fails etc. While it's helpful in development to see this red screen with error on simulator or real device, I'm getting this too when __DEV__
is set to false
(seeing it is set so in logs) while the web says it shouldn't work like this.
How can I disable that for non-dev builds? Is there any other way than monkey-patching console.error
?
I'm building react-native app with Exponent and do some logging with console.error
e.g. when network request fails etc. While it's helpful in development to see this red screen with error on simulator or real device, I'm getting this too when __DEV__
is set to false
(seeing it is set so in logs) while the web says it shouldn't work like this.
How can I disable that for non-dev builds? Is there any other way than monkey-patching console.error
?
You are getting this fullscreen error until you run your app in production mode. That means you need to run your iOS/Android app in production.
If you want to do it with iOS you need to change your Scheme to Release
More details can be found here
Just to add to the answer by Tobias Lins, for the sake of pleteness.
You can also use the following, both in prod and debug builds:
import { LogBox } from 'react-native';
// Ignore on a per-message basis
LogBox.ignoreLogs(['Warning: ReactNative.createElement is deprecated…']);
// Ignore all
LogBox.ignoreAllLogs();