diff --git a/Libraries/ReactNative/YellowBox.js b/Libraries/ReactNative/YellowBox.js index e3aee27b531..0a5e1b51cd3 100644 --- a/Libraries/ReactNative/YellowBox.js +++ b/Libraries/ReactNative/YellowBox.js @@ -69,6 +69,11 @@ if (__DEV__) { warn.apply(console, arguments); updateWarningMap.apply(null, arguments); }; + + const ProcessInfo = require('NativeModules').ProcessInfo; + if (ProcessInfo && ProcessInfo.environment.DISABLE_YELLOW_BOX) { + (console: any).disableYellowBox = true; + } } /** diff --git a/docs/Debugging.md b/docs/Debugging.md index 1888650b87a..a011eb4ae11 100644 --- a/docs/Debugging.md +++ b/docs/Debugging.md @@ -49,7 +49,9 @@ Warnings will be displayed on screen with a yellow background. These alerts are As with a RedBox, you can use `console.warn()` to trigger a YellowBox. -YellowBoxes can be disabled during development by using `console.disableYellowBox = true;`. Specific warnings can be ignored programmatically by setting an array of prefixes that should be ignored: `console.ignoredYellowBox = ['Warning: ...'];` +YellowBoxes can be disabled during development by using `console.disableYellowBox = true;`. Specific warnings can be ignored programmatically by setting an array of prefixes that should be ignored: `console.ignoredYellowBox = ['Warning: ...'];`. + +In CI/Xcode, YellowBoxes can also be disabled by setting the `DISABLE_YELLOW_BOX` environment variable. > RedBoxes and YellowBoxes are automatically disabled in release (production) builds.