mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
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
This commit is contained in:
parent
bce77c8b3b
commit
3aea678c38
@ -30,24 +30,26 @@ export type Props = ViewProps;
|
||||
|
||||
let ViewToExport = ViewNativeComponent;
|
||||
if (__DEV__) {
|
||||
const View = (
|
||||
props: Props,
|
||||
forwardedRef: React.Ref<typeof ViewNativeComponent>,
|
||||
) => {
|
||||
return (
|
||||
<TextAncestor.Consumer>
|
||||
{hasTextAncestor => {
|
||||
invariant(
|
||||
!hasTextAncestor,
|
||||
'Nesting of <View> within <Text> is not currently supported.',
|
||||
);
|
||||
return <ViewNativeComponent {...props} ref={forwardedRef} />;
|
||||
}}
|
||||
</TextAncestor.Consumer>
|
||||
);
|
||||
};
|
||||
// $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<typeof ViewNativeComponent>,
|
||||
) => {
|
||||
return (
|
||||
<TextAncestor.Consumer>
|
||||
{hasTextAncestor => {
|
||||
invariant(
|
||||
!hasTextAncestor,
|
||||
'Nesting of <View> within <Text> is not currently supported.',
|
||||
);
|
||||
return <ViewNativeComponent {...props} ref={forwardedRef} />;
|
||||
}}
|
||||
</TextAncestor.Consumer>
|
||||
);
|
||||
};
|
||||
// $FlowFixMe - TODO T29156721 `React.forwardRef` is not defined in Flow, yet.
|
||||
ViewToExport = React.forwardRef(View);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ((ViewToExport: $FlowFixMe): typeof ViewNativeComponent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user