From 4806077457984a787735b59c2bca84340719627b Mon Sep 17 00:00:00 2001 From: Nick Lefever Date: Mon, 3 Jun 2024 20:25:46 -0700 Subject: [PATCH] Add feature flag for clone reference updates only on layout (#44771) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44771 Changelog: [Internal] Adding a feature flag for enabling runtime shadow node reference updates only for clones happening within `YogaLayoutableShadowNode` to support layout data changes. Reviewed By: sammy-SC Differential Revision: D58000072 fbshipit-source-id: 204c0488edb992511a4b33d098b9df1b04001b9d --- .../featureflags/ReactNativeFeatureFlags.kt | 8 ++++++- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +++++++++- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +++- .../ReactNativeFeatureFlagsDefaults.kt | 4 +++- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 ++++++++++- .../ReactNativeFeatureFlagsProvider.kt | 4 +++- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +++++++++++++- .../JReactNativeFeatureFlagsCxxInterop.h | 5 ++++- .../featureflags/ReactNativeFeatureFlags.cpp | 6 ++++- .../featureflags/ReactNativeFeatureFlags.h | 7 +++++- .../ReactNativeFeatureFlagsAccessor.cpp | 22 +++++++++++++++++-- .../ReactNativeFeatureFlagsAccessor.h | 6 +++-- .../ReactNativeFeatureFlagsDefaults.h | 6 ++++- .../ReactNativeFeatureFlagsProvider.h | 3 ++- .../NativeReactNativeFeatureFlags.cpp | 7 +++++- .../NativeReactNativeFeatureFlags.h | 4 +++- .../ReactNativeFeatureFlags.config.js | 5 +++++ .../featureflags/ReactNativeFeatureFlags.js | 7 +++++- .../specs/NativeReactNativeFeatureFlags.js | 3 ++- 19 files changed, 122 insertions(+), 20 deletions(-) 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 0d621fa7563..aac75718daf 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<<987e450aa9db1b9da0e2a5a63deae4fe>> + * @generated SignedSource<> */ /** @@ -154,6 +154,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun useRuntimeShadowNodeReferenceUpdate(): Boolean = accessor.useRuntimeShadowNodeReferenceUpdate() + /** + * When enabled, cloning shadow nodes during layout will update the reference held by the current JS fiber tree. + */ + @JvmStatic + public fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean = accessor.useRuntimeShadowNodeReferenceUpdateOnLayout() + /** * When enabled, it uses optimised state reconciliation algorithm. */ 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 d3b0d6f642c..5292ebefde7 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<<1a6f57f6bc5b8efd35d6846c71166126>> + * @generated SignedSource<<546c981f0b56bb022ad4e96e6a6ddb17>> */ /** @@ -41,6 +41,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso private var useModernRuntimeSchedulerCache: Boolean? = null private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null private var useRuntimeShadowNodeReferenceUpdateCache: Boolean? = null + private var useRuntimeShadowNodeReferenceUpdateOnLayoutCache: Boolean? = null private var useStateAlignmentMechanismCache: Boolean? = null override fun commonTestFlag(): Boolean { @@ -232,6 +233,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso return cached } + override fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean { + var cached = useRuntimeShadowNodeReferenceUpdateOnLayoutCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.useRuntimeShadowNodeReferenceUpdateOnLayout() + useRuntimeShadowNodeReferenceUpdateOnLayoutCache = cached + } + return cached + } + override fun useStateAlignmentMechanism(): Boolean { var cached = useStateAlignmentMechanismCache 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 677ad63448d..82c1dd5b9bc 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<<1b8b3b8d140faefe9e5269b27770b235>> + * @generated SignedSource<> */ /** @@ -70,6 +70,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun useRuntimeShadowNodeReferenceUpdate(): Boolean + @DoNotStrip @JvmStatic public external fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean + @DoNotStrip @JvmStatic public external fun useStateAlignmentMechanism(): Boolean @DoNotStrip @JvmStatic public external fun override(provider: Any) 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 ebaaa298baf..c3c01abccb8 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<<656d5e2feea3ec122516b75eaacc3323>> + * @generated SignedSource<<8cb9343bf5aa9a7ec1940720ce253c5b>> */ /** @@ -65,5 +65,7 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun useRuntimeShadowNodeReferenceUpdate(): Boolean = false + override fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean = false + override fun useStateAlignmentMechanism(): 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 2378a3569a4..702a8ebc948 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<<206771bdb2b95a893dd6a0dcba5dc48a>> + * @generated SignedSource<<3b6ad9b32518e319bb7d11da4eaa262c>> */ /** @@ -45,6 +45,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces private var useModernRuntimeSchedulerCache: Boolean? = null private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null private var useRuntimeShadowNodeReferenceUpdateCache: Boolean? = null + private var useRuntimeShadowNodeReferenceUpdateOnLayoutCache: Boolean? = null private var useStateAlignmentMechanismCache: Boolean? = null override fun commonTestFlag(): Boolean { @@ -257,6 +258,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean { + var cached = useRuntimeShadowNodeReferenceUpdateOnLayoutCache + if (cached == null) { + cached = currentProvider.useRuntimeShadowNodeReferenceUpdateOnLayout() + accessedFeatureFlags.add("useRuntimeShadowNodeReferenceUpdateOnLayout") + useRuntimeShadowNodeReferenceUpdateOnLayoutCache = cached + } + return cached + } + override fun useStateAlignmentMechanism(): Boolean { var cached = useStateAlignmentMechanismCache 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 e106df658ef..09b2170629f 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<> + * @generated SignedSource<> */ /** @@ -65,5 +65,7 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun useRuntimeShadowNodeReferenceUpdate(): Boolean + @DoNotStrip public fun useRuntimeShadowNodeReferenceUpdateOnLayout(): Boolean + @DoNotStrip public fun useStateAlignmentMechanism(): 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 30d4d6277a5..1cddc94e2d5 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<> + * @generated SignedSource<<43b256d5f58743df52f579dc69721083>> */ /** @@ -165,6 +165,12 @@ class ReactNativeFeatureFlagsProviderHolder return method(javaProvider_); } + bool useRuntimeShadowNodeReferenceUpdateOnLayout() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("useRuntimeShadowNodeReferenceUpdateOnLayout"); + return method(javaProvider_); + } + bool useStateAlignmentMechanism() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("useStateAlignmentMechanism"); @@ -280,6 +286,11 @@ bool JReactNativeFeatureFlagsCxxInterop::useRuntimeShadowNodeReferenceUpdate( return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdate(); } +bool JReactNativeFeatureFlagsCxxInterop::useRuntimeShadowNodeReferenceUpdateOnLayout( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout(); +} + bool JReactNativeFeatureFlagsCxxInterop::useStateAlignmentMechanism( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::useStateAlignmentMechanism(); @@ -365,6 +376,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "useRuntimeShadowNodeReferenceUpdate", JReactNativeFeatureFlagsCxxInterop::useRuntimeShadowNodeReferenceUpdate), + makeNativeMethod( + "useRuntimeShadowNodeReferenceUpdateOnLayout", + JReactNativeFeatureFlagsCxxInterop::useRuntimeShadowNodeReferenceUpdateOnLayout), makeNativeMethod( "useStateAlignmentMechanism", JReactNativeFeatureFlagsCxxInterop::useStateAlignmentMechanism), 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 1ca17c74405..0fc1b7eeaab 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<> + * @generated SignedSource<<19fe3642ec462c23d361e0f036da887a>> */ /** @@ -93,6 +93,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool useRuntimeShadowNodeReferenceUpdate( facebook::jni::alias_ref); + static bool useRuntimeShadowNodeReferenceUpdateOnLayout( + facebook::jni::alias_ref); + static bool useStateAlignmentMechanism( 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 e030eca18cd..220b7c9413f 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<<5366e268a53215419a7271cd7fac76c9>> + * @generated SignedSource<> */ /** @@ -105,6 +105,10 @@ bool ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdate() { return getAccessor().useRuntimeShadowNodeReferenceUpdate(); } +bool ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout() { + return getAccessor().useRuntimeShadowNodeReferenceUpdateOnLayout(); +} + bool ReactNativeFeatureFlags::useStateAlignmentMechanism() { return getAccessor().useStateAlignmentMechanism(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 26b6e7e6dc5..b73431522d9 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<<977b87c9478cea28cbb1aff61eef1fa4>> + * @generated SignedSource<> */ /** @@ -142,6 +142,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool useRuntimeShadowNodeReferenceUpdate(); + /** + * When enabled, cloning shadow nodes during layout will update the reference held by the current JS fiber tree. + */ + RN_EXPORT static bool useRuntimeShadowNodeReferenceUpdateOnLayout(); + /** * When enabled, it uses optimised state reconciliation algorithm. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index fbff9eab217..b7c574d3c51 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<<5f27dd10824706ea065dc0340d46c409>> */ /** @@ -407,6 +407,24 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdateOnLayout() { + auto flagValue = useRuntimeShadowNodeReferenceUpdateOnLayout_.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(21, "useRuntimeShadowNodeReferenceUpdateOnLayout"); + + flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdateOnLayout(); + useRuntimeShadowNodeReferenceUpdateOnLayout_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::useStateAlignmentMechanism() { auto flagValue = useStateAlignmentMechanism_.load(); @@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::useStateAlignmentMechanism() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(21, "useStateAlignmentMechanism"); + markFlagAsAccessed(22, "useStateAlignmentMechanism"); flagValue = currentProvider_->useStateAlignmentMechanism(); useStateAlignmentMechanism_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index ce16405bcd0..e67bfd3bfa1 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<<7de49cd344ee15e49e2a1cf5e78e0139>> + * @generated SignedSource<<8837dd1578561f205e6f682afd98c450>> */ /** @@ -52,6 +52,7 @@ class ReactNativeFeatureFlagsAccessor { bool useModernRuntimeScheduler(); bool useNativeViewConfigsInBridgelessMode(); bool useRuntimeShadowNodeReferenceUpdate(); + bool useRuntimeShadowNodeReferenceUpdateOnLayout(); bool useStateAlignmentMechanism(); void override(std::unique_ptr provider); @@ -63,7 +64,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 22> accessedFeatureFlags_; + std::array, 23> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> allowCollapsableChildren_; @@ -86,6 +87,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> useModernRuntimeScheduler_; std::atomic> useNativeViewConfigsInBridgelessMode_; std::atomic> useRuntimeShadowNodeReferenceUpdate_; + std::atomic> useRuntimeShadowNodeReferenceUpdateOnLayout_; std::atomic> useStateAlignmentMechanism_; }; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 5b89126af4b..171c8cd8a5f 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<<2466d6097301e3fa9d022cc8425c7b1c>> + * @generated SignedSource<<2a0324c7b8009e906b18db11c5d2beb9>> */ /** @@ -111,6 +111,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } + bool useRuntimeShadowNodeReferenceUpdateOnLayout() override { + return false; + } + bool useStateAlignmentMechanism() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 43c557e92bf..522fc6ae570 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<<6a05970506e696333c7480f6cf094642>> + * @generated SignedSource<<7cd3889fcccc029925651f7ef406ff40>> */ /** @@ -46,6 +46,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool useModernRuntimeScheduler() = 0; virtual bool useNativeViewConfigsInBridgelessMode() = 0; virtual bool useRuntimeShadowNodeReferenceUpdate() = 0; + virtual bool useRuntimeShadowNodeReferenceUpdateOnLayout() = 0; virtual bool useStateAlignmentMechanism() = 0; }; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index b5476a9cc95..158cadd740f 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<> + * @generated SignedSource<<914fa03d71af61b82f05f005d3f3973d>> */ /** @@ -142,6 +142,11 @@ bool NativeReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdate( return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdate(); } +bool NativeReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout(); +} + bool NativeReactNativeFeatureFlags::useStateAlignmentMechanism( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::useStateAlignmentMechanism(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index bc0785fdfd0..3b12e4f8e16 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<> + * @generated SignedSource<<1458397650db55d5a985685fa4998e41>> */ /** @@ -77,6 +77,8 @@ class NativeReactNativeFeatureFlags bool useRuntimeShadowNodeReferenceUpdate(jsi::Runtime& runtime); + bool useRuntimeShadowNodeReferenceUpdateOnLayout(jsi::Runtime& runtime); + bool useStateAlignmentMechanism(jsi::Runtime& runtime); }; diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index b5db07593e7..45df9f5eea4 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -137,6 +137,11 @@ const definitions: FeatureFlagDefinitions = { description: 'When enabled, cloning shadow nodes within react native will update the reference held by the current JS fiber tree.', }, + useRuntimeShadowNodeReferenceUpdateOnLayout: { + defaultValue: false, + description: + 'When enabled, cloning shadow nodes during layout will update the reference held by the current JS fiber tree.', + }, useStateAlignmentMechanism: { defaultValue: false, description: diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 916e1cd99bd..ba219228c1f 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<<98d5ac48b23f6422020b49ed5d8732d0>> + * @generated SignedSource<> * @flow strict-local */ @@ -61,6 +61,7 @@ export type ReactNativeFeatureFlags = { useModernRuntimeScheduler: Getter, useNativeViewConfigsInBridgelessMode: Getter, useRuntimeShadowNodeReferenceUpdate: Getter, + useRuntimeShadowNodeReferenceUpdateOnLayout: Getter, useStateAlignmentMechanism: Getter, } @@ -188,6 +189,10 @@ export const useNativeViewConfigsInBridgelessMode: Getter = createNativ * When enabled, cloning shadow nodes within react native will update the reference held by the current JS fiber tree. */ export const useRuntimeShadowNodeReferenceUpdate: Getter = createNativeFlagGetter('useRuntimeShadowNodeReferenceUpdate', false); +/** + * 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. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 88e19c6164a..3fe725e3e1f 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<> + * @generated SignedSource<<4a30969e69164b149af42698f94c3b28>> * @flow strict-local */ @@ -44,6 +44,7 @@ export interface Spec extends TurboModule { +useModernRuntimeScheduler?: () => boolean; +useNativeViewConfigsInBridgelessMode?: () => boolean; +useRuntimeShadowNodeReferenceUpdate?: () => boolean; + +useRuntimeShadowNodeReferenceUpdateOnLayout?: () => boolean; +useStateAlignmentMechanism?: () => boolean; }