Skip to content

Commit

Permalink
SafeAreaView shouldn't dirty layout on clone by default (#39554)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
javache authored and facebook-github-bot committed Sep 20, 2023
1 parent 0789736 commit ecf1b84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import Platform from '../../Utilities/Platform';
import View from '../View/View';
import * as React from 'react';

let exported: React.AbstractComponent<ViewProps, React.ElementRef<typeof View>>;

/**
* Renders nested content and automatically applies paddings reflect the portion
* of the view that is not covered by navigation bars, tab bars, toolbars, and
Expand All @@ -25,7 +23,10 @@ let exported: React.AbstractComponent<ViewProps, React.ElementRef<typeof View>>;
* 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<typeof View>,
> = Platform.select({
ios: require('./RCTSafeAreaViewNativeComponent').default,
default: View,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ecf1b84

Please sign in to comment.