diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp index 9b704b1a3eb..fdfd497f95a 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp @@ -7,7 +7,6 @@ #include "ShadowNode.h" #include "DynamicPropsUtilities.h" -#include "ShadowNodeFragment.h" #include #include @@ -24,7 +23,7 @@ namespace facebook::react { * Runtime shadow node reference updates should only run from one thread at all * times to avoid having more than one shadow tree updating the current fiber * tree simultaneously. This thread_local flag allows enabling the updates for - * choses threads. + * chosen threads. */ thread_local bool useRuntimeShadowNodeReferenceUpdateOnThread{false}; // NOLINT @@ -100,7 +99,7 @@ ShadowNode::ShadowNode( child->family_->setParent(family_); } - updateTraitsIfNeccessary(); + propagateUncullableTraitsFromChildren(); // The first node of the family gets its state committed automatically. family_->setMostRecentState(state_); @@ -129,7 +128,7 @@ ShadowNode::ShadowNode( for (const auto& child : *children_) { child->family_->setParent(family_); } - updateTraitsIfNeccessary(); + propagateUncullableTraitsFromChildren(); } } @@ -151,7 +150,7 @@ std::shared_ptr ShadowNode::clone( .state = fragment.state}); return clonedNode; } else { - // TODO: We might need to merge fragment.priops with + // TODO: We might need to merge fragment.props with // `family.nativeProps_DEPRECATED`. return componentDescriptor.cloneShadowNode(*this, fragment); } @@ -245,7 +244,7 @@ void ShadowNode::appendChild(const std::shared_ptr& child) { children.push_back(child); child->family_->setParent(family_); - updateTraitsIfNeccessary(); + propagateUncullableTraitsFromChildren(); } void ShadowNode::replaceChild( @@ -279,7 +278,7 @@ void ShadowNode::replaceChild( } react_native_assert(false && "Child to replace was not found."); - updateTraitsIfNeccessary(); + propagateUncullableTraitsFromChildren(); } void ShadowNode::cloneChildrenIfShared() { @@ -292,7 +291,7 @@ void ShadowNode::cloneChildrenIfShared() { *children_); } -void ShadowNode::updateTraitsIfNeccessary() { +void ShadowNode::propagateUncullableTraitsFromChildren() { if (ReactNativeFeatureFlags::enableViewCulling()) { if (traits_.check(ShadowNodeTraits::Trait::Unstable_uncullableView)) { return; diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h index ca0c1be6762..d4517e529ff 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h @@ -252,13 +252,13 @@ class ShadowNode : public Sealable, public DebugStringConvertible, public jsi::N void cloneChildrenIfShared(); /* - * Updates the node's traits based on its children's traits. - * Specifically, if view culling is enabled and any child has the - * Unstable_uncullableView or Unstable_uncullableTrace trait, this node will - * also be marked as uncullable. This ensures that if a child needs to be - * rendered, its parent will be too. + * Propagates uncullable traits from children to this node. + * If view culling is enabled and any child has the Unstable_uncullableView + * or Unstable_uncullableTrace trait, this node will also be marked as + * uncullable. This ensures that if a child needs to be rendered, its parent + * will be too. */ - void updateTraitsIfNeccessary(); + void propagateUncullableTraitsFromChildren(); /* * Transfer the runtime reference to this `ShadowNode` to a new instance, @@ -277,11 +277,6 @@ class ShadowNode : public Sealable, public DebugStringConvertible, public jsi::N */ mutable std::atomic hasBeenMounted_{false}; - /* - * True if shadow node has been promoted to be the next mounted tree. - */ - mutable bool hasBeenPromoted_{false}; - static Props::Shared propsForClonedShadowNode(const ShadowNode &sourceShadowNode, const Props::Shared &props); protected: