From d334cdd5907359d2af0f36efd0e351bba0ec14d3 Mon Sep 17 00:00:00 2001 From: Aaron Chiu Date: Thu, 11 May 2017 20:48:16 -0700 Subject: [PATCH] remove yellow box from systrace Reviewed By: alexeylang Differential Revision: D5024794 fbshipit-source-id: 5551135c16adb6f93d2f5957171f41d63b9a6bf9 --- Libraries/ReactNative/AppContainer.js | 48 +++++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/Libraries/ReactNative/AppContainer.js b/Libraries/ReactNative/AppContainer.js index 68a88ffe6..e5d40c477 100644 --- a/Libraries/ReactNative/AppContainer.js +++ b/Libraries/ReactNative/AppContainer.js @@ -52,26 +52,28 @@ class AppContainer extends React.Component { componentDidMount(): void { if (__DEV__) { - this._subscription = RCTDeviceEventEmitter.addListener( - 'toggleElementInspector', - () => { - const Inspector = require('Inspector'); - const inspector = this.state.inspector - ? null - : { - this.setState( - (s) => ({mainKey: s.mainKey + 1}), - () => updateInspectedViewTag( - ReactNative.findNodeHandle(this._mainRef) - ) - ); - }} - />; - this.setState({inspector}); - }, - ); + if (global.__RCTProfileIsProfiling) { + this._subscription = RCTDeviceEventEmitter.addListener( + 'toggleElementInspector', + () => { + const Inspector = require('Inspector'); + const inspector = this.state.inspector + ? null + : { + this.setState( + (s) => ({mainKey: s.mainKey + 1}), + () => updateInspectedViewTag( + ReactNative.findNodeHandle(this._mainRef) + ) + ); + }} + />; + this.setState({inspector}); + }, + ); + } } } @@ -84,8 +86,10 @@ class AppContainer extends React.Component { render(): React.Element<*> { let yellowBox = null; if (__DEV__) { - const YellowBox = require('YellowBox'); - yellowBox = ; + if (!global.__RCTProfileIsProfiling) { + const YellowBox = require('YellowBox'); + yellowBox = ; + } } return (