From ecf1b8479515759284e72a6f8680201795273fdf Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Wed, 20 Sep 2023 09:55:05 -0700 Subject: [PATCH] SafeAreaView shouldn't dirty layout on clone by default (#39554) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39554 There's no need to auto-dirty this component on clone (which will happen every time one of its children is cloned), if we update the padding values in `ComponentDescriptor::adopt` this will [already dirty as necessary](https://github.com/facebook/react-native/blob/7888338295476f4d4f00733309e54b8d22318e1e/packages/react-native/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h#L28). Reviewed By: sammy-SC Differential Revision: D49058812 fbshipit-source-id: ea1ac8a1aa96c7ea24dcc48627a500f8c7fc2aae --- .../Libraries/Components/SafeAreaView/SafeAreaView.js | 7 ++++--- .../components/safeareaview/SafeAreaViewShadowNode.h | 7 ------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js index 3ce101533fe852..a154c827511f34 100644 --- a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -14,8 +14,6 @@ import Platform from '../../Utilities/Platform'; import View from '../View/View'; import * as React from 'react'; -let exported: React.AbstractComponent>; - /** * Renders nested content and automatically applies paddings reflect the portion * of the view that is not covered by navigation bars, tab bars, toolbars, and @@ -25,7 +23,10 @@ let exported: React.AbstractComponent>; * limitation of the screen, such as rounded corners or camera notches (aka * sensor housing area on iPhone X). */ -exported = Platform.select({ +const exported: React.AbstractComponent< + ViewProps, + React.ElementRef, +> = Platform.select({ ios: require('./RCTSafeAreaViewNativeComponent').default, default: View, }); diff --git a/packages/react-native/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h b/packages/react-native/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h index 64ca6231394e04..5a95f3b9decd53 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h @@ -25,13 +25,6 @@ class SafeAreaViewShadowNode final : public ConcreteViewShadowNode< ViewEventEmitter, SafeAreaViewState> { using ConcreteViewShadowNode::ConcreteViewShadowNode; - - public: - static ShadowNodeTraits BaseTraits() { - auto traits = ConcreteViewShadowNode::BaseTraits(); - traits.set(ShadowNodeTraits::Trait::DirtyYogaNode); - return traits; - } }; } // namespace facebook::react