From 3aea678c38b3f2f208c039a22fc9c6f841826e81 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Wed, 22 Aug 2018 17:32:12 -0700 Subject: [PATCH] RN: Reduce ForwardRef(View) Noise in Systrace Summary: When running a trace, reduce the noise from the `__DEV__`-only `ForwardRef(View)` elements. Reviewed By: ejanzer Differential Revision: D9445865 fbshipit-source-id: 7cfe87bab6dd62d3800d2ca239724b5063c55c89 --- Libraries/Components/View/View.js | 38 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index 0ec2fda48..2de1d5979 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -30,24 +30,26 @@ export type Props = ViewProps; let ViewToExport = ViewNativeComponent; if (__DEV__) { - const View = ( - props: Props, - forwardedRef: React.Ref, - ) => { - return ( - - {hasTextAncestor => { - invariant( - !hasTextAncestor, - 'Nesting of within is not currently supported.', - ); - return ; - }} - - ); - }; - // $FlowFixMe - TODO T29156721 `React.forwardRef` is not defined in Flow, yet. - ViewToExport = React.forwardRef(View); + if (!global.__RCTProfileIsProfiling) { + const View = ( + props: Props, + forwardedRef: React.Ref, + ) => { + return ( + + {hasTextAncestor => { + invariant( + !hasTextAncestor, + 'Nesting of within is not currently supported.', + ); + return ; + }} + + ); + }; + // $FlowFixMe - TODO T29156721 `React.forwardRef` is not defined in Flow, yet. + ViewToExport = React.forwardRef(View); + } } module.exports = ((ViewToExport: $FlowFixMe): typeof ViewNativeComponent);