From 654a36018c069aca836c512ce71c0e325ca1ff7e Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Fri, 29 Jul 2016 09:24:11 -0700 Subject: [PATCH] Don't collect warnings if yellow box is disabled Reviewed By: vjeux Differential Revision: D3641566 fbshipit-source-id: 1e2279be1656a305af8b4c5eaf32789a5ba6577d --- Libraries/ReactIOS/YellowBox.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Libraries/ReactIOS/YellowBox.js b/Libraries/ReactIOS/YellowBox.js index f9fc498cb..933105613 100644 --- a/Libraries/ReactIOS/YellowBox.js +++ b/Libraries/ReactIOS/YellowBox.js @@ -25,9 +25,9 @@ import type EmitterSubscription from 'EmitterSubscription'; import type {StackFrame} from 'parseErrorStack'; type WarningInfo = { - count: number; - stacktrace: Array; - symbolicated: boolean; + count: number, + stacktrace: Array, + symbolicated: boolean, }; const _warningEmitter = new EventEmitter(); @@ -85,6 +85,9 @@ function sprintf(format, ...args) { } function updateWarningMap(format, ...args): void { + if (console.disableYellowBox) { + return; + } const stringifySafe = require('stringifySafe'); format = String(format); @@ -268,9 +271,9 @@ const WarningInspector = ({ class YellowBox extends React.Component { state: { - stacktraceVisible: boolean; - inspecting: ?string; - warningMap: Map; + stacktraceVisible: boolean, + inspecting: ?string, + warningMap: Map, }; _listener: ?EmitterSubscription; dismissWarning: (warning: ?string) => void;