diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 5fb42d9f9ef298..647699a97fd969 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<32afa527b04c5ede00ecbac498d229e9>> */ /** @@ -334,12 +334,6 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean = accessor.useRuntimeShadowNodeReferenceUpdateOnLayout() - /** - * When enabled, it uses optimised state reconciliation algorithm. - */ - @JvmStatic - public fun useStateAlignmentMechanism(): Boolean = accessor.useStateAlignmentMechanism() - /** * In Bridgeless mode, should legacy NativeModules use the TurboModule system? */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index 68e4e60d24c70e..226e4ab679f5d1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<19dca512d93d689e927ee5988a43e646>> + * @generated SignedSource<<8b904803bc7fea167a54395830a0a9dd>> */ /** @@ -71,7 +71,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null private var useRuntimeShadowNodeReferenceUpdateCache: Boolean? = null private var useRuntimeShadowNodeReferenceUpdateOnLayoutCache: Boolean? = null - private var useStateAlignmentMechanismCache: Boolean? = null private var useTurboModuleInteropCache: Boolean? = null private var useTurboModulesCache: Boolean? = null @@ -534,15 +533,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso return cached } - override fun useStateAlignmentMechanism(): Boolean { - var cached = useStateAlignmentMechanismCache - if (cached == null) { - cached = ReactNativeFeatureFlagsCxxInterop.useStateAlignmentMechanism() - useStateAlignmentMechanismCache = cached - } - return cached - } - override fun useTurboModuleInterop(): Boolean { var cached = useTurboModuleInteropCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index 7bd8cfdc898324..4fcb157307889e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<76eebf045692e945d39a4ea27a63ae02>> + * @generated SignedSource<<03027b2e7b5861322553d638ff9890f8>> */ /** @@ -130,8 +130,6 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean - @DoNotStrip @JvmStatic public external fun useStateAlignmentMechanism(): Boolean - @DoNotStrip @JvmStatic public external fun useTurboModuleInterop(): Boolean @DoNotStrip @JvmStatic public external fun useTurboModules(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index 7a844d2e333707..30e9caa70e8359 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<8155a9c1309145fefdb19feb33c241db>> + * @generated SignedSource<<8744b271838b0d6c5e6234880bdfd360>> */ /** @@ -125,8 +125,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean = false - override fun useStateAlignmentMechanism(): Boolean = false - override fun useTurboModuleInterop(): Boolean = false override fun useTurboModules(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index c855a74f49e353..6318ed372eae3f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<5e4e474b62996caec15bbf8af9622a0a>> + * @generated SignedSource<> */ /** @@ -75,7 +75,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null private var useRuntimeShadowNodeReferenceUpdateCache: Boolean? = null private var useRuntimeShadowNodeReferenceUpdateOnLayoutCache: Boolean? = null - private var useStateAlignmentMechanismCache: Boolean? = null private var useTurboModuleInteropCache: Boolean? = null private var useTurboModulesCache: Boolean? = null @@ -589,16 +588,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces return cached } - override fun useStateAlignmentMechanism(): Boolean { - var cached = useStateAlignmentMechanismCache - if (cached == null) { - cached = currentProvider.useStateAlignmentMechanism() - accessedFeatureFlags.add("useStateAlignmentMechanism") - useStateAlignmentMechanismCache = cached - } - return cached - } - override fun useTurboModuleInterop(): Boolean { var cached = useTurboModuleInteropCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index 2098020dd96e33..026ef009fdae9c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<97eddbbd75ff7cfd0f1c905d72e9eafd>> + * @generated SignedSource<<12ca99bd2947eda279018830e2f5f795>> */ /** @@ -125,8 +125,6 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean - @DoNotStrip public fun useStateAlignmentMechanism(): Boolean - @DoNotStrip public fun useTurboModuleInterop(): Boolean @DoNotStrip public fun useTurboModules(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index 8fe3b974a72e78..e6a56bdc90cff1 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<383e9749c506bc2326455ef907e06a4c>> + * @generated SignedSource<<5b012254d44fdf27d76dd656a2e37a48>> */ /** @@ -345,12 +345,6 @@ class ReactNativeFeatureFlagsProviderHolder return method(javaProvider_); } - bool useStateAlignmentMechanism() override { - static const auto method = - getReactNativeFeatureFlagsProviderJavaClass()->getMethod("useStateAlignmentMechanism"); - return method(javaProvider_); - } - bool useTurboModuleInterop() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("useTurboModuleInterop"); @@ -622,11 +616,6 @@ bool JReactNativeFeatureFlagsCxxInterop::useRuntimeShadowNodeReferenceUpdateOnLa return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout(); } -bool JReactNativeFeatureFlagsCxxInterop::useStateAlignmentMechanism( - facebook::jni::alias_ref /*unused*/) { - return ReactNativeFeatureFlags::useStateAlignmentMechanism(); -} - bool JReactNativeFeatureFlagsCxxInterop::useTurboModuleInterop( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::useTurboModuleInterop(); @@ -807,9 +796,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "useRuntimeShadowNodeReferenceUpdateOnLayout", JReactNativeFeatureFlagsCxxInterop::useRuntimeShadowNodeReferenceUpdateOnLayout), - makeNativeMethod( - "useStateAlignmentMechanism", - JReactNativeFeatureFlagsCxxInterop::useStateAlignmentMechanism), makeNativeMethod( "useTurboModuleInterop", JReactNativeFeatureFlagsCxxInterop::useTurboModuleInterop), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index c478530d81b695..9ebed048fa440a 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<293ed423f770e7e0ba95b19eb5c28dc2>> + * @generated SignedSource<<7828e8c5267a3ffce342a150c05e3d81>> */ /** @@ -183,9 +183,6 @@ class JReactNativeFeatureFlagsCxxInterop static bool useRuntimeShadowNodeReferenceUpdateOnLayout( facebook::jni::alias_ref); - static bool useStateAlignmentMechanism( - facebook::jni::alias_ref); - static bool useTurboModuleInterop( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index 09d76c096ffaf7..a64fe041c845a3 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<85cdb5a41317e9671cc23b2c7345c04d>> + * @generated SignedSource<> */ /** @@ -225,10 +225,6 @@ bool ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout() { return getAccessor().useRuntimeShadowNodeReferenceUpdateOnLayout(); } -bool ReactNativeFeatureFlags::useStateAlignmentMechanism() { - return getAccessor().useStateAlignmentMechanism(); -} - bool ReactNativeFeatureFlags::useTurboModuleInterop() { return getAccessor().useTurboModuleInterop(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index c844d4651574f6..712fae7d5693b0 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<59bef17cdec5857e9327e8f04f7e0204>> */ /** @@ -292,11 +292,6 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool useRuntimeShadowNodeReferenceUpdateOnLayout(); - /** - * When enabled, it uses optimised state reconciliation algorithm. - */ - RN_EXPORT static bool useStateAlignmentMechanism(); - /** * In Bridgeless mode, should legacy NativeModules use the TurboModule system? */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 09f80847d1fd2e..6f54052e8b02cd 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<71d845d565e2a8783f7583213e6010de>> */ /** @@ -947,24 +947,6 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdateOnLayou return flagValue.value(); } -bool ReactNativeFeatureFlagsAccessor::useStateAlignmentMechanism() { - auto flagValue = useStateAlignmentMechanism_.load(); - - if (!flagValue.has_value()) { - // This block is not exclusive but it is not necessary. - // If multiple threads try to initialize the feature flag, we would only - // be accessing the provider multiple times but the end state of this - // instance and the returned flag value would be the same. - - markFlagAsAccessed(51, "useStateAlignmentMechanism"); - - flagValue = currentProvider_->useStateAlignmentMechanism(); - useStateAlignmentMechanism_ = flagValue; - } - - return flagValue.value(); -} - bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() { auto flagValue = useTurboModuleInterop_.load(); @@ -974,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(52, "useTurboModuleInterop"); + markFlagAsAccessed(51, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -992,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(53, "useTurboModules"); + markFlagAsAccessed(52, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index c7db3980bfcc49..835598c9552945 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<5f2c9b500fc26e68d56efae08b15575f>> + * @generated SignedSource<<2b2db46f819ffb208fba052aee5f2fc6>> */ /** @@ -82,7 +82,6 @@ class ReactNativeFeatureFlagsAccessor { bool useOptimizedEventBatchingOnAndroid(); bool useRuntimeShadowNodeReferenceUpdate(); bool useRuntimeShadowNodeReferenceUpdateOnLayout(); - bool useStateAlignmentMechanism(); bool useTurboModuleInterop(); bool useTurboModules(); @@ -95,7 +94,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 54> accessedFeatureFlags_; + std::array, 53> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> allowRecursiveCommitsWithSynchronousMountOnAndroid_; @@ -148,7 +147,6 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> useOptimizedEventBatchingOnAndroid_; std::atomic> useRuntimeShadowNodeReferenceUpdate_; std::atomic> useRuntimeShadowNodeReferenceUpdateOnLayout_; - std::atomic> useStateAlignmentMechanism_; std::atomic> useTurboModuleInterop_; std::atomic> useTurboModules_; }; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 5ce07698ba0d8a..076049eaf0bd12 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<0520639ff05f8bc2199de7be3b26e6e0>> */ /** @@ -231,10 +231,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } - bool useStateAlignmentMechanism() override { - return false; - } - bool useTurboModuleInterop() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 9fd1367f2c1b36..6b5f95dac61909 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<83348430670eef22eb555b4048805fbb>> */ /** @@ -76,7 +76,6 @@ class ReactNativeFeatureFlagsProvider { virtual bool useOptimizedEventBatchingOnAndroid() = 0; virtual bool useRuntimeShadowNodeReferenceUpdate() = 0; virtual bool useRuntimeShadowNodeReferenceUpdateOnLayout() = 0; - virtual bool useStateAlignmentMechanism() = 0; virtual bool useTurboModuleInterop() = 0; virtual bool useTurboModules() = 0; }; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 5316822e3b2d52..025f7f2bcb8f17 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<2b484558d552981e4ec0644d75849dde>> + * @generated SignedSource<<530400259d51b9eeccdd0bcb78e5f8e1>> */ /** @@ -292,11 +292,6 @@ bool NativeReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout( return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout(); } -bool NativeReactNativeFeatureFlags::useStateAlignmentMechanism( - jsi::Runtime& /*runtime*/) { - return ReactNativeFeatureFlags::useStateAlignmentMechanism(); -} - bool NativeReactNativeFeatureFlags::useTurboModuleInterop( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::useTurboModuleInterop(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index ded551e76c8665..a35507d855730a 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<94afee988401ba2af586ec8fe310cb8b>> + * @generated SignedSource<<404d188886a579d044278e48288f1733>> */ /** @@ -137,8 +137,6 @@ class NativeReactNativeFeatureFlags bool useRuntimeShadowNodeReferenceUpdateOnLayout(jsi::Runtime& runtime); - bool useStateAlignmentMechanism(jsi::Runtime& runtime); - bool useTurboModuleInterop(jsi::Runtime& runtime); bool useTurboModules(jsi::Runtime& runtime); diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp index 9bcedf901cd03e..814df904eef2c4 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp @@ -78,7 +78,6 @@ ShadowNode::ShadowNode( react_native_assert(children_); traits_.set(ShadowNodeTraits::Trait::ChildrenAreShared); - traits_.set(fragment.traits.get()); for (const auto& child : *children_) { child->family_->setParent(family_); @@ -110,9 +109,7 @@ ShadowNode::ShadowNode( // State could have been progressed above by checking // `sourceShadowNode.getMostRecentState()`. - traits_.unset(ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); traits_.set(ShadowNodeTraits::Trait::ChildrenAreShared); - traits_.set(fragment.traits.get()); if (fragment.children) { for (const auto& child : *children_) { @@ -136,8 +133,7 @@ ShadowNode::Unshared ShadowNode::clone( *this, {.props = props, .children = fragment.children, - .state = fragment.state, - .traits = fragment.traits}); + .state = fragment.state}); return clonedNode; } else { // TODO: We might need to merge fragment.priops with @@ -293,23 +289,6 @@ bool ShadowNode::getHasBeenPromoted() const { return hasBeenMounted_.load(); } -bool ShadowNode::progressStateIfNecessary() { - auto hasBeenPromoted = hasBeenMounted_.load(); - if (!hasBeenPromoted && state_) { - ensureUnsealed(); - auto mostRecentState = family_->getMostRecentStateIfObsolete(*state_); - if (mostRecentState) { - state_ = mostRecentState; - const auto& componentDescriptor = family_->componentDescriptor_; - // Must call ComponentDescriptor::adopt to trigger any side effect - // state may have. E.g. adjusting padding. - componentDescriptor.adopt(*this); - return true; - } - } - return false; -} - void ShadowNode::setRuntimeShadowNodeReference( const std::shared_ptr& runtimeShadowNodeReference) const { @@ -342,8 +321,7 @@ const ShadowNodeFamily& ShadowNode::getFamily() const { ShadowNode::Unshared ShadowNode::cloneTree( const ShadowNodeFamily& shadowNodeFamily, const std::function& - callback, - ShadowNodeTraits traits) const { + callback) const { auto ancestors = shadowNodeFamily.getAncestors(*this); if (ancestors.empty()) { @@ -371,8 +349,7 @@ ShadowNode::Unshared ShadowNode::cloneTree( children[childIndex] = childNode; childNode = parentNode.clone( - {.children = std::make_shared(children), - .traits = traits}); + {.children = std::make_shared(children)}); } return std::const_pointer_cast(childNode); diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h index 48196b4475b05f..30f5ea8a6d2593 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h @@ -102,8 +102,8 @@ class ShadowNode : public Sealable, */ Unshared cloneTree( const ShadowNodeFamily& shadowNodeFamily, - const std::function& callback, - ShadowNodeTraits traits = {}) const; + const std::function& callback) + const; #pragma mark - Getters @@ -178,17 +178,6 @@ class ShadowNode : public Sealable, */ bool getHasBeenPromoted() const; - /* - * Applies the most recent state to the ShadowNode if following conditions are - * met: - * - ShadowNode has a state. - * - ShadowNode has not been mounted before. - * - ShadowNode's current state is obsolete. - * - * Returns true if the state was applied, false otherwise. - */ - bool progressStateIfNecessary(); - /* * Bind the runtime reference to this `ShadowNode` with a weak pointer, * allowing to update the reference to this `ShadowNode` when cloned. diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFragment.h b/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFragment.h index e17f62aa5ab593..4651dce387fe46 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFragment.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeFragment.h @@ -26,7 +26,6 @@ struct ShadowNodeFragment { const Props::Shared& props = propsPlaceholder(); const ShadowNode::SharedListOfShared& children = childrenPlaceholder(); const State::Shared& state = statePlaceholder(); - const ShadowNodeTraits traits = {}; const bool runtimeShadowNodeReference = true; /* diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeTraits.h b/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeTraits.h index 729207447c51ce..926a97cae6012c 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeTraits.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNodeTraits.h @@ -70,14 +70,11 @@ class ShadowNodeTraits { // to be cloned before the first mutation. ChildrenAreShared = 1 << 8, - // Indicates that the node was cloned because of native state update. - ClonedByNativeStateUpdate = 1 << 9, - // Indicates that direct children of the node should not be collapsed - ChildrenFormStackingContext = 1 << 10, + ChildrenFormStackingContext = 1 << 9, // Inherits `YogaLayoutableShadowNode` and has a custom baseline function. - BaselineYogaNode = 1 << 11, + BaselineYogaNode = 1 << 10, }; /* diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp index b2c840db60d1cb..a65243fac18783 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp @@ -298,6 +298,7 @@ ShadowViewNodePair::NonOwningList sliceChildShadowNodeViewPairs( } size_t startOfStaticIndex = 0; + sliceChildShadowNodeViewPairsRecursively( pairList, startOfStaticIndex, scope, layoutOffset, shadowNode); diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp index f3aa8e9d63f192..3a674a4ef42a00 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -26,115 +26,6 @@ namespace facebook::react { using CommitStatus = ShadowTree::CommitStatus; using CommitMode = ShadowTree::CommitMode; -// --- State Alignment Mechanism algorithm --- -// Note: Ideally, we don't have to const_cast but our use of constness in -// C++ is overly restrictive. We do const_cast here but the only place where -// we change ShadowNode is by calling `ShadowNode::progressStateIfNecessary` -// where checks are in place to avoid manipulating a sealed ShadowNode. - -static void progressStateIfNecessary( - ShadowNode& newShadowNode, - const ShadowNode& baseShadowNode); - -/* - * Looks at the new parent, new child and base child node to determine how to - * reconcile the state. - * - * Only to be called when baseChildNode has trait `ClonedByNativeStateUpdate`. - */ -static void progressStateIfNecessary( - ShadowNode& newShadowNode, - const ShadowNode& newChildNode, - const ShadowNode& baseChildNode, - size_t suggestedIndex) { - auto& shadowNode = const_cast(newChildNode); - if (shadowNode.progressStateIfNecessary()) { - // State was progressed without the need to clone. - // We are done with this node, but need to keep traversing. - progressStateIfNecessary(shadowNode, baseChildNode); - } else if (newChildNode.getHasBeenPromoted()) { - // `newShadowNode` was cloned from react and cloned from a native state - // update. This child node was cloned only from a native state update. - // This is branching and it is safe to promote the new branch from - // native state update. - auto clonedChildNode = baseChildNode.clone({}); - newShadowNode.replaceChild(newChildNode, clonedChildNode, suggestedIndex); - } else { - // `newShadowNode` was cloned from react and cloned from a native state - // update. This child node was cloned also by react. - // we can't reason about this on this layer and need to keep traversing. - progressStateIfNecessary(shadowNode, baseChildNode); - } -} - -static void progressStateIfNecessary( - ShadowNode& newShadowNode, - const ShadowNode& baseShadowNode) { - auto& newChildren = newShadowNode.getChildren(); - auto& baseChildren = baseShadowNode.getChildren(); - - auto newChildrenSize = newChildren.size(); - auto baseChildrenSize = baseChildren.size(); - auto index = size_t{0}; - - for (index = 0; index < newChildrenSize && index < baseChildrenSize; - ++index) { - const auto& newChildNode = *newChildren[index]; - const auto& baseChildNode = *baseChildren[index]; - - if (&newChildNode == &baseChildNode) { - // Nodes are identical. They are shared between `newShadowNode` and - // `baseShadowNode` and it is safe to skipping. - continue; - } - - if (!ShadowNode::sameFamily(newChildNode, baseChildNode)) { - // React has changed the structure of the tree. We will realign the - // structure below. - break; - } - - if (!baseChildNode.getTraits().check( - ShadowNodeTraits::Trait::ClonedByNativeStateUpdate)) { - // was not cloned with a new state, we can continue. - continue; - } - - progressStateIfNecessary(newShadowNode, newChildNode, baseChildNode, index); - } - - // === Realigning the tree === - - auto unprocessedBaseChildren = baseChildren.begin(); - std::advance(unprocessedBaseChildren, index); - for (; index < newChildrenSize; ++index) { - const auto& newChildNode = *newChildren[index]; - auto baseChildNodeIterator = std::find_if( - unprocessedBaseChildren, - baseChildren.end(), - [&newChildNode](auto baseChildNode) { - return ShadowNode::sameFamily(newChildNode, *baseChildNode); - }); - if (baseChildNodeIterator == baseChildren.end()) { - // This must never happen and there is a mismatch between the two trees. - // No way of recover from this, let's just continue. - continue; - } - - const auto& baseChildNode = *(*baseChildNodeIterator); - - if (!baseChildNode.getTraits().check( - ShadowNodeTraits::Trait::ClonedByNativeStateUpdate)) { - // was not cloned with a new state, we can continue. - continue; - } - - progressStateIfNecessary(newShadowNode, newChildNode, baseChildNode, index); - } -} - -// --- End of State Alignment Mechanism algorithm --- - /* * Generates (possibly) a new tree where all nodes with non-obsolete `State` * objects. If all `State` objects in the tree are not obsolete for the moment @@ -393,15 +284,11 @@ CommitStatus ShadowTree::tryCommit( } if (commitOptions.enableStateReconciliation) { - if (ReactNativeFeatureFlags::useStateAlignmentMechanism()) { - progressStateIfNecessary(*newRootShadowNode, *oldRootShadowNode); - } else { - auto updatedNewRootShadowNode = - progressState(*newRootShadowNode, *oldRootShadowNode); - if (updatedNewRootShadowNode) { - newRootShadowNode = - std::static_pointer_cast(updatedNewRootShadowNode); - } + auto updatedNewRootShadowNode = + progressState(*newRootShadowNode, *oldRootShadowNode); + if (updatedNewRootShadowNode) { + newRootShadowNode = + std::static_pointer_cast(updatedNewRootShadowNode); } } diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp index 39d2aafb76f8fb..f1c44381f45b6f 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp @@ -24,20 +24,6 @@ using namespace facebook::react; -class StateReconciliationTestFeatureFlags - : public ReactNativeFeatureFlagsDefaults { - public: - explicit StateReconciliationTestFeatureFlags(bool useStateAlignmentMechanism) - : useStateAlignmentMechanism_(useStateAlignmentMechanism) {} - - bool useStateAlignmentMechanism() override { - return useStateAlignmentMechanism_; - } - - private: - bool useStateAlignmentMechanism_; -}; - class DummyShadowTreeDelegate : public ShadowTreeDelegate { public: RootShadowNode::Unshared shadowTreeWillCommit( @@ -82,20 +68,10 @@ class StateReconciliationTest : public ::testing::TestWithParam { public: StateReconciliationTest() : builder_(simpleComponentBuilder()) {} - void SetUp() override { - ReactNativeFeatureFlags::dangerouslyReset(); - ReactNativeFeatureFlags::override( - std::make_unique(GetParam())); - } - - void TearDown() override { - ReactNativeFeatureFlags::dangerouslyReset(); - } - ComponentBuilder builder_; }; -TEST_P(StateReconciliationTest, testStateReconciliation) { +TEST_F(StateReconciliationTest, testStateReconciliation) { // ==== SETUP ==== /* @@ -158,15 +134,10 @@ TEST_P(StateReconciliationTest, testStateReconciliation) { auto state2 = scrollViewComponentDescriptor.createState( scrollViewFamily, std::make_shared()); - auto newTraits = ShadowNodeTraits(); - newTraits.set(ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); - auto rootShadowNodeState2 = initialRootShadowNode->cloneTree( - scrollViewFamily, - [&](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = state2, .traits = newTraits}); - }, - newTraits); + scrollViewFamily, [&](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = state2}); + }); EXPECT_EQ( findDescendantNode(*initialRootShadowNode, scrollViewFamily)->getState(), @@ -190,11 +161,9 @@ TEST_P(StateReconciliationTest, testStateReconciliation) { scrollViewFamily, std::make_shared()); auto rootShadowNodeState3 = rootShadowNodeState2->cloneTree( - scrollViewFamily, - [&](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = state3, .traits = newTraits}); - }, - newTraits); + scrollViewFamily, [&](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = state3}); + }); EXPECT_EQ( findDescendantNode(*rootShadowNodeState3, scrollViewFamily)->getState(), @@ -232,7 +201,7 @@ TEST_P(StateReconciliationTest, testStateReconciliation) { state3->getRevision()); } -TEST_P(StateReconciliationTest, testCloneslessStateReconciliationDoesntClone) { +TEST_F(StateReconciliationTest, testCloneslessStateReconciliationDoesntClone) { // ==== SETUP ==== /* @@ -286,15 +255,10 @@ TEST_P(StateReconciliationTest, testCloneslessStateReconciliationDoesntClone) { auto state2 = scrollViewComponentDescriptor.createState( scrollViewFamily, std::make_shared()); - auto newTraits = ShadowNodeTraits(); - newTraits.set(ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); - auto rootShadowNode2 = rootShadowNode1->cloneTree( - scrollViewFamily, - [&](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = state2, .traits = newTraits}); - }, - newTraits); + scrollViewFamily, [&](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = state2}); + }); EXPECT_EQ( findDescendantNode(*rootShadowNode2, scrollViewFamily)->getState(), @@ -324,11 +288,9 @@ TEST_P(StateReconciliationTest, testCloneslessStateReconciliationDoesntClone) { scrollViewFamily, std::make_shared()); auto rootShadowNodeClonedFromStateUpdate = rootShadowNode2->cloneTree( - scrollViewFamily, - [&](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = state3, .traits = newTraits}); - }, - newTraits); + scrollViewFamily, [&](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = state3}); + }); // ==== State update ==== @@ -351,15 +313,9 @@ TEST_P(StateReconciliationTest, testCloneslessStateReconciliationDoesntClone) { auto scrollViewShadowNode = findDescendantNode(shadowTree, scrollViewFamily); EXPECT_EQ(scrollViewShadowNode->getState(), state3); - - if (GetParam()) { - // Checking that newlyClonedShadowNode was not cloned unnecessarly by state - // progression. This fails with the old algorithm. - EXPECT_EQ(scrollViewShadowNode, newlyClonedShadowNode.get()); - } } -TEST_P(StateReconciliationTest, testStateReconciliationScrollViewChildUpdate) { +TEST_F(StateReconciliationTest, testStateReconciliationScrollViewChildUpdate) { // ==== SETUP ==== /* @@ -431,15 +387,10 @@ TEST_P(StateReconciliationTest, testStateReconciliationScrollViewChildUpdate) { auto state2 = scrollViewComponentDescriptor.createState( scrollViewFamily, std::make_shared()); - auto newTraits = ShadowNodeTraits(); - newTraits.set(ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); - auto rootShadowNode2 = initialRootShadowNode->cloneTree( - scrollViewFamily, - [&](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = state2, .traits = newTraits}); - }, - newTraits); + scrollViewFamily, [&](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = state2}); + }); shadowTree.commit( [&](const RootShadowNode& /*oldRootShadowNode*/) { @@ -464,7 +415,7 @@ TEST_P(StateReconciliationTest, testStateReconciliationScrollViewChildUpdate) { newlyClonedViewShadowNode.get()); } -TEST_P(StateReconciliationTest, testScrollViewWithChildrenDeletion) { +TEST_F(StateReconciliationTest, testScrollViewWithChildrenDeletion) { // ==== SETUP ==== /* @@ -539,18 +490,13 @@ TEST_P(StateReconciliationTest, testScrollViewWithChildrenDeletion) { // ==== State update ==== - auto newTraits = ShadowNodeTraits(); - newTraits.set(ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); - auto newState = scrollViewComponentDescriptor.createState( childBFamily, std::make_shared()); auto rootShadowNodeClonedFromStateUpdate = rootNode->cloneTree( - childBFamily, - [&newState, newTraits](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = newState, .traits = newTraits}); - }, - newTraits); + childBFamily, [&newState](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = newState}); + }); shadowTree.commit( [&rootShadowNodeClonedFromStateUpdate]( @@ -578,7 +524,7 @@ TEST_P(StateReconciliationTest, testScrollViewWithChildrenDeletion) { newState); } -TEST_P(StateReconciliationTest, testScrollViewWithComplexChildrenReorder) { +TEST_F(StateReconciliationTest, testScrollViewWithComplexChildrenReorder) { // ==== SETUP ==== /* @@ -660,18 +606,13 @@ TEST_P(StateReconciliationTest, testScrollViewWithComplexChildrenReorder) { // ==== State update ==== - auto newTraits = ShadowNodeTraits(); - newTraits.set(ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); - auto newState = scrollViewComponentDescriptor.createState( childAFamily, std::make_shared()); auto rootShadowNodeClonedFromStateUpdate = rootNode->cloneTree( - childAFamily, - [&newState, newTraits](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = newState, .traits = newTraits}); - }, - newTraits); + childAFamily, [&newState](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = newState}); + }); shadowTree.commit( [&rootShadowNodeClonedFromStateUpdate]( @@ -697,7 +638,7 @@ TEST_P(StateReconciliationTest, testScrollViewWithComplexChildrenReorder) { EXPECT_EQ(findDescendantNode(shadowTree, childAFamily)->getState(), newState); } -TEST_P(StateReconciliationTest, testScrollViewWithChildrenReorder) { +TEST_F(StateReconciliationTest, testScrollViewWithChildrenReorder) { // ==== SETUP ==== /* @@ -766,18 +707,13 @@ TEST_P(StateReconciliationTest, testScrollViewWithChildrenReorder) { // ==== State update ==== - auto newTraits = ShadowNodeTraits(); - newTraits.set(ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); - auto newState = scrollViewComponentDescriptor.createState( childAFamily, std::make_shared()); auto rootShadowNodeClonedFromStateUpdate = rootNode->cloneTree( - childAFamily, - [&newState, newTraits](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = newState, .traits = newTraits}); - }, - newTraits); + childAFamily, [&newState](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = newState}); + }); shadowTree.commit( [&rootShadowNodeClonedFromStateUpdate]( @@ -803,7 +739,7 @@ TEST_P(StateReconciliationTest, testScrollViewWithChildrenReorder) { EXPECT_EQ(findDescendantNode(shadowTree, childAFamily)->getState(), newState); } -TEST_P(StateReconciliationTest, testScrollViewWithChildrenAddition) { +TEST_F(StateReconciliationTest, testScrollViewWithChildrenAddition) { // ==== SETUP ==== /* @@ -856,18 +792,13 @@ TEST_P(StateReconciliationTest, testScrollViewWithChildrenAddition) { // ==== State update ==== - auto newTraits = ShadowNodeTraits(); - newTraits.set(ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); - auto newState = scrollViewComponentDescriptor.createState( scrollViewFamily, std::make_shared()); auto rootShadowNodeClonedFromStateUpdate = rootNode->cloneTree( - scrollViewFamily, - [&newState, newTraits](const ShadowNode& oldShadowNode) { - return oldShadowNode.clone({.state = newState, .traits = newTraits}); - }, - newTraits); + scrollViewFamily, [&newState](const ShadowNode& oldShadowNode) { + return oldShadowNode.clone({.state = newState}); + }); // ==== Tree with new child ==== @@ -922,8 +853,3 @@ TEST_P(StateReconciliationTest, testScrollViewWithChildrenAddition) { findDescendantNode(shadowTree, childB->getFamily())->getState(), newState); } - -INSTANTIATE_TEST_SUITE_P( - StateReconciliationTestInstantiation, - StateReconciliationTest, - testing::Values(false, true)); diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp index a97a9acb05f0ef..be8da13aad3e97 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -361,9 +361,6 @@ void UIManager::updateState(const StateUpdate& stateUpdate) const { auto& callback = stateUpdate.callback; auto& family = stateUpdate.family; auto& componentDescriptor = family->getComponentDescriptor(); - auto clonedByNativeStateTraits = ShadowNodeTraits(); - clonedByNativeStateTraits.set( - ShadowNodeTraits::Trait::ClonedByNativeStateUpdate); shadowTreeRegistry_.visit( family->getSurfaceId(), [&](const ShadowTree& shadowTree) { @@ -372,8 +369,7 @@ void UIManager::updateState(const StateUpdate& stateUpdate) const { auto isValid = true; auto rootNode = oldRootShadowNode.cloneTree( - *family, - [&](const ShadowNode& oldShadowNode) { + *family, [&](const ShadowNode& oldShadowNode) { auto newData = callback(oldShadowNode.getState()->getDataPointer()); @@ -389,10 +385,8 @@ void UIManager::updateState(const StateUpdate& stateUpdate) const { return oldShadowNode.clone( {.props = ShadowNodeFragment::propsPlaceholder(), .children = ShadowNodeFragment::childrenPlaceholder(), - .state = newState, - .traits = clonedByNativeStateTraits}); - }, - clonedByNativeStateTraits); + .state = newState}); + }); return isValid ? std::static_pointer_cast(rootNode) diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 7dc63f49a76dde..bf360217264148 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -475,15 +475,6 @@ const definitions: FeatureFlagDefinitions = { purpose: 'experimentation', }, }, - useStateAlignmentMechanism: { - defaultValue: false, - metadata: { - dateAdded: '2024-04-12', - description: - 'When enabled, it uses optimised state reconciliation algorithm.', - purpose: 'experimentation', - }, - }, useTurboModuleInterop: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 577d22448e4750..c029075d918c54 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> * @flow strict */ @@ -100,7 +100,6 @@ export type ReactNativeFeatureFlags = { useOptimizedEventBatchingOnAndroid: Getter, useRuntimeShadowNodeReferenceUpdate: Getter, useRuntimeShadowNodeReferenceUpdateOnLayout: Getter, - useStateAlignmentMechanism: Getter, useTurboModuleInterop: Getter, useTurboModules: Getter, } @@ -389,10 +388,6 @@ export const useRuntimeShadowNodeReferenceUpdate: Getter = createNative * When enabled, cloning shadow nodes during layout will update the reference held by the current JS fiber tree. */ export const useRuntimeShadowNodeReferenceUpdateOnLayout: Getter = createNativeFlagGetter('useRuntimeShadowNodeReferenceUpdateOnLayout', false); -/** - * When enabled, it uses optimised state reconciliation algorithm. - */ -export const useStateAlignmentMechanism: Getter = createNativeFlagGetter('useStateAlignmentMechanism', false); /** * In Bridgeless mode, should legacy NativeModules use the TurboModule system? */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index fb2d28bfff7d50..7014e891277465 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<0467a8715892bbeca0a08681c730aeab>> + * @generated SignedSource<<1c253f57f70409a8b3f4724d8b4172e8>> * @flow strict */ @@ -74,7 +74,6 @@ export interface Spec extends TurboModule { +useOptimizedEventBatchingOnAndroid?: () => boolean; +useRuntimeShadowNodeReferenceUpdate?: () => boolean; +useRuntimeShadowNodeReferenceUpdateOnLayout?: () => boolean; - +useStateAlignmentMechanism?: () => boolean; +useTurboModuleInterop?: () => boolean; +useTurboModules?: () => boolean; }