Skip to content

Commit d334cdd

Browse files
Aaron Chiufacebook-github-bot
authored andcommitted
remove yellow box from systrace
Reviewed By: alexeylang Differential Revision: D5024794 fbshipit-source-id: 5551135c16adb6f93d2f5957171f41d63b9a6bf9
1 parent c7317c5 commit d334cdd

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

Libraries/ReactNative/AppContainer.js

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,28 @@ class AppContainer extends React.Component {
5252

5353
componentDidMount(): void {
5454
if (__DEV__) {
55-
this._subscription = RCTDeviceEventEmitter.addListener(
56-
'toggleElementInspector',
57-
() => {
58-
const Inspector = require('Inspector');
59-
const inspector = this.state.inspector
60-
? null
61-
: <Inspector
62-
inspectedViewTag={ReactNative.findNodeHandle(this._mainRef)}
63-
onRequestRerenderApp={(updateInspectedViewTag) => {
64-
this.setState(
65-
(s) => ({mainKey: s.mainKey + 1}),
66-
() => updateInspectedViewTag(
67-
ReactNative.findNodeHandle(this._mainRef)
68-
)
69-
);
70-
}}
71-
/>;
72-
this.setState({inspector});
73-
},
74-
);
55+
if (global.__RCTProfileIsProfiling) {
56+
this._subscription = RCTDeviceEventEmitter.addListener(
57+
'toggleElementInspector',
58+
() => {
59+
const Inspector = require('Inspector');
60+
const inspector = this.state.inspector
61+
? null
62+
: <Inspector
63+
inspectedViewTag={ReactNative.findNodeHandle(this._mainRef)}
64+
onRequestRerenderApp={(updateInspectedViewTag) => {
65+
this.setState(
66+
(s) => ({mainKey: s.mainKey + 1}),
67+
() => updateInspectedViewTag(
68+
ReactNative.findNodeHandle(this._mainRef)
69+
)
70+
);
71+
}}
72+
/>;
73+
this.setState({inspector});
74+
},
75+
);
76+
}
7577
}
7678
}
7779

@@ -84,8 +86,10 @@ class AppContainer extends React.Component {
8486
render(): React.Element<*> {
8587
let yellowBox = null;
8688
if (__DEV__) {
87-
const YellowBox = require('YellowBox');
88-
yellowBox = <YellowBox />;
89+
if (!global.__RCTProfileIsProfiling) {
90+
const YellowBox = require('YellowBox');
91+
yellowBox = <YellowBox />;
92+
}
8993
}
9094

9195
return (

0 commit comments

Comments
 (0)