From f71e48d4c1111edaf0fc3e44818cccef215b951c Mon Sep 17 00:00:00 2001 From: James Ide Date: Fri, 4 Dec 2026 01:47:58 -0800 Subject: [PATCH] Emit Fabric subtree mount and unmount mutations directly The Fabric Differentiator writes mount and unmount mutations for whole subtrees directly into the destination list when `enableDirectSubtreeMutations` is enabled. The flag defaults to off. Direct emission avoids allocating and merging a temporary mutation list at each level of the subtree. `ctest --test-dir private/react-native-fantom/build/tester/react-common-tests --output-on-failure -j 10` passes with the flag default off and in a local build with the default on. The regression test runs in both modes. It mounts and unmounts a subtree in which one view forms a stacking context, one view is flattened away, and one view stays in the mounted tree while its children mount in its parent. It compares the results with independently built trees. `yarn fantom packages/react-native/src/private/renderer/mounting/__tests__` passes with the default and with both values of the flag selected by a local `@fantom_flags enableDirectSubtreeMutations:*` override. A single Release C++ binary on Apple M6 uses `proc_pid_rusage` to count retired instructions for diffs of a 341-view tree with four children per parent. For each operation, both flag settings emit the same ordered list of 682 mutations. Across five batches of 1,000 diffs per setting with alternating flag order, the median per mount diff falls from 1,527,412 to 458,622 and the median per unmount diff from 1,526,089 to 457,443. `node scripts/clang-format.js --check`, `yarn flow-check` and `yarn lint` pass, and `yarn featureflags --update` reproduces the generated bindings. Signed-off-by: James Ide --- .../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 | 186 ++++++++++-------- .../ReactNativeFeatureFlagsAccessor.h | 6 +- .../ReactNativeFeatureFlagsDefaults.h | 6 +- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 +- .../NativeReactNativeFeatureFlags.h | 4 +- .../renderer/mounting/Differentiator.cpp | 122 ++++++++++++ .../tests/DifferentiatorUnflattenTest.cpp | 80 ++++++++ .../ReactNativeFeatureFlags.config.js | 11 ++ .../featureflags/ReactNativeFeatureFlags.js | 7 +- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 22 files changed, 422 insertions(+), 103 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 e7e5c56cae6a..9b79d853a787 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<<3c2494d2482efe3dded741dd746d4309>> + * @generated SignedSource<<4578c7d2f792075407fe60bd626e101f>> */ /** @@ -144,6 +144,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableDestroyShadowTreeRevisionAsync(): Boolean = accessor.enableDestroyShadowTreeRevisionAsync() + /** + * Emits Fabric mount and unmount mutations for whole subtrees directly into the output list. + */ + @JvmStatic + public fun enableDirectSubtreeMutations(): Boolean = accessor.enableDirectSubtreeMutations() + /** * When enabled a subset of components will avoid double measurement on Android. */ 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 8e2279ee89db..bbda40856a65 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<<14682373d73e29327ec3c39882e59af5>> + * @generated SignedSource<<8ff7234e7a77c463c9f2f6109dbf9385>> */ /** @@ -39,6 +39,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var enableCppPropsIteratorSetterCache: Boolean? = null private var enableCustomFocusSearchOnClippedElementsAndroidCache: Boolean? = null private var enableDestroyShadowTreeRevisionAsyncCache: Boolean? = null + private var enableDirectSubtreeMutationsCache: Boolean? = null private var enableDoubleMeasurementFixAndroidCache: Boolean? = null private var enableEagerRootViewAttachmentCache: Boolean? = null private var enableExclusivePropsUpdateAndroidCache: Boolean? = null @@ -294,6 +295,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun enableDirectSubtreeMutations(): Boolean { + var cached = enableDirectSubtreeMutationsCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.enableDirectSubtreeMutations() + enableDirectSubtreeMutationsCache = cached + } + return cached + } + override fun enableDoubleMeasurementFixAndroid(): Boolean { var cached = enableDoubleMeasurementFixAndroidCache 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 e0845de7ca7f..d2570077226e 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<> + * @generated SignedSource<<4fd19a0db046e1ef94007755322f4102>> */ /** @@ -66,6 +66,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableDestroyShadowTreeRevisionAsync(): Boolean + @DoNotStrip @JvmStatic public external fun enableDirectSubtreeMutations(): Boolean + @DoNotStrip @JvmStatic public external fun enableDoubleMeasurementFixAndroid(): Boolean @DoNotStrip @JvmStatic public external fun enableEagerRootViewAttachment(): 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 0a9a0d6c6c38..ede8c3b753a5 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<> + * @generated SignedSource<<0fa0c2cc9ef697652bd2ba0518ed61c4>> */ /** @@ -61,6 +61,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableDestroyShadowTreeRevisionAsync(): Boolean = false + override fun enableDirectSubtreeMutations(): Boolean = false + override fun enableDoubleMeasurementFixAndroid(): Boolean = false override fun enableEagerRootViewAttachment(): 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 ac0ca1339195..35f148586c0c 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<> + * @generated SignedSource<> */ /** @@ -43,6 +43,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var enableCppPropsIteratorSetterCache: Boolean? = null private var enableCustomFocusSearchOnClippedElementsAndroidCache: Boolean? = null private var enableDestroyShadowTreeRevisionAsyncCache: Boolean? = null + private var enableDirectSubtreeMutationsCache: Boolean? = null private var enableDoubleMeasurementFixAndroidCache: Boolean? = null private var enableEagerRootViewAttachmentCache: Boolean? = null private var enableExclusivePropsUpdateAndroidCache: Boolean? = null @@ -317,6 +318,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } + override fun enableDirectSubtreeMutations(): Boolean { + var cached = enableDirectSubtreeMutationsCache + if (cached == null) { + cached = currentProvider.enableDirectSubtreeMutations() + accessedFeatureFlags.add("enableDirectSubtreeMutations") + enableDirectSubtreeMutationsCache = cached + } + return cached + } + override fun enableDoubleMeasurementFixAndroid(): Boolean { var cached = enableDoubleMeasurementFixAndroidCache 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 daad224eaa7a..aed95fe98194 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<<963ee5c8e0c9e5112c1dfaf643d10c2e>> */ /** @@ -61,6 +61,8 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableDestroyShadowTreeRevisionAsync(): Boolean + @DoNotStrip public fun enableDirectSubtreeMutations(): Boolean + @DoNotStrip public fun enableDoubleMeasurementFixAndroid(): Boolean @DoNotStrip public fun enableEagerRootViewAttachment(): 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 5a3ad88020ac..d5abd56e012c 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<> */ /** @@ -153,6 +153,12 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } + bool enableDirectSubtreeMutations() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableDirectSubtreeMutations"); + return method(javaProvider_); + } + bool enableDoubleMeasurementFixAndroid() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableDoubleMeasurementFixAndroid"); @@ -750,6 +756,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableDestroyShadowTreeRevisionAsync( return ReactNativeFeatureFlags::enableDestroyShadowTreeRevisionAsync(); } +bool JReactNativeFeatureFlagsCxxInterop::enableDirectSubtreeMutations( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::enableDirectSubtreeMutations(); +} + bool JReactNativeFeatureFlagsCxxInterop::enableDoubleMeasurementFixAndroid( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::enableDoubleMeasurementFixAndroid(); @@ -1253,6 +1264,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableDestroyShadowTreeRevisionAsync", JReactNativeFeatureFlagsCxxInterop::enableDestroyShadowTreeRevisionAsync), + makeNativeMethod( + "enableDirectSubtreeMutations", + JReactNativeFeatureFlagsCxxInterop::enableDirectSubtreeMutations), makeNativeMethod( "enableDoubleMeasurementFixAndroid", JReactNativeFeatureFlagsCxxInterop::enableDoubleMeasurementFixAndroid), 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 9fb787e56443..51b86ea84566 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<<61b3685bb0e41ac62de7cef4927b577c>> + * @generated SignedSource<<73be3bedd01f8b65b3bb156e2682e90f>> */ /** @@ -87,6 +87,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableDestroyShadowTreeRevisionAsync( facebook::jni::alias_ref); + static bool enableDirectSubtreeMutations( + facebook::jni::alias_ref); + static bool enableDoubleMeasurementFixAndroid( 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 b947a4aa1770..91104044acb6 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<<81cd9f64e05f8e5d59eb79c0ecfeda86>> + * @generated SignedSource<<2bdb3b4296a88a176f0c3a1a0d07df23>> */ /** @@ -102,6 +102,10 @@ bool ReactNativeFeatureFlags::enableDestroyShadowTreeRevisionAsync() { return getAccessor().enableDestroyShadowTreeRevisionAsync(); } +bool ReactNativeFeatureFlags::enableDirectSubtreeMutations() { + return getAccessor().enableDirectSubtreeMutations(); +} + bool ReactNativeFeatureFlags::enableDoubleMeasurementFixAndroid() { return getAccessor().enableDoubleMeasurementFixAndroid(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 0e2f3f6949c2..d143f2c08eec 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<<8dca25c44632b8b14c5cdac75a3f36f8>> + * @generated SignedSource<> */ /** @@ -136,6 +136,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableDestroyShadowTreeRevisionAsync(); + /** + * Emits Fabric mount and unmount mutations for whole subtrees directly into the output list. + */ + RN_EXPORT static bool enableDirectSubtreeMutations(); + /** * When enabled a subset of components will avoid double measurement on Android. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 7e23ac64cfbc..80f2b60b87b4 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<<37e16ca8358e1b9639551d31ecea5372>> + * @generated SignedSource<<47c3b7f620a95f2082759df1deb88265>> */ /** @@ -371,6 +371,24 @@ bool ReactNativeFeatureFlagsAccessor::enableDestroyShadowTreeRevisionAsync() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::enableDirectSubtreeMutations() { + auto flagValue = enableDirectSubtreeMutations_.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(19, "enableDirectSubtreeMutations"); + + flagValue = currentProvider_->enableDirectSubtreeMutations(); + enableDirectSubtreeMutations_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::enableDoubleMeasurementFixAndroid() { auto flagValue = enableDoubleMeasurementFixAndroid_.load(); @@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::enableDoubleMeasurementFixAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(19, "enableDoubleMeasurementFixAndroid"); + markFlagAsAccessed(20, "enableDoubleMeasurementFixAndroid"); flagValue = currentProvider_->enableDoubleMeasurementFixAndroid(); enableDoubleMeasurementFixAndroid_ = flagValue; @@ -398,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::enableEagerRootViewAttachment() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(20, "enableEagerRootViewAttachment"); + markFlagAsAccessed(21, "enableEagerRootViewAttachment"); flagValue = currentProvider_->enableEagerRootViewAttachment(); enableEagerRootViewAttachment_ = flagValue; @@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::enableExclusivePropsUpdateAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(21, "enableExclusivePropsUpdateAndroid"); + markFlagAsAccessed(22, "enableExclusivePropsUpdateAndroid"); flagValue = currentProvider_->enableExclusivePropsUpdateAndroid(); enableExclusivePropsUpdateAndroid_ = flagValue; @@ -434,7 +452,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricCommitBranching() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(22, "enableFabricCommitBranching"); + markFlagAsAccessed(23, "enableFabricCommitBranching"); flagValue = currentProvider_->enableFabricCommitBranching(); enableFabricCommitBranching_ = flagValue; @@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricCommitBranchingMergeOnMainThre // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(23, "enableFabricCommitBranchingMergeOnMainThread"); + markFlagAsAccessed(24, "enableFabricCommitBranchingMergeOnMainThread"); flagValue = currentProvider_->enableFabricCommitBranchingMergeOnMainThread(); enableFabricCommitBranchingMergeOnMainThread_ = flagValue; @@ -470,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricLogs() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(24, "enableFabricLogs"); + markFlagAsAccessed(25, "enableFabricLogs"); flagValue = currentProvider_->enableFabricLogs(); enableFabricLogs_ = flagValue; @@ -488,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFlexboxAutoMinSizeInStrictMode() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(25, "enableFlexboxAutoMinSizeInStrictMode"); + markFlagAsAccessed(26, "enableFlexboxAutoMinSizeInStrictMode"); flagValue = currentProvider_->enableFlexboxAutoMinSizeInStrictMode(); enableFlexboxAutoMinSizeInStrictMode_ = flagValue; @@ -506,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFlushSync() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(26, "enableFlushSync"); + markFlagAsAccessed(27, "enableFlushSync"); flagValue = currentProvider_->enableFlushSync(); enableFlushSync_ = flagValue; @@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFollowUpMountItemDispatchAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(27, "enableFollowUpMountItemDispatchAndroid"); + markFlagAsAccessed(28, "enableFollowUpMountItemDispatchAndroid"); flagValue = currentProvider_->enableFollowUpMountItemDispatchAndroid(); enableFollowUpMountItemDispatchAndroid_ = flagValue; @@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSCompressedTextFrameAdjustment() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(28, "enableIOSCompressedTextFrameAdjustment"); + markFlagAsAccessed(29, "enableIOSCompressedTextFrameAdjustment"); flagValue = currentProvider_->enableIOSCompressedTextFrameAdjustment(); enableIOSCompressedTextFrameAdjustment_ = flagValue; @@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSTextBaselineOffsetPerLine() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(29, "enableIOSTextBaselineOffsetPerLine"); + markFlagAsAccessed(30, "enableIOSTextBaselineOffsetPerLine"); flagValue = currentProvider_->enableIOSTextBaselineOffsetPerLine(); enableIOSTextBaselineOffsetPerLine_ = flagValue; @@ -578,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSViewClipToPaddingBox() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(30, "enableIOSViewClipToPaddingBox"); + markFlagAsAccessed(31, "enableIOSViewClipToPaddingBox"); flagValue = currentProvider_->enableIOSViewClipToPaddingBox(); enableIOSViewClipToPaddingBox_ = flagValue; @@ -596,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImagePrefetchingAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(31, "enableImagePrefetchingAndroid"); + markFlagAsAccessed(32, "enableImagePrefetchingAndroid"); flagValue = currentProvider_->enableImagePrefetchingAndroid(); enableImagePrefetchingAndroid_ = flagValue; @@ -614,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImageTransparentTintColor() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(32, "enableImageTransparentTintColor"); + markFlagAsAccessed(33, "enableImageTransparentTintColor"); flagValue = currentProvider_->enableImageTransparentTintColor(); enableImageTransparentTintColor_ = flagValue; @@ -632,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImmediateUpdateModeForContentOffsetC // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(33, "enableImmediateUpdateModeForContentOffsetChanges"); + markFlagAsAccessed(34, "enableImmediateUpdateModeForContentOffsetChanges"); flagValue = currentProvider_->enableImmediateUpdateModeForContentOffsetChanges(); enableImmediateUpdateModeForContentOffsetChanges_ = flagValue; @@ -650,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImmediateUpdateModeForScrollContentV // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(34, "enableImmediateUpdateModeForScrollContentView"); + markFlagAsAccessed(35, "enableImmediateUpdateModeForScrollContentView"); flagValue = currentProvider_->enableImmediateUpdateModeForScrollContentView(); enableImmediateUpdateModeForScrollContentView_ = flagValue; @@ -668,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImperativeEvents() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(35, "enableImperativeEvents"); + markFlagAsAccessed(36, "enableImperativeEvents"); flagValue = currentProvider_->enableImperativeEvents(); enableImperativeEvents_ = flagValue; @@ -686,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImperativeFocus() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(36, "enableImperativeFocus"); + markFlagAsAccessed(37, "enableImperativeFocus"); flagValue = currentProvider_->enableImperativeFocus(); enableImperativeFocus_ = flagValue; @@ -704,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::enableInteractableResponderViews() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(37, "enableInteractableResponderViews"); + markFlagAsAccessed(38, "enableInteractableResponderViews"); flagValue = currentProvider_->enableInteractableResponderViews(); enableInteractableResponderViews_ = flagValue; @@ -722,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::enableInteractiveInlineButtons() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(38, "enableInteractiveInlineButtons"); + markFlagAsAccessed(39, "enableInteractiveInlineButtons"); flagValue = currentProvider_->enableInteractiveInlineButtons(); enableInteractiveInlineButtons_ = flagValue; @@ -740,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::enableInteropViewManagerClassLookUpOptimiz // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(39, "enableInteropViewManagerClassLookUpOptimizationIOS"); + markFlagAsAccessed(40, "enableInteropViewManagerClassLookUpOptimizationIOS"); flagValue = currentProvider_->enableInteropViewManagerClassLookUpOptimizationIOS(); enableInteropViewManagerClassLookUpOptimizationIOS_ = flagValue; @@ -758,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIntersectionObserverByDefault() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(40, "enableIntersectionObserverByDefault"); + markFlagAsAccessed(41, "enableIntersectionObserverByDefault"); flagValue = currentProvider_->enableIntersectionObserverByDefault(); enableIntersectionObserverByDefault_ = flagValue; @@ -776,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::enableKeyEvents() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(41, "enableKeyEvents"); + markFlagAsAccessed(42, "enableKeyEvents"); flagValue = currentProvider_->enableKeyEvents(); enableKeyEvents_ = flagValue; @@ -794,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(42, "enableLayoutAnimationsOnAndroid"); + markFlagAsAccessed(43, "enableLayoutAnimationsOnAndroid"); flagValue = currentProvider_->enableLayoutAnimationsOnAndroid(); enableLayoutAnimationsOnAndroid_ = flagValue; @@ -812,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnIOS() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(43, "enableLayoutAnimationsOnIOS"); + markFlagAsAccessed(44, "enableLayoutAnimationsOnIOS"); flagValue = currentProvider_->enableLayoutAnimationsOnIOS(); enableLayoutAnimationsOnIOS_ = flagValue; @@ -830,7 +848,7 @@ bool ReactNativeFeatureFlagsAccessor::enableModuleArgumentNSNullConversionIOS() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(44, "enableModuleArgumentNSNullConversionIOS"); + markFlagAsAccessed(45, "enableModuleArgumentNSNullConversionIOS"); flagValue = currentProvider_->enableModuleArgumentNSNullConversionIOS(); enableModuleArgumentNSNullConversionIOS_ = flagValue; @@ -848,7 +866,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMountingCoordinatorPullModelAndroid( // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(45, "enableMountingCoordinatorPullModelAndroid"); + markFlagAsAccessed(46, "enableMountingCoordinatorPullModelAndroid"); flagValue = currentProvider_->enableMountingCoordinatorPullModelAndroid(); enableMountingCoordinatorPullModelAndroid_ = flagValue; @@ -866,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMutationObserverByDefault() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(46, "enableMutationObserverByDefault"); + markFlagAsAccessed(47, "enableMutationObserverByDefault"); flagValue = currentProvider_->enableMutationObserverByDefault(); enableMutationObserverByDefault_ = flagValue; @@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::enableNativeCSSParsing() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(47, "enableNativeCSSParsing"); + markFlagAsAccessed(48, "enableNativeCSSParsing"); flagValue = currentProvider_->enableNativeCSSParsing(); enableNativeCSSParsing_ = flagValue; @@ -902,7 +920,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePreallocatedPropsDiffOnInsertAndroid // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(48, "enablePreallocatedPropsDiffOnInsertAndroid"); + markFlagAsAccessed(49, "enablePreallocatedPropsDiffOnInsertAndroid"); flagValue = currentProvider_->enablePreallocatedPropsDiffOnInsertAndroid(); enablePreallocatedPropsDiffOnInsertAndroid_ = flagValue; @@ -920,7 +938,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePreparedTextLayout() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(49, "enablePreparedTextLayout"); + markFlagAsAccessed(50, "enablePreparedTextLayout"); flagValue = currentProvider_->enablePreparedTextLayout(); enablePreparedTextLayout_ = flagValue; @@ -938,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePropsUpdateReconciliationAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(50, "enablePropsUpdateReconciliationAndroid"); + markFlagAsAccessed(51, "enablePropsUpdateReconciliationAndroid"); flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid(); enablePropsUpdateReconciliationAndroid_ = flagValue; @@ -956,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::enableResizeObserverByDefault() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(51, "enableResizeObserverByDefault"); + markFlagAsAccessed(52, "enableResizeObserverByDefault"); flagValue = currentProvider_->enableResizeObserverByDefault(); enableResizeObserverByDefault_ = flagValue; @@ -974,7 +992,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSwiftUIBasedFilters() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(52, "enableSwiftUIBasedFilters"); + markFlagAsAccessed(53, "enableSwiftUIBasedFilters"); flagValue = currentProvider_->enableSwiftUIBasedFilters(); enableSwiftUIBasedFilters_ = flagValue; @@ -992,7 +1010,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewCulling() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(53, "enableViewCulling"); + markFlagAsAccessed(54, "enableViewCulling"); flagValue = currentProvider_->enableViewCulling(); enableViewCulling_ = flagValue; @@ -1010,7 +1028,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecycling() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(54, "enableViewRecycling"); + markFlagAsAccessed(55, "enableViewRecycling"); flagValue = currentProvider_->enableViewRecycling(); enableViewRecycling_ = flagValue; @@ -1028,7 +1046,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForImage() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(55, "enableViewRecyclingForImage"); + markFlagAsAccessed(56, "enableViewRecyclingForImage"); flagValue = currentProvider_->enableViewRecyclingForImage(); enableViewRecyclingForImage_ = flagValue; @@ -1046,7 +1064,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForScrollView() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(56, "enableViewRecyclingForScrollView"); + markFlagAsAccessed(57, "enableViewRecyclingForScrollView"); flagValue = currentProvider_->enableViewRecyclingForScrollView(); enableViewRecyclingForScrollView_ = flagValue; @@ -1064,7 +1082,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForText() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(57, "enableViewRecyclingForText"); + markFlagAsAccessed(58, "enableViewRecyclingForText"); flagValue = currentProvider_->enableViewRecyclingForText(); enableViewRecyclingForText_ = flagValue; @@ -1082,7 +1100,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForView() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(58, "enableViewRecyclingForView"); + markFlagAsAccessed(59, "enableViewRecyclingForView"); flagValue = currentProvider_->enableViewRecyclingForView(); enableViewRecyclingForView_ = flagValue; @@ -1100,7 +1118,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewContainerStateExperimenta // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(59, "enableVirtualViewContainerStateExperimental"); + markFlagAsAccessed(60, "enableVirtualViewContainerStateExperimental"); flagValue = currentProvider_->enableVirtualViewContainerStateExperimental(); enableVirtualViewContainerStateExperimental_ = flagValue; @@ -1118,7 +1136,7 @@ bool ReactNativeFeatureFlagsAccessor::fixBorderlessRippleAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(60, "fixBorderlessRippleAndroid"); + markFlagAsAccessed(61, "fixBorderlessRippleAndroid"); flagValue = currentProvider_->fixBorderlessRippleAndroid(); fixBorderlessRippleAndroid_ = flagValue; @@ -1136,7 +1154,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(61, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(62, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -1154,7 +1172,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMultilineContentJumpAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(62, "fixMultilineContentJumpAndroid"); + markFlagAsAccessed(63, "fixMultilineContentJumpAndroid"); flagValue = currentProvider_->fixMultilineContentJumpAndroid(); fixMultilineContentJumpAndroid_ = flagValue; @@ -1172,7 +1190,7 @@ bool ReactNativeFeatureFlagsAccessor::fixProgrammaticScrollMomentumEventsIOS() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(63, "fixProgrammaticScrollMomentumEventsIOS"); + markFlagAsAccessed(64, "fixProgrammaticScrollMomentumEventsIOS"); flagValue = currentProvider_->fixProgrammaticScrollMomentumEventsIOS(); fixProgrammaticScrollMomentumEventsIOS_ = flagValue; @@ -1190,7 +1208,7 @@ bool ReactNativeFeatureFlagsAccessor::fixTextInlineViewLineHeight() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(64, "fixTextInlineViewLineHeight"); + markFlagAsAccessed(65, "fixTextInlineViewLineHeight"); flagValue = currentProvider_->fixTextInlineViewLineHeight(); fixTextInlineViewLineHeight_ = flagValue; @@ -1208,7 +1226,7 @@ bool ReactNativeFeatureFlagsAccessor::fixTextLayoutOnPixelDensityChange() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(65, "fixTextLayoutOnPixelDensityChange"); + markFlagAsAccessed(66, "fixTextLayoutOnPixelDensityChange"); flagValue = currentProvider_->fixTextLayoutOnPixelDensityChange(); fixTextLayoutOnPixelDensityChange_ = flagValue; @@ -1226,7 +1244,7 @@ bool ReactNativeFeatureFlagsAccessor::fixYogaFlexBasisFitContentInMainAxis() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(66, "fixYogaFlexBasisFitContentInMainAxis"); + markFlagAsAccessed(67, "fixYogaFlexBasisFitContentInMainAxis"); flagValue = currentProvider_->fixYogaFlexBasisFitContentInMainAxis(); fixYogaFlexBasisFitContentInMainAxis_ = flagValue; @@ -1244,7 +1262,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxAssertSingleHostState() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(67, "fuseboxAssertSingleHostState"); + markFlagAsAccessed(68, "fuseboxAssertSingleHostState"); flagValue = currentProvider_->fuseboxAssertSingleHostState(); fuseboxAssertSingleHostState_ = flagValue; @@ -1262,7 +1280,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(68, "fuseboxEnabledRelease"); + markFlagAsAccessed(69, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -1280,7 +1298,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxFrameRecordingEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(69, "fuseboxFrameRecordingEnabled"); + markFlagAsAccessed(70, "fuseboxFrameRecordingEnabled"); flagValue = currentProvider_->fuseboxFrameRecordingEnabled(); fuseboxFrameRecordingEnabled_ = flagValue; @@ -1298,7 +1316,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxScreenshotCaptureEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(70, "fuseboxScreenshotCaptureEnabled"); + markFlagAsAccessed(71, "fuseboxScreenshotCaptureEnabled"); flagValue = currentProvider_->fuseboxScreenshotCaptureEnabled(); fuseboxScreenshotCaptureEnabled_ = flagValue; @@ -1316,7 +1334,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxWebSocketEventsEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(71, "fuseboxWebSocketEventsEnabled"); + markFlagAsAccessed(72, "fuseboxWebSocketEventsEnabled"); flagValue = currentProvider_->fuseboxWebSocketEventsEnabled(); fuseboxWebSocketEventsEnabled_ = flagValue; @@ -1334,7 +1352,7 @@ bool ReactNativeFeatureFlagsAccessor::keepTimersRunningWhileHostPausedAndroid() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(72, "keepTimersRunningWhileHostPausedAndroid"); + markFlagAsAccessed(73, "keepTimersRunningWhileHostPausedAndroid"); flagValue = currentProvider_->keepTimersRunningWhileHostPausedAndroid(); keepTimersRunningWhileHostPausedAndroid_ = flagValue; @@ -1352,7 +1370,7 @@ bool ReactNativeFeatureFlagsAccessor::optimizedAnimatedPropUpdates() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(73, "optimizedAnimatedPropUpdates"); + markFlagAsAccessed(74, "optimizedAnimatedPropUpdates"); flagValue = currentProvider_->optimizedAnimatedPropUpdates(); optimizedAnimatedPropUpdates_ = flagValue; @@ -1370,7 +1388,7 @@ bool ReactNativeFeatureFlagsAccessor::overrideBySynchronousMountPropsAtMountingA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(74, "overrideBySynchronousMountPropsAtMountingAndroid"); + markFlagAsAccessed(75, "overrideBySynchronousMountPropsAtMountingAndroid"); flagValue = currentProvider_->overrideBySynchronousMountPropsAtMountingAndroid(); overrideBySynchronousMountPropsAtMountingAndroid_ = flagValue; @@ -1388,7 +1406,7 @@ bool ReactNativeFeatureFlagsAccessor::perfIssuesEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(75, "perfIssuesEnabled"); + markFlagAsAccessed(76, "perfIssuesEnabled"); flagValue = currentProvider_->perfIssuesEnabled(); perfIssuesEnabled_ = flagValue; @@ -1406,7 +1424,7 @@ bool ReactNativeFeatureFlagsAccessor::perfMonitorV2Enabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(76, "perfMonitorV2Enabled"); + markFlagAsAccessed(77, "perfMonitorV2Enabled"); flagValue = currentProvider_->perfMonitorV2Enabled(); perfMonitorV2Enabled_ = flagValue; @@ -1424,7 +1442,7 @@ double ReactNativeFeatureFlagsAccessor::preparedTextCacheSize() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(77, "preparedTextCacheSize"); + markFlagAsAccessed(78, "preparedTextCacheSize"); flagValue = currentProvider_->preparedTextCacheSize(); preparedTextCacheSize_ = flagValue; @@ -1442,7 +1460,7 @@ bool ReactNativeFeatureFlagsAccessor::preventShadowTreeCommitExhaustion() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(78, "preventShadowTreeCommitExhaustion"); + markFlagAsAccessed(79, "preventShadowTreeCommitExhaustion"); flagValue = currentProvider_->preventShadowTreeCommitExhaustion(); preventShadowTreeCommitExhaustion_ = flagValue; @@ -1460,7 +1478,7 @@ bool ReactNativeFeatureFlagsAccessor::redBoxV2Android() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(79, "redBoxV2Android"); + markFlagAsAccessed(80, "redBoxV2Android"); flagValue = currentProvider_->redBoxV2Android(); redBoxV2Android_ = flagValue; @@ -1478,7 +1496,7 @@ bool ReactNativeFeatureFlagsAccessor::redBoxV2IOS() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(80, "redBoxV2IOS"); + markFlagAsAccessed(81, "redBoxV2IOS"); flagValue = currentProvider_->redBoxV2IOS(); redBoxV2IOS_ = flagValue; @@ -1496,7 +1514,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHo // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(81, "shouldPressibilityUseW3CPointerEventsForHover"); + markFlagAsAccessed(82, "shouldPressibilityUseW3CPointerEventsForHover"); flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover(); shouldPressibilityUseW3CPointerEventsForHover_ = flagValue; @@ -1514,7 +1532,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldTriggerResponderTransferOnScrollAndr // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(82, "shouldTriggerResponderTransferOnScrollAndroid"); + markFlagAsAccessed(83, "shouldTriggerResponderTransferOnScrollAndroid"); flagValue = currentProvider_->shouldTriggerResponderTransferOnScrollAndroid(); shouldTriggerResponderTransferOnScrollAndroid_ = flagValue; @@ -1532,7 +1550,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(83, "skipActivityIdentityAssertionOnHostPause"); + markFlagAsAccessed(84, "skipActivityIdentityAssertionOnHostPause"); flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause(); skipActivityIdentityAssertionOnHostPause_ = flagValue; @@ -1550,7 +1568,7 @@ bool ReactNativeFeatureFlagsAccessor::skipNativePropsForViewManagerWithDelegateA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(84, "skipNativePropsForViewManagerWithDelegateAndroid"); + markFlagAsAccessed(85, "skipNativePropsForViewManagerWithDelegateAndroid"); flagValue = currentProvider_->skipNativePropsForViewManagerWithDelegateAndroid(); skipNativePropsForViewManagerWithDelegateAndroid_ = flagValue; @@ -1568,7 +1586,7 @@ bool ReactNativeFeatureFlagsAccessor::skipUnchangedChildrenInDifferentiator() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(85, "skipUnchangedChildrenInDifferentiator"); + markFlagAsAccessed(86, "skipUnchangedChildrenInDifferentiator"); flagValue = currentProvider_->skipUnchangedChildrenInDifferentiator(); skipUnchangedChildrenInDifferentiator_ = flagValue; @@ -1586,7 +1604,7 @@ bool ReactNativeFeatureFlagsAccessor::syncAndroidClipBoundsWithOverflow() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(86, "syncAndroidClipBoundsWithOverflow"); + markFlagAsAccessed(87, "syncAndroidClipBoundsWithOverflow"); flagValue = currentProvider_->syncAndroidClipBoundsWithOverflow(); syncAndroidClipBoundsWithOverflow_ = flagValue; @@ -1604,7 +1622,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(87, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(88, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -1622,7 +1640,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommit( // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(88, "updateRuntimeShadowNodeReferencesOnCommit"); + markFlagAsAccessed(89, "updateRuntimeShadowNodeReferencesOnCommit"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit(); updateRuntimeShadowNodeReferencesOnCommit_ = flagValue; @@ -1640,7 +1658,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommitT // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(89, "updateRuntimeShadowNodeReferencesOnCommitThread"); + markFlagAsAccessed(90, "updateRuntimeShadowNodeReferencesOnCommitThread"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommitThread(); updateRuntimeShadowNodeReferencesOnCommitThread_ = flagValue; @@ -1658,7 +1676,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(90, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(91, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -1676,7 +1694,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(91, "useFabricInterop"); + markFlagAsAccessed(92, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -1694,7 +1712,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(92, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(93, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -1712,7 +1730,7 @@ bool ReactNativeFeatureFlagsAccessor::useNestedScrollViewAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(93, "useNestedScrollViewAndroid"); + markFlagAsAccessed(94, "useNestedScrollViewAndroid"); flagValue = currentProvider_->useNestedScrollViewAndroid(); useNestedScrollViewAndroid_ = flagValue; @@ -1730,7 +1748,7 @@ bool ReactNativeFeatureFlagsAccessor::useSharedAnimatedBackend() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(94, "useSharedAnimatedBackend"); + markFlagAsAccessed(95, "useSharedAnimatedBackend"); flagValue = currentProvider_->useSharedAnimatedBackend(); useSharedAnimatedBackend_ = flagValue; @@ -1748,7 +1766,7 @@ bool ReactNativeFeatureFlagsAccessor::useTraitHiddenOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(95, "useTraitHiddenOnAndroid"); + markFlagAsAccessed(96, "useTraitHiddenOnAndroid"); flagValue = currentProvider_->useTraitHiddenOnAndroid(); useTraitHiddenOnAndroid_ = flagValue; @@ -1766,7 +1784,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(96, "useTurboModuleInterop"); + markFlagAsAccessed(97, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -1784,7 +1802,7 @@ bool ReactNativeFeatureFlagsAccessor::useWindowDensityForDisplayMetricsAndroid() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(97, "useWindowDensityForDisplayMetricsAndroid"); + markFlagAsAccessed(98, "useWindowDensityForDisplayMetricsAndroid"); flagValue = currentProvider_->useWindowDensityForDisplayMetricsAndroid(); useWindowDensityForDisplayMetricsAndroid_ = flagValue; @@ -1802,7 +1820,7 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(98, "viewCullingOutsetRatio"); + markFlagAsAccessed(99, "viewCullingOutsetRatio"); flagValue = currentProvider_->viewCullingOutsetRatio(); viewCullingOutsetRatio_ = flagValue; @@ -1820,7 +1838,7 @@ bool ReactNativeFeatureFlagsAccessor::viewTransitionEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(99, "viewTransitionEnabled"); + markFlagAsAccessed(100, "viewTransitionEnabled"); flagValue = currentProvider_->viewTransitionEnabled(); viewTransitionEnabled_ = flagValue; @@ -1838,7 +1856,7 @@ bool ReactNativeFeatureFlagsAccessor::viewTransitionUseHardwareBitmapAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(100, "viewTransitionUseHardwareBitmapAndroid"); + markFlagAsAccessed(101, "viewTransitionUseHardwareBitmapAndroid"); flagValue = currentProvider_->viewTransitionUseHardwareBitmapAndroid(); viewTransitionUseHardwareBitmapAndroid_ = flagValue; @@ -1856,7 +1874,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(101, "virtualViewPrerenderRatio"); + markFlagAsAccessed(102, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 477dc1439e67..3928818d5d2d 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<> + * @generated SignedSource<<0553301b4d1f6f879a8307d8196530f1>> */ /** @@ -53,6 +53,7 @@ class ReactNativeFeatureFlagsAccessor { bool enableCppPropsIteratorSetter(); bool enableCustomFocusSearchOnClippedElementsAndroid(); bool enableDestroyShadowTreeRevisionAsync(); + bool enableDirectSubtreeMutations(); bool enableDoubleMeasurementFixAndroid(); bool enableEagerRootViewAttachment(); bool enableExclusivePropsUpdateAndroid(); @@ -147,7 +148,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 102> accessedFeatureFlags_; + std::array, 103> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -168,6 +169,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enableCppPropsIteratorSetter_; std::atomic> enableCustomFocusSearchOnClippedElementsAndroid_; std::atomic> enableDestroyShadowTreeRevisionAsync_; + std::atomic> enableDirectSubtreeMutations_; std::atomic> enableDoubleMeasurementFixAndroid_; std::atomic> enableEagerRootViewAttachment_; std::atomic> enableExclusivePropsUpdateAndroid_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 51adc60a0256..4f04736dd399 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<> */ /** @@ -105,6 +105,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } + bool enableDirectSubtreeMutations() override { + return false; + } + bool enableDoubleMeasurementFixAndroid() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 0e0fa1f4d133..24993f6256bd 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.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<> */ /** @@ -218,6 +218,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::enableDestroyShadowTreeRevisionAsync(); } + bool enableDirectSubtreeMutations() override { + auto value = values_["enableDirectSubtreeMutations"]; + if (!value.isNull()) { + return value.getBool(); + } + + return ReactNativeFeatureFlagsDefaults::enableDirectSubtreeMutations(); + } + bool enableDoubleMeasurementFixAndroid() override { auto value = values_["enableDoubleMeasurementFixAndroid"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 60b1c4d852bd..1e81108f5514 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<<9548bb9a9945a7cf7f336a19775d7de9>> + * @generated SignedSource<> */ /** @@ -46,6 +46,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool enableCppPropsIteratorSetter() = 0; virtual bool enableCustomFocusSearchOnClippedElementsAndroid() = 0; virtual bool enableDestroyShadowTreeRevisionAsync() = 0; + virtual bool enableDirectSubtreeMutations() = 0; virtual bool enableDoubleMeasurementFixAndroid() = 0; virtual bool enableEagerRootViewAttachment() = 0; virtual bool enableExclusivePropsUpdateAndroid() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index c8fd7a17ee6e..e44b7f1b1890 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<<27553445e099bb9288920bd3bd233c25>> + * @generated SignedSource<<90fe073b83bd540bace29b0bf8dfe901>> */ /** @@ -139,6 +139,11 @@ bool NativeReactNativeFeatureFlags::enableDestroyShadowTreeRevisionAsync( return ReactNativeFeatureFlags::enableDestroyShadowTreeRevisionAsync(); } +bool NativeReactNativeFeatureFlags::enableDirectSubtreeMutations( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::enableDirectSubtreeMutations(); +} + bool NativeReactNativeFeatureFlags::enableDoubleMeasurementFixAndroid( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::enableDoubleMeasurementFixAndroid(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index b9e4a1dce631..5afc3c95c965 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<<58aaefb40589a425061f191cc5c6c9c0>> + * @generated SignedSource<> */ /** @@ -76,6 +76,8 @@ class NativeReactNativeFeatureFlags bool enableDestroyShadowTreeRevisionAsync(jsi::Runtime& runtime); + bool enableDirectSubtreeMutations(jsi::Runtime& runtime); + bool enableDoubleMeasurementFixAndroid(jsi::Runtime& runtime); bool enableEagerRootViewAttachment(jsi::Runtime& runtime); diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp index 4e48d8b92b52..6a211715ff97 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp @@ -148,6 +148,7 @@ static_assert( void calculateShadowViewMutations( ViewNodePairScope& scope, + bool useDirectSubtreeMutations, ShadowViewMutation::List& mutations, Tag parentTag, std::vector&& oldChildPairs, @@ -167,6 +168,7 @@ struct OrderedMutationInstructionContainer { void calculateShadowViewMutationsFlattener( ViewNodePairScope& scope, + bool useDirectSubtreeMutations, ReparentMode reparentMode, OrderedMutationInstructionContainer& mutationContainer, Tag parentTag, @@ -188,6 +190,7 @@ void calculateShadowViewMutationsFlattener( */ void updateMatchedPairSubtrees( ViewNodePairScope& scope, + bool useDirectSubtreeMutations, OrderedMutationInstructionContainer& mutationContainer, std::unordered_map& newRemainingPairs, std::vector& oldChildPairs, @@ -224,6 +227,7 @@ void updateMatchedPairSubtrees( // map. calculateShadowViewMutationsFlattener( scope, + useDirectSubtreeMutations, ReparentMode::Flatten, mutationContainer, parentTag, @@ -260,6 +264,7 @@ void updateMatchedPairSubtrees( // Unflatten old list into new tree calculateShadowViewMutationsFlattener( scope, + useDirectSubtreeMutations, ReparentMode::Unflatten, mutationContainer, parentTag, @@ -318,6 +323,7 @@ void updateMatchedPairSubtrees( calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, *(newGrandChildPairsSize != 0u ? &mutationContainer.downwardMutations : &mutationContainer.destructiveDownwardMutations), @@ -432,6 +438,7 @@ void updateMatchedPair( */ void calculateShadowViewMutationsFlattener( ViewNodePairScope& scope, + bool useDirectSubtreeMutations, ReparentMode reparentMode, OrderedMutationInstructionContainer& mutationContainer, Tag parentTag, @@ -664,6 +671,7 @@ void calculateShadowViewMutationsFlattener( calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, mutationContainer.downwardMutations, newTreeNodePair.shadowView.tag, std::move(oldGrandChildPairs), @@ -683,6 +691,7 @@ void calculateShadowViewMutationsFlattener( if (childReparentMode == reparentMode) { calculateShadowViewMutationsFlattener( scope, + useDirectSubtreeMutations, childReparentMode, mutationContainer, (reparentMode == ReparentMode::Flatten @@ -735,6 +744,7 @@ void calculateShadowViewMutationsFlattener( // children are visited, so we reuse the `newRemainingPairs` map. calculateShadowViewMutationsFlattener( scope, + useDirectSubtreeMutations, ReparentMode::Flatten, mutationContainer, newTreeNodePair.shadowView.tag, @@ -752,6 +762,7 @@ void calculateShadowViewMutationsFlattener( auto fixedParentTagForUpdate = parentTagForUpdate; calculateShadowViewMutationsFlattener( scope, + useDirectSubtreeMutations, /* reparentMode */ ReparentMode::Unflatten, mutationContainer, parentTag, @@ -858,6 +869,7 @@ void calculateShadowViewMutationsFlattener( ViewNodePairScope innerScope{}; calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, mutationContainer.destructiveDownwardMutations, treeChildPair.shadowView.tag, sliceChildShadowNodeViewPairsFromViewNodePair( @@ -874,6 +886,7 @@ void calculateShadowViewMutationsFlattener( ViewNodePairScope innerScope{}; calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, mutationContainer.downwardMutations, treeChildPair.shadowView.tag, {}, @@ -886,8 +899,83 @@ void calculateShadowViewMutationsFlattener( } } +// Consumes `childPairs`: moves the view of each concrete pair into the +// mutations, so callers must not read those pairs afterwards +void emitSubtreeMutations( + ViewNodePairScope& scope, + ShadowViewMutation::List& mutations, + Tag parentTag, + std::vector&& childPairs, + const CullingContext& cullingContext, + bool isMounting) { + if (isMounting) { + for (const auto* childPair : childPairs) { + if (childPair->isConcreteView) { + mutations.push_back( + ShadowViewMutation::CreateMutation(childPair->shadowView)); + } + } + } + + // Create parents before visiting descendants and delete them afterwards. + for (const auto* childPair : childPairs) { + if (!childPair->isConcreteView || childPair->flattened || + childPair->shadowNode->getChildren().empty()) { + continue; + } + + const auto scopeSize = scope.size(); + const auto childCullingContext = + cullingContext.adjustCullingContextIfNeeded(*childPair); + auto grandchildPairs = sliceChildShadowNodeViewPairsFromViewNodePair( + *childPair, scope, false, childCullingContext); + if (!grandchildPairs.empty()) { + emitSubtreeMutations( + scope, + mutations, + childPair->shadowView.tag, + std::move(grandchildPairs), + childCullingContext, + isMounting); + } + scope.resize(scopeSize); + } + + if (isMounting) { + for (auto* childPair : childPairs) { + if (childPair->isConcreteView) { + mutations.push_back( + ShadowViewMutation::InsertMutation( + parentTag, + std::move(childPair->shadowView), + static_cast(childPair->mountIndex))); + } + } + } else { + // Remove from the end so earlier children keep their mount indices. + for (auto it = childPairs.rbegin(); it != childPairs.rend(); ++it) { + const auto& childPair = **it; + if (childPair.isConcreteView) { + mutations.push_back( + ShadowViewMutation::RemoveMutation( + parentTag, + childPair.shadowView, + static_cast(childPair.mountIndex))); + } + } + for (auto* childPair : childPairs) { + if (childPair->isConcreteView) { + mutations.push_back( + ShadowViewMutation::DeleteMutation( + std::move(childPair->shadowView))); + } + } + } +} + void calculateShadowViewMutations( ViewNodePairScope& scope, + bool useDirectSubtreeMutations, ShadowViewMutation::List& mutations, Tag parentTag, std::vector&& oldChildPairs, @@ -898,6 +986,29 @@ void calculateShadowViewMutations( return; } + if (useDirectSubtreeMutations) { + if (oldChildPairs.empty()) { + emitSubtreeMutations( + scope, + mutations, + parentTag, + std::move(newChildPairs), + newCullingContext, + true); + return; + } + if (newChildPairs.empty()) { + emitSubtreeMutations( + scope, + mutations, + parentTag, + std::move(oldChildPairs), + oldCullingContext, + false); + return; + } + } + const bool isViewCullingEnabled = ReactNativeFeatureFlags::enableViewCulling(); @@ -985,6 +1096,7 @@ void calculateShadowViewMutations( calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, *(newGrandChildPairsSize != 0u ? &mutationContainer.downwardMutations : &mutationContainer.destructiveDownwardMutations), @@ -1028,6 +1140,7 @@ void calculateShadowViewMutations( ViewNodePairScope innerScope{}; calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, mutationContainer.destructiveDownwardMutations, oldChildPair.shadowView.tag, sliceChildShadowNodeViewPairsFromViewNodePair( @@ -1064,6 +1177,7 @@ void calculateShadowViewMutations( ViewNodePairScope innerScope{}; calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, mutationContainer.downwardMutations, newChildPair.shadowView.tag, {}, @@ -1124,6 +1238,7 @@ void calculateShadowViewMutations( updateMatchedPairSubtrees( scope, + useDirectSubtreeMutations, mutationContainer, newRemainingPairs, oldChildPairs, @@ -1170,6 +1285,7 @@ void calculateShadowViewMutations( updateMatchedPairSubtrees( scope, + useDirectSubtreeMutations, mutationContainer, newRemainingPairs, oldChildPairs, @@ -1306,6 +1422,7 @@ void calculateShadowViewMutations( oldChildPair, innerScope, false, oldCullingContextCopy); calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, mutationContainer.destructiveDownwardMutations, oldChildPair.shadowView.tag, std::move(newGrandChildPairs), @@ -1345,6 +1462,7 @@ void calculateShadowViewMutations( calculateShadowViewMutations( innerScope, + useDirectSubtreeMutations, mutationContainer.downwardMutations, newChildPair.shadowView.tag, {}, @@ -1393,6 +1511,9 @@ ShadowViewMutation::List calculateShadowViewMutations( const ShadowNode& newRootShadowNode) { TraceSection s("calculateShadowViewMutations"); + const bool useDirectSubtreeMutations = + ReactNativeFeatureFlags::enableDirectSubtreeMutations(); + // Root shadow nodes must be belong the same family. react_native_assert( ShadowNode::sameFamily(oldRootShadowNode, newRootShadowNode)); @@ -1427,6 +1548,7 @@ ShadowViewMutation::List calculateShadowViewMutations( calculateShadowViewMutations( innerViewNodePairScope, + useDirectSubtreeMutations, mutations, oldRootShadowNode.getTag(), std::move(sliceOne), diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/tests/DifferentiatorUnflattenTest.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/tests/DifferentiatorUnflattenTest.cpp index 3f82668648f2..1199dfbe2a3e 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/tests/DifferentiatorUnflattenTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/tests/DifferentiatorUnflattenTest.cpp @@ -9,6 +9,8 @@ #include +#include +#include #include #include #include @@ -153,4 +155,82 @@ TEST_F(DifferentiatorUnflattenTest, updateMutationHasCorrectParentTag) { }); } +namespace { + +class DirectSubtreeMutationFlags final + : public ReactNativeFeatureFlagsDefaults { + public: + explicit DirectSubtreeMutationFlags(bool enabled) : enabled_(enabled) {} + + bool enableDirectSubtreeMutations() override { + return enabled_; + } + + private: + bool enabled_; +}; + +class DifferentiatorMutationTest : public ::testing::TestWithParam { + protected: + void SetUp() override { + ReactNativeFeatureFlags::dangerouslyReset(); + ReactNativeFeatureFlags::override( + std::make_unique(GetParam())); + } + + void TearDown() override { + ReactNativeFeatureFlags::dangerouslyReset(); + } +}; + +} // namespace + +// Tag 2 forms a view and a stacking context. Tag 3 forms no view, and tag 7 +// forms a view but no stacking context, so the children of both are mounted +// in tag 2. +TEST_P(DifferentiatorMutationTest, mountsAndUnmountsMixedSubtree) { + auto concrete = std::make_shared(); + concrete->nativeId = "concrete"; + auto viewWithFlattenedChildren = std::make_shared(); + viewWithFlattenedChildren->backgroundColor = blackColor(); + std::shared_ptr root; + auto builder = simpleComponentBuilder(); + builder.build( + Element().tag(1).reference(root).children({ + Element().tag(2).props(concrete).children({ + Element().tag(3).children({ + Element().tag(4).props(concrete), + Element().tag(5).props(concrete), + }), + Element() + .tag(7) + .props(viewWithFlattenedChildren) + .children({ + Element().tag(8).props(concrete), + Element().tag(9).props(concrete), + }), + }), + Element().tag(6).props(concrete), + })); + root->layoutIfNeeded(); + auto emptyChildren = + std::make_shared>>(); + auto empty = static_cast(*root).clone( + ShadowNodeFragment{.children = emptyChildren}); + + auto mountingTree = buildStubViewTreeWithoutUsingDifferentiator(*empty); + mountingTree.mutate(calculateShadowViewMutations(*empty, *root)); + EXPECT_EQ(mountingTree, buildStubViewTreeWithoutUsingDifferentiator(*root)); + mountingTree.mutate(calculateShadowViewMutations(*root, *empty)); + EXPECT_EQ(mountingTree, buildStubViewTreeWithoutUsingDifferentiator(*empty)); +} + +INSTANTIATE_TEST_SUITE_P( + DirectSubtreeMutations, + DifferentiatorMutationTest, + ::testing::Bool(), + [](const ::testing::TestParamInfo& info) { + return info.param ? "Enabled" : "Disabled"; + }); + } // namespace facebook::react diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index ea7af7e6f9f6..66b5ef1033e4 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -256,6 +256,17 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, + enableDirectSubtreeMutations: { + defaultValue: false, + metadata: { + dateAdded: '2026-12-04', + description: + 'Emits Fabric mount and unmount mutations for whole subtrees directly into the output list.', + expectedReleaseValue: true, + purpose: 'experimentation', + }, + ossReleaseStage: 'none', + }, enableDoubleMeasurementFixAndroid: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 555b30cbada4..95d5f8943572 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<<8ec21317ccd8eee8eda95d9761b4d67c>> * @flow strict * @noformat */ @@ -68,6 +68,7 @@ export type ReactNativeFeatureFlags = Readonly<{ enableCppPropsIteratorSetter: Getter, enableCustomFocusSearchOnClippedElementsAndroid: Getter, enableDestroyShadowTreeRevisionAsync: Getter, + enableDirectSubtreeMutations: Getter, enableDoubleMeasurementFixAndroid: Getter, enableEagerRootViewAttachment: Getter, enableExclusivePropsUpdateAndroid: Getter, @@ -303,6 +304,10 @@ export const enableCustomFocusSearchOnClippedElementsAndroid: Getter = * Enables destructor calls for ShadowTreeRevision in the background to reduce UI thread work. */ export const enableDestroyShadowTreeRevisionAsync: Getter = createNativeFlagGetter('enableDestroyShadowTreeRevisionAsync', false); +/** + * Emits Fabric mount and unmount mutations for whole subtrees directly into the output list. + */ +export const enableDirectSubtreeMutations: Getter = createNativeFlagGetter('enableDirectSubtreeMutations', false); /** * When enabled a subset of components will avoid double measurement on Android. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index e57521d114f1..c021d397e9c5 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<<41998e5b85bd36d407898c1ee516c76e>> + * @generated SignedSource<<4d07fff55c66d0b559f9138fb47eaed4>> * @flow strict * @noformat */ @@ -44,6 +44,7 @@ export interface Spec extends TurboModule { readonly enableCppPropsIteratorSetter?: () => boolean; readonly enableCustomFocusSearchOnClippedElementsAndroid?: () => boolean; readonly enableDestroyShadowTreeRevisionAsync?: () => boolean; + readonly enableDirectSubtreeMutations?: () => boolean; readonly enableDoubleMeasurementFixAndroid?: () => boolean; readonly enableEagerRootViewAttachment?: () => boolean; readonly enableExclusivePropsUpdateAndroid?: () => boolean;