Permalink
Browse files

Disable yellow box warnings based on environment variable

Summary:
This adds a hook to let you disable yellow box warnings. It's useful for native engineers who don't want to mess with JS but also for CI/testing, where the app operates mostly as a blackbox.

Depends on D4395091

Reviewed By: achen1

Differential Revision: D4395552

fbshipit-source-id: 4c3a9676caa975c537d1a4711d60aab2f404db15
  • Loading branch information...
mmmulani authored and facebook-github-bot committed Jan 13, 2017
1 parent 91b7499 commit 49d7c00500d8cd4b742e8aaa9c92e39f92c3b6e5
Showing with 8 additions and 1 deletion.
  1. +5 −0 Libraries/ReactNative/YellowBox.js
  2. +3 −1 docs/Debugging.md
@@ -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;
}
}
/**
View
@@ -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.

0 comments on commit 49d7c00

Please sign in to comment.