From d280772ea4b2b945340e88c6b95ffb4c0dd56dac Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Wed, 1 May 2024 22:50:10 -0700 Subject: [PATCH] Remove manual flattening of pointerEvents in View (#44352) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44352 Confirmed in https://github.com/facebook/react/commit/d779eba4b375134f373b7dfb9ea98d01c84bc48e that style properties already take priority over direct props, so we can avoid flattening style here. Changelog: [General][Fixed] Small performance tweak to View wrapper to avoid unnecessary style flattening. Reviewed By: sammy-SC Differential Revision: D56740899 fbshipit-source-id: ceec3e9665e2f69637c832af7dc59ce2feb65e24 --- .../react-native/Libraries/Components/View/View.js | 11 ----------- .../Libraries/Components/View/__tests__/View-test.js | 1 - 2 files changed, 12 deletions(-) diff --git a/packages/react-native/Libraries/Components/View/View.js b/packages/react-native/Libraries/Components/View/View.js index c4d2fc63ada..e51583ca6fe 100644 --- a/packages/react-native/Libraries/Components/View/View.js +++ b/packages/react-native/Libraries/Components/View/View.js @@ -10,7 +10,6 @@ import type {ViewProps} from './ViewPropTypes'; -import flattenStyle from '../../StyleSheet/flattenStyle'; import TextAncestor from '../../Text/TextAncestor'; import ViewNativeComponent from './ViewNativeComponent'; import * as React from 'react'; @@ -53,7 +52,6 @@ const View: React.AbstractComponent< id, importantForAccessibility, nativeID, - pointerEvents, tabIndex, ...otherProps }: ViewProps, @@ -96,12 +94,6 @@ const View: React.AbstractComponent< }; } - // $FlowFixMe[underconstrained-implicit-instantiation] - let style = flattenStyle(otherProps.style); - - // $FlowFixMe[sketchy-null-mixed] - const newPointerEvents = style?.pointerEvents || pointerEvents; - const actualView = ( ); diff --git a/packages/react-native/Libraries/Components/View/__tests__/View-test.js b/packages/react-native/Libraries/Components/View/__tests__/View-test.js index 18649af87ee..cf9be9fffe8 100644 --- a/packages/react-native/Libraries/Components/View/__tests__/View-test.js +++ b/packages/react-native/Libraries/Components/View/__tests__/View-test.js @@ -178,7 +178,6 @@ describe('View compat with web', () => { expect(instance.toJSON()).toMatchInlineSnapshot(`