From 700b403e06fdcbcde2a4ade9570eb572431487ea Mon Sep 17 00:00:00 2001 From: David Vacca Date: Mon, 22 Jul 2024 14:20:40 -0700 Subject: [PATCH] Migrate excludeYogaFromRawProps to ReactNativeFeatureFlags (#45586) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45586 Migrate excludeYogaFromRawProps to ReactNativeFeatureFlags changelog: [internal] internal Reviewed By: NickGerleman Differential Revision: D60022939 fbshipit-source-id: 150ecc98aa3323d5adea3a41a3d91d404c99e5a7 --- .../ReactAndroid/api/ReactAndroid.api | 1 - .../react/config/ReactFeatureFlags.java | 3 - .../featureflags/ReactNativeFeatureFlags.kt | 8 ++- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +++- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 ++++- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../src/main/jni/react/fabric/Binding.cpp | 2 +- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +++++- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 +- .../featureflags/ReactNativeFeatureFlags.h | 7 ++- .../ReactNativeFeatureFlagsAccessor.cpp | 56 ++++++++++++------- .../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 +- 22 files changed, 140 insertions(+), 42 deletions(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index f6c349bbd47..8686cc402de 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -1969,7 +1969,6 @@ public class com/facebook/react/config/ReactFeatureFlags { public static field enableFabricLogs Z public static field enableFabricRenderer Z public static field enableViewRecycling Z - public static field excludeYogaFromRawProps Z public static field traceTurboModulePromiseRejections Z public static field unstable_enableTurboModuleSyncVoidMethods Z public static field unstable_useFabricInterop Z diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index 0412836ff34..0e16c506580 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -76,9 +76,6 @@ public class ReactFeatureFlags { */ public static boolean enableCppPropsIteratorSetter = false; - /** When enabled, rawProps in Props will not include Yoga specific props. */ - public static boolean excludeYogaFromRawProps = false; - /** * Enables storing js caller stack when creating promise in native module. This is useful in case * of Promise rejection and tracing the cause. 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 26ba789a1e9..32e98bfdf32 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<<74d986b082e44be1b358d5442f4d133d>> + * @generated SignedSource<<0a9e1aa23c685e58456bb80f8ee9ef10>> */ /** @@ -124,6 +124,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableUIConsistency(): Boolean = accessor.enableUIConsistency() + /** + * When enabled, rawProps in Props will not include Yoga specific props. + */ + @JvmStatic + public fun excludeYogaFromRawProps(): Boolean = accessor.excludeYogaFromRawProps() + /** * Start image fetching during view preallocation instead of waiting for layout pass */ 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 55740dccbb7..ceec8864e1d 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<<375e752a672912488b52e34f39b5ed8c>> + * @generated SignedSource<> */ /** @@ -36,6 +36,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null private var enableSynchronousStateUpdatesCache: Boolean? = null private var enableUIConsistencyCache: Boolean? = null + private var excludeYogaFromRawPropsCache: Boolean? = null private var fetchImagesInViewPreallocationCache: Boolean? = null private var fixIncorrectScrollViewStateUpdateOnAndroidCache: Boolean? = null private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null @@ -199,6 +200,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso return cached } + override fun excludeYogaFromRawProps(): Boolean { + var cached = excludeYogaFromRawPropsCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.excludeYogaFromRawProps() + excludeYogaFromRawPropsCache = cached + } + return cached + } + override fun fetchImagesInViewPreallocation(): Boolean { var cached = fetchImagesInViewPreallocationCache 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 137eaec170d..eb993462d81 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<<143e35723bffbb6ba5be2cfa4a497f0b>> + * @generated SignedSource<<6e715e118c8e41d7a4b3a8ce02c62d4d>> */ /** @@ -60,6 +60,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableUIConsistency(): Boolean + @DoNotStrip @JvmStatic public external fun excludeYogaFromRawProps(): Boolean + @DoNotStrip @JvmStatic public external fun fetchImagesInViewPreallocation(): Boolean @DoNotStrip @JvmStatic public external fun fixIncorrectScrollViewStateUpdateOnAndroid(): 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 7b86d2ed5c4..f3043a41ee7 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<<841edbe102ebbd78040892cf76f79bba>> + * @generated SignedSource<<6763616cc6266115d83a59f2aa957662>> */ /** @@ -55,6 +55,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableUIConsistency(): Boolean = false + override fun excludeYogaFromRawProps(): Boolean = false + override fun fetchImagesInViewPreallocation(): Boolean = false override fun fixIncorrectScrollViewStateUpdateOnAndroid(): 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 b3a62e70eeb..e35bafc313f 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<<58cd9d65067ed758ecad65ad22737b6c>> + * @generated SignedSource<<0a1e1cdc3861ba113ce05a80f989fdc5>> */ /** @@ -40,6 +40,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null private var enableSynchronousStateUpdatesCache: Boolean? = null private var enableUIConsistencyCache: Boolean? = null + private var excludeYogaFromRawPropsCache: Boolean? = null private var fetchImagesInViewPreallocationCache: Boolean? = null private var fixIncorrectScrollViewStateUpdateOnAndroidCache: Boolean? = null private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null @@ -219,6 +220,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun excludeYogaFromRawProps(): Boolean { + var cached = excludeYogaFromRawPropsCache + if (cached == null) { + cached = currentProvider.excludeYogaFromRawProps() + accessedFeatureFlags.add("excludeYogaFromRawProps") + excludeYogaFromRawPropsCache = cached + } + return cached + } + override fun fetchImagesInViewPreallocation(): Boolean { var cached = fetchImagesInViewPreallocationCache 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 8749196c0fe..e50045944f8 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<<7f753a763c3f4c0bcbdad268e32b21fb>> + * @generated SignedSource<<9eef72f825f596873e59e4fe8c00fdbe>> */ /** @@ -55,6 +55,8 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableUIConsistency(): Boolean + @DoNotStrip public fun excludeYogaFromRawProps(): Boolean + @DoNotStrip public fun fetchImagesInViewPreallocation(): Boolean @DoNotStrip public fun fixIncorrectScrollViewStateUpdateOnAndroid(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp index fb076f1ca20..572c2629788 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp @@ -398,7 +398,7 @@ void Binding::installFabricUIManager( CoreFeatures::enablePropIteratorSetter = getFeatureFlagValue("enableCppPropsIteratorSetter"); CoreFeatures::excludeYogaFromRawProps = - getFeatureFlagValue("excludeYogaFromRawProps"); + ReactNativeFeatureFlags::excludeYogaFromRawProps(); auto toolbox = SchedulerToolbox{}; toolbox.contextContainer = contextContainer; 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 e81dc81ccd9..40ddea3cc25 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<<071a086e05e9f98555961052f70e81df>> */ /** @@ -135,6 +135,12 @@ class ReactNativeFeatureFlagsProviderHolder return method(javaProvider_); } + bool excludeYogaFromRawProps() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("excludeYogaFromRawProps"); + return method(javaProvider_); + } + bool fetchImagesInViewPreallocation() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("fetchImagesInViewPreallocation"); @@ -327,6 +333,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableUIConsistency( return ReactNativeFeatureFlags::enableUIConsistency(); } +bool JReactNativeFeatureFlagsCxxInterop::excludeYogaFromRawProps( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::excludeYogaFromRawProps(); +} + bool JReactNativeFeatureFlagsCxxInterop::fetchImagesInViewPreallocation( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::fetchImagesInViewPreallocation(); @@ -482,6 +493,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableUIConsistency", JReactNativeFeatureFlagsCxxInterop::enableUIConsistency), + makeNativeMethod( + "excludeYogaFromRawProps", + JReactNativeFeatureFlagsCxxInterop::excludeYogaFromRawProps), makeNativeMethod( "fetchImagesInViewPreallocation", JReactNativeFeatureFlagsCxxInterop::fetchImagesInViewPreallocation), 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 0383d197884..8969f0cc859 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<> */ /** @@ -78,6 +78,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableUIConsistency( facebook::jni::alias_ref); + static bool excludeYogaFromRawProps( + facebook::jni::alias_ref); + static bool fetchImagesInViewPreallocation( 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 e84a4647229..aab56bb2d82 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<> + * @generated SignedSource<<9018edcc813f79df51c2417214b428c0>> */ /** @@ -85,6 +85,10 @@ bool ReactNativeFeatureFlags::enableUIConsistency() { return getAccessor().enableUIConsistency(); } +bool ReactNativeFeatureFlags::excludeYogaFromRawProps() { + return getAccessor().excludeYogaFromRawProps(); +} + bool ReactNativeFeatureFlags::fetchImagesInViewPreallocation() { return getAccessor().fetchImagesInViewPreallocation(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 263744bf9bf..8ba7dc38858 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<<9a8e9432a444aaa9d997a91a77e17fa9>> + * @generated SignedSource<> */ /** @@ -117,6 +117,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableUIConsistency(); + /** + * When enabled, rawProps in Props will not include Yoga specific props. + */ + RN_EXPORT static bool excludeYogaFromRawProps(); + /** * Start image fetching during view preallocation instead of waiting for layout pass */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index ea3bfa8c0c6..d7ffeeb1586 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<<7a2df536af010a897cf36295fccb9040>> + * @generated SignedSource<> */ /** @@ -317,6 +317,24 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::excludeYogaFromRawProps() { + auto flagValue = excludeYogaFromRawProps_.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(16, "excludeYogaFromRawProps"); + + flagValue = currentProvider_->excludeYogaFromRawProps(); + excludeYogaFromRawProps_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::fetchImagesInViewPreallocation() { auto flagValue = fetchImagesInViewPreallocation_.load(); @@ -326,7 +344,7 @@ bool ReactNativeFeatureFlagsAccessor::fetchImagesInViewPreallocation() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(16, "fetchImagesInViewPreallocation"); + markFlagAsAccessed(17, "fetchImagesInViewPreallocation"); flagValue = currentProvider_->fetchImagesInViewPreallocation(); fetchImagesInViewPreallocation_ = flagValue; @@ -344,7 +362,7 @@ bool ReactNativeFeatureFlagsAccessor::fixIncorrectScrollViewStateUpdateOnAndroid // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(17, "fixIncorrectScrollViewStateUpdateOnAndroid"); + markFlagAsAccessed(18, "fixIncorrectScrollViewStateUpdateOnAndroid"); flagValue = currentProvider_->fixIncorrectScrollViewStateUpdateOnAndroid(); fixIncorrectScrollViewStateUpdateOnAndroid_ = flagValue; @@ -362,7 +380,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(18, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(19, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMissedFabricStateUpdatesOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(19, "fixMissedFabricStateUpdatesOnAndroid"); + markFlagAsAccessed(20, "fixMissedFabricStateUpdatesOnAndroid"); flagValue = currentProvider_->fixMissedFabricStateUpdatesOnAndroid(); fixMissedFabricStateUpdatesOnAndroid_ = flagValue; @@ -398,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::forceBatchingMountItemsOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(20, "forceBatchingMountItemsOnAndroid"); + markFlagAsAccessed(21, "forceBatchingMountItemsOnAndroid"); flagValue = currentProvider_->forceBatchingMountItemsOnAndroid(); forceBatchingMountItemsOnAndroid_ = flagValue; @@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledDebug() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(21, "fuseboxEnabledDebug"); + markFlagAsAccessed(22, "fuseboxEnabledDebug"); flagValue = currentProvider_->fuseboxEnabledDebug(); fuseboxEnabledDebug_ = flagValue; @@ -434,7 +452,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(22, "fuseboxEnabledRelease"); + markFlagAsAccessed(23, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::initEagerTurboModulesOnNativeModulesQueueA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(23, "initEagerTurboModulesOnNativeModulesQueueAndroid"); + markFlagAsAccessed(24, "initEagerTurboModulesOnNativeModulesQueueAndroid"); flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid(); initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue; @@ -470,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::lazyAnimationCallbacks() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(24, "lazyAnimationCallbacks"); + markFlagAsAccessed(25, "lazyAnimationCallbacks"); flagValue = currentProvider_->lazyAnimationCallbacks(); lazyAnimationCallbacks_ = flagValue; @@ -488,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(25, "loadVectorDrawablesOnImages"); + markFlagAsAccessed(26, "loadVectorDrawablesOnImages"); flagValue = currentProvider_->loadVectorDrawablesOnImages(); loadVectorDrawablesOnImages_ = flagValue; @@ -506,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::setAndroidLayoutDirection() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(26, "setAndroidLayoutDirection"); + markFlagAsAccessed(27, "setAndroidLayoutDirection"); flagValue = currentProvider_->setAndroidLayoutDirection(); setAndroidLayoutDirection_ = flagValue; @@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(27, "useImmediateExecutorInAndroidBridgeless"); + markFlagAsAccessed(28, "useImmediateExecutorInAndroidBridgeless"); flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless(); useImmediateExecutorInAndroidBridgeless_ = flagValue; @@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(28, "useModernRuntimeScheduler"); + markFlagAsAccessed(29, "useModernRuntimeScheduler"); flagValue = currentProvider_->useModernRuntimeScheduler(); useModernRuntimeScheduler_ = flagValue; @@ -560,7 +578,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(29, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(30, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -578,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::useNewReactImageViewBackgroundDrawing() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(30, "useNewReactImageViewBackgroundDrawing"); + markFlagAsAccessed(31, "useNewReactImageViewBackgroundDrawing"); flagValue = currentProvider_->useNewReactImageViewBackgroundDrawing(); useNewReactImageViewBackgroundDrawing_ = flagValue; @@ -596,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(31, "useRuntimeShadowNodeReferenceUpdate"); + markFlagAsAccessed(32, "useRuntimeShadowNodeReferenceUpdate"); flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate(); useRuntimeShadowNodeReferenceUpdate_ = flagValue; @@ -614,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdateOnLayou // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(32, "useRuntimeShadowNodeReferenceUpdateOnLayout"); + markFlagAsAccessed(33, "useRuntimeShadowNodeReferenceUpdateOnLayout"); flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdateOnLayout(); useRuntimeShadowNodeReferenceUpdateOnLayout_ = flagValue; @@ -632,7 +650,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(33, "useStateAlignmentMechanism"); + markFlagAsAccessed(34, "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 12070678776..e74c07e1bb6 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<<8ba2e36038a0158a9bcfa5ba7603f2f5>> + * @generated SignedSource<> */ /** @@ -47,6 +47,7 @@ class ReactNativeFeatureFlagsAccessor { bool enablePropsUpdateReconciliationAndroid(); bool enableSynchronousStateUpdates(); bool enableUIConsistency(); + bool excludeYogaFromRawProps(); bool fetchImagesInViewPreallocation(); bool fixIncorrectScrollViewStateUpdateOnAndroid(); bool fixMappingOfEventPrioritiesBetweenFabricAndReact(); @@ -75,7 +76,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 34> accessedFeatureFlags_; + std::array, 35> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> allowCollapsableChildren_; @@ -93,6 +94,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enablePropsUpdateReconciliationAndroid_; std::atomic> enableSynchronousStateUpdates_; std::atomic> enableUIConsistency_; + std::atomic> excludeYogaFromRawProps_; std::atomic> fetchImagesInViewPreallocation_; std::atomic> fixIncorrectScrollViewStateUpdateOnAndroid_; std::atomic> fixMappingOfEventPrioritiesBetweenFabricAndReact_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index f6ee78e41ad..8c685c65369 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<<2442bf826489b9fcc06afa172efa8d9d>> + * @generated SignedSource<<71de31447eb8cbc20c817ce5e8e6f8b1>> */ /** @@ -91,6 +91,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } + bool excludeYogaFromRawProps() override { + return false; + } + bool fetchImagesInViewPreallocation() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 406491351f5..52c61c4b950 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<<4cbbd04eb5f72a2e5f5414276c3561a5>> + * @generated SignedSource<<1f293d8fed626226d5aa77e389312ae9>> */ /** @@ -41,6 +41,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool enablePropsUpdateReconciliationAndroid() = 0; virtual bool enableSynchronousStateUpdates() = 0; virtual bool enableUIConsistency() = 0; + virtual bool excludeYogaFromRawProps() = 0; virtual bool fetchImagesInViewPreallocation() = 0; virtual bool fixIncorrectScrollViewStateUpdateOnAndroid() = 0; virtual bool fixMappingOfEventPrioritiesBetweenFabricAndReact() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 9eade36c787..c274a4a9ecc 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<<8f5a7c45dad6a49355e0823bb6e16b3e>> + * @generated SignedSource<<08bf79de492959b1c8df2e3267077c0a>> */ /** @@ -117,6 +117,11 @@ bool NativeReactNativeFeatureFlags::enableUIConsistency( return ReactNativeFeatureFlags::enableUIConsistency(); } +bool NativeReactNativeFeatureFlags::excludeYogaFromRawProps( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::excludeYogaFromRawProps(); +} + bool NativeReactNativeFeatureFlags::fetchImagesInViewPreallocation( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::fetchImagesInViewPreallocation(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 5148d3ebf08..fa3471c7e9f 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<<929fb57602a8fe468707047daa05a8a7>> + * @generated SignedSource<<9287647f27c592eaa608762c4309601a>> */ /** @@ -67,6 +67,8 @@ class NativeReactNativeFeatureFlags bool enableUIConsistency(jsi::Runtime& runtime); + bool excludeYogaFromRawProps(jsi::Runtime& runtime); + bool fetchImagesInViewPreallocation(jsi::Runtime& runtime); bool fixIncorrectScrollViewStateUpdateOnAndroid(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 26c9d92f807..cdf4d12b00b 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -113,6 +113,11 @@ const definitions: FeatureFlagDefinitions = { description: 'Ensures that JavaScript always has a consistent view of the state of the UI (e.g.: commits done in other threads are not immediately propagated to JS during its execution).', }, + excludeYogaFromRawProps: { + defaultValue: false, + description: + 'When enabled, rawProps in Props will not include Yoga specific props.', + }, fetchImagesInViewPreallocation: { defaultValue: false, description: diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 13ecf9e3427..d4fae556e81 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<<3ddf6ec6b530797e56609a4ee37dc4fc>> * @flow strict-local */ @@ -59,6 +59,7 @@ export type ReactNativeFeatureFlags = { enablePropsUpdateReconciliationAndroid: Getter, enableSynchronousStateUpdates: Getter, enableUIConsistency: Getter, + excludeYogaFromRawProps: Getter, fetchImagesInViewPreallocation: Getter, fixIncorrectScrollViewStateUpdateOnAndroid: Getter, fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter, @@ -198,6 +199,10 @@ export const enableSynchronousStateUpdates: Getter = createNativeFlagGe * Ensures that JavaScript always has a consistent view of the state of the UI (e.g.: commits done in other threads are not immediately propagated to JS during its execution). */ export const enableUIConsistency: Getter = createNativeFlagGetter('enableUIConsistency', false); +/** + * When enabled, rawProps in Props will not include Yoga specific props. + */ +export const excludeYogaFromRawProps: Getter = createNativeFlagGetter('excludeYogaFromRawProps', false); /** * Start image fetching during view preallocation instead of waiting for layout pass */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index e12ab9eaaba..ed477c418be 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<<20f7827abf86b1c39f676486bcf03d92>> + * @generated SignedSource<<5f09364e48d037c932428c0486290730>> * @flow strict-local */ @@ -39,6 +39,7 @@ export interface Spec extends TurboModule { +enablePropsUpdateReconciliationAndroid?: () => boolean; +enableSynchronousStateUpdates?: () => boolean; +enableUIConsistency?: () => boolean; + +excludeYogaFromRawProps?: () => boolean; +fetchImagesInViewPreallocation?: () => boolean; +fixIncorrectScrollViewStateUpdateOnAndroid?: () => boolean; +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;