diff --git a/packages/react-native/React/Fabric/RCTScheduler.mm b/packages/react-native/React/Fabric/RCTScheduler.mm index 79d2b11e4dc..29ea406343d 100644 --- a/packages/react-native/React/Fabric/RCTScheduler.mm +++ b/packages/react-native/React/Fabric/RCTScheduler.mm @@ -8,6 +8,7 @@ #import "RCTScheduler.h" #import +#import #import #import #import @@ -118,7 +119,7 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi _delegateProxy = std::make_shared((__bridge void *)self); - if (reactNativeConfig->getBool("react_fabric:enabled_layout_animations_ios")) { + if (ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS()) { _layoutAnimationDelegateProxy = std::make_shared((__bridge void *)self); _animationDriver = std::make_shared( toolbox.runtimeExecutor, toolbox.contextContainer, _layoutAnimationDelegateProxy.get()); 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 f2118184acd..77ac7bb3aeb 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<<213f28bbe5ea5f66048ece938609e815>> + * @generated SignedSource<<37c55ee907c49bff0f6b3fe1d56dcfe6>> */ /** @@ -112,6 +112,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableGranularShadowTreeStateReconciliation(): Boolean = accessor.enableGranularShadowTreeStateReconciliation() + /** + * When enabled, LayoutAnimations API will animate state changes on iOS. + */ + @JvmStatic + public fun enableLayoutAnimationsOnIOS(): Boolean = accessor.enableLayoutAnimationsOnIOS() + /** * Enables the reporting of long tasks through `PerformanceObserver`. Only works if the event loop is enabled. */ 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 ff33b53530d..a470271553c 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<> + * @generated SignedSource<<9ce10d501d1d245eaa56dd6644a2838d>> */ /** @@ -34,6 +34,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso private var enableFabricLogsCache: Boolean? = null private var enableFabricRendererExclusivelyCache: Boolean? = null private var enableGranularShadowTreeStateReconciliationCache: Boolean? = null + private var enableLayoutAnimationsOnIOSCache: Boolean? = null private var enableLongTaskAPICache: Boolean? = null private var enableMicrotasksCache: Boolean? = null private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null @@ -191,6 +192,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso return cached } + override fun enableLayoutAnimationsOnIOS(): Boolean { + var cached = enableLayoutAnimationsOnIOSCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.enableLayoutAnimationsOnIOS() + enableLayoutAnimationsOnIOSCache = cached + } + return cached + } + override fun enableLongTaskAPI(): Boolean { var cached = enableLongTaskAPICache 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 74c7843dd23..9b7021e4a5c 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<<3dccfc01207bf4ea6b671754cbd31313>> + * @generated SignedSource<> */ /** @@ -56,6 +56,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableGranularShadowTreeStateReconciliation(): Boolean + @DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnIOS(): Boolean + @DoNotStrip @JvmStatic public external fun enableLongTaskAPI(): Boolean @DoNotStrip @JvmStatic public external fun enableMicrotasks(): 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 84f32faf419..e978b8319c4 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<<2ac7adf2656a8a356cc1b4d8f40bd20b>> */ /** @@ -51,6 +51,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableGranularShadowTreeStateReconciliation(): Boolean = false + override fun enableLayoutAnimationsOnIOS(): Boolean = true + override fun enableLongTaskAPI(): Boolean = false override fun enableMicrotasks(): 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 8d573bd53e5..5ee85ca66dc 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<> */ /** @@ -38,6 +38,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces private var enableFabricLogsCache: Boolean? = null private var enableFabricRendererExclusivelyCache: Boolean? = null private var enableGranularShadowTreeStateReconciliationCache: Boolean? = null + private var enableLayoutAnimationsOnIOSCache: Boolean? = null private var enableLongTaskAPICache: Boolean? = null private var enableMicrotasksCache: Boolean? = null private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null @@ -209,6 +210,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun enableLayoutAnimationsOnIOS(): Boolean { + var cached = enableLayoutAnimationsOnIOSCache + if (cached == null) { + cached = currentProvider.enableLayoutAnimationsOnIOS() + accessedFeatureFlags.add("enableLayoutAnimationsOnIOS") + enableLayoutAnimationsOnIOSCache = cached + } + return cached + } + override fun enableLongTaskAPI(): Boolean { var cached = enableLongTaskAPICache 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 0a30061060c..5b0d6cea15e 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<<2e4136d39051c4a1ee6289a6ccf02d52>> */ /** @@ -51,6 +51,8 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableGranularShadowTreeStateReconciliation(): Boolean + @DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean + @DoNotStrip public fun enableLongTaskAPI(): Boolean @DoNotStrip public fun enableMicrotasks(): 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 2dea4855cf8..62efffb7384 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<<7c9c4fe7fb8c50deaacfca3e1236eb95>> + * @generated SignedSource<<8c6289e2eda0e672a38a7c30bf508806>> */ /** @@ -123,6 +123,12 @@ class ReactNativeFeatureFlagsProviderHolder return method(javaProvider_); } + bool enableLayoutAnimationsOnIOS() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableLayoutAnimationsOnIOS"); + return method(javaProvider_); + } + bool enableLongTaskAPI() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableLongTaskAPI"); @@ -377,6 +383,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableGranularShadowTreeStateReconcilia return ReactNativeFeatureFlags::enableGranularShadowTreeStateReconciliation(); } +bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS(); +} + bool JReactNativeFeatureFlagsCxxInterop::enableLongTaskAPI( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::enableLongTaskAPI(); @@ -586,6 +597,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableGranularShadowTreeStateReconciliation", JReactNativeFeatureFlagsCxxInterop::enableGranularShadowTreeStateReconciliation), + makeNativeMethod( + "enableLayoutAnimationsOnIOS", + JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS), makeNativeMethod( "enableLongTaskAPI", JReactNativeFeatureFlagsCxxInterop::enableLongTaskAPI), 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 ca3eb907723..efd292440e2 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<<2f38de8d77e21643f0cb253dec06c979>> + * @generated SignedSource<<50413c841b6983476df2efcf74e1c5d6>> */ /** @@ -72,6 +72,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableGranularShadowTreeStateReconciliation( facebook::jni::alias_ref); + static bool enableLayoutAnimationsOnIOS( + facebook::jni::alias_ref); + static bool enableLongTaskAPI( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/config/ReactNativeConfig.cpp b/packages/react-native/ReactCommon/react/config/ReactNativeConfig.cpp index 9b52a2bb8e3..dbeae137424 100644 --- a/packages/react-native/ReactCommon/react/config/ReactNativeConfig.cpp +++ b/packages/react-native/ReactCommon/react/config/ReactNativeConfig.cpp @@ -10,9 +10,6 @@ namespace facebook::react { bool EmptyReactNativeConfig::getBool(const std::string& param) const { - if (param == "react_fabric:enabled_layout_animations_ios") { - return true; - } if (param == "react_fabric:enabled_automatic_interop_android") { return true; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index 312c96d0ae4..c60c49f323b 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<<6ced494246c9c64487dee9f409d75f0e>> */ /** @@ -77,6 +77,10 @@ bool ReactNativeFeatureFlags::enableGranularShadowTreeStateReconciliation() { return getAccessor().enableGranularShadowTreeStateReconciliation(); } +bool ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS() { + return getAccessor().enableLayoutAnimationsOnIOS(); +} + bool ReactNativeFeatureFlags::enableLongTaskAPI() { return getAccessor().enableLongTaskAPI(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 0cad115e6d6..3f268d52dea 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<<07380f2e1127e32c6c585f6cdf377f36>> + * @generated SignedSource<<9aa269f6c9056b4e0e477142554db59a>> */ /** @@ -107,6 +107,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableGranularShadowTreeStateReconciliation(); + /** + * When enabled, LayoutAnimations API will animate state changes on iOS. + */ + RN_EXPORT static bool enableLayoutAnimationsOnIOS(); + /** * Enables the reporting of long tasks through `PerformanceObserver`. Only works if the event loop is enabled. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 4eb51290130..4e9e54b1d17 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<<48fa80b30c7851231dec8cd2ac2e9edb>> + * @generated SignedSource<> */ /** @@ -281,6 +281,24 @@ bool ReactNativeFeatureFlagsAccessor::enableGranularShadowTreeStateReconciliatio return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnIOS() { + auto flagValue = enableLayoutAnimationsOnIOS_.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(14, "enableLayoutAnimationsOnIOS"); + + flagValue = currentProvider_->enableLayoutAnimationsOnIOS(); + enableLayoutAnimationsOnIOS_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::enableLongTaskAPI() { auto flagValue = enableLongTaskAPI_.load(); @@ -290,7 +308,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLongTaskAPI() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(14, "enableLongTaskAPI"); + markFlagAsAccessed(15, "enableLongTaskAPI"); flagValue = currentProvider_->enableLongTaskAPI(); enableLongTaskAPI_ = flagValue; @@ -308,7 +326,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMicrotasks() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(15, "enableMicrotasks"); + markFlagAsAccessed(16, "enableMicrotasks"); flagValue = currentProvider_->enableMicrotasks(); enableMicrotasks_ = flagValue; @@ -326,7 +344,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(16, "enablePropsUpdateReconciliationAndroid"); + markFlagAsAccessed(17, "enablePropsUpdateReconciliationAndroid"); flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid(); enablePropsUpdateReconciliationAndroid_ = flagValue; @@ -344,7 +362,7 @@ bool ReactNativeFeatureFlagsAccessor::enableReportEventPaintTime() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(17, "enableReportEventPaintTime"); + markFlagAsAccessed(18, "enableReportEventPaintTime"); flagValue = currentProvider_->enableReportEventPaintTime(); enableReportEventPaintTime_ = flagValue; @@ -362,7 +380,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(18, "enableSynchronousStateUpdates"); + markFlagAsAccessed(19, "enableSynchronousStateUpdates"); flagValue = currentProvider_->enableSynchronousStateUpdates(); enableSynchronousStateUpdates_ = flagValue; @@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(19, "enableUIConsistency"); + markFlagAsAccessed(20, "enableUIConsistency"); flagValue = currentProvider_->enableUIConsistency(); enableUIConsistency_ = flagValue; @@ -398,7 +416,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(20, "enableViewRecycling"); + markFlagAsAccessed(21, "enableViewRecycling"); flagValue = currentProvider_->enableViewRecycling(); enableViewRecycling_ = flagValue; @@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::excludeYogaFromRawProps() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(21, "excludeYogaFromRawProps"); + markFlagAsAccessed(22, "excludeYogaFromRawProps"); flagValue = currentProvider_->excludeYogaFromRawProps(); excludeYogaFromRawProps_ = flagValue; @@ -434,7 +452,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(22, "fetchImagesInViewPreallocation"); + markFlagAsAccessed(23, "fetchImagesInViewPreallocation"); flagValue = currentProvider_->fetchImagesInViewPreallocation(); fetchImagesInViewPreallocation_ = flagValue; @@ -452,7 +470,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(23, "fixIncorrectScrollViewStateUpdateOnAndroid"); + markFlagAsAccessed(24, "fixIncorrectScrollViewStateUpdateOnAndroid"); flagValue = currentProvider_->fixIncorrectScrollViewStateUpdateOnAndroid(); fixIncorrectScrollViewStateUpdateOnAndroid_ = flagValue; @@ -470,7 +488,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(24, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(25, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -488,7 +506,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(25, "fixMissedFabricStateUpdatesOnAndroid"); + markFlagAsAccessed(26, "fixMissedFabricStateUpdatesOnAndroid"); flagValue = currentProvider_->fixMissedFabricStateUpdatesOnAndroid(); fixMissedFabricStateUpdatesOnAndroid_ = flagValue; @@ -506,7 +524,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(26, "forceBatchingMountItemsOnAndroid"); + markFlagAsAccessed(27, "forceBatchingMountItemsOnAndroid"); flagValue = currentProvider_->forceBatchingMountItemsOnAndroid(); forceBatchingMountItemsOnAndroid_ = flagValue; @@ -524,7 +542,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(27, "fuseboxEnabledDebug"); + markFlagAsAccessed(28, "fuseboxEnabledDebug"); flagValue = currentProvider_->fuseboxEnabledDebug(); fuseboxEnabledDebug_ = flagValue; @@ -542,7 +560,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(28, "fuseboxEnabledRelease"); + markFlagAsAccessed(29, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -560,7 +578,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(29, "initEagerTurboModulesOnNativeModulesQueueAndroid"); + markFlagAsAccessed(30, "initEagerTurboModulesOnNativeModulesQueueAndroid"); flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid(); initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue; @@ -578,7 +596,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(30, "lazyAnimationCallbacks"); + markFlagAsAccessed(31, "lazyAnimationCallbacks"); flagValue = currentProvider_->lazyAnimationCallbacks(); lazyAnimationCallbacks_ = flagValue; @@ -596,7 +614,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(31, "loadVectorDrawablesOnImages"); + markFlagAsAccessed(32, "loadVectorDrawablesOnImages"); flagValue = currentProvider_->loadVectorDrawablesOnImages(); loadVectorDrawablesOnImages_ = flagValue; @@ -614,7 +632,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(32, "setAndroidLayoutDirection"); + markFlagAsAccessed(33, "setAndroidLayoutDirection"); flagValue = currentProvider_->setAndroidLayoutDirection(); setAndroidLayoutDirection_ = flagValue; @@ -632,7 +650,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(33, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(34, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -650,7 +668,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(34, "useFabricInterop"); + markFlagAsAccessed(35, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -668,7 +686,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(35, "useImmediateExecutorInAndroidBridgeless"); + markFlagAsAccessed(36, "useImmediateExecutorInAndroidBridgeless"); flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless(); useImmediateExecutorInAndroidBridgeless_ = flagValue; @@ -686,7 +704,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(36, "useModernRuntimeScheduler"); + markFlagAsAccessed(37, "useModernRuntimeScheduler"); flagValue = currentProvider_->useModernRuntimeScheduler(); useModernRuntimeScheduler_ = flagValue; @@ -704,7 +722,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(37, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(38, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -722,7 +740,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(38, "useNewReactImageViewBackgroundDrawing"); + markFlagAsAccessed(39, "useNewReactImageViewBackgroundDrawing"); flagValue = currentProvider_->useNewReactImageViewBackgroundDrawing(); useNewReactImageViewBackgroundDrawing_ = flagValue; @@ -740,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimisedViewPreallocationOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(39, "useOptimisedViewPreallocationOnAndroid"); + markFlagAsAccessed(40, "useOptimisedViewPreallocationOnAndroid"); flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid(); useOptimisedViewPreallocationOnAndroid_ = flagValue; @@ -758,7 +776,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(40, "useRuntimeShadowNodeReferenceUpdate"); + markFlagAsAccessed(41, "useRuntimeShadowNodeReferenceUpdate"); flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate(); useRuntimeShadowNodeReferenceUpdate_ = flagValue; @@ -776,7 +794,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(41, "useRuntimeShadowNodeReferenceUpdateOnLayout"); + markFlagAsAccessed(42, "useRuntimeShadowNodeReferenceUpdateOnLayout"); flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdateOnLayout(); useRuntimeShadowNodeReferenceUpdateOnLayout_ = flagValue; @@ -794,7 +812,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(42, "useStateAlignmentMechanism"); + markFlagAsAccessed(43, "useStateAlignmentMechanism"); flagValue = currentProvider_->useStateAlignmentMechanism(); useStateAlignmentMechanism_ = flagValue; @@ -812,7 +830,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(43, "useTurboModuleInterop"); + markFlagAsAccessed(44, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index cefb8412425..66ce9f76fde 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<<6432ff6056c15e06c9791e629be8aa74>> + * @generated SignedSource<<3d703d706bd75f37a4d1af33be80c1ef>> */ /** @@ -45,6 +45,7 @@ class ReactNativeFeatureFlagsAccessor { bool enableFabricLogs(); bool enableFabricRendererExclusively(); bool enableGranularShadowTreeStateReconciliation(); + bool enableLayoutAnimationsOnIOS(); bool enableLongTaskAPI(); bool enableMicrotasks(); bool enablePropsUpdateReconciliationAndroid(); @@ -85,7 +86,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 44> accessedFeatureFlags_; + std::array, 45> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> allowRecursiveCommitsWithSynchronousMountOnAndroid_; @@ -101,6 +102,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enableFabricLogs_; std::atomic> enableFabricRendererExclusively_; std::atomic> enableGranularShadowTreeStateReconciliation_; + std::atomic> enableLayoutAnimationsOnIOS_; std::atomic> enableLongTaskAPI_; std::atomic> enableMicrotasks_; std::atomic> enablePropsUpdateReconciliationAndroid_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index f3cee3a7826..7b4170db11c 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<<88919d5889d0c1a03e0dcdbdcf7adddf>> + * @generated SignedSource<<42b958c53ce709e54864e604135633a5>> */ /** @@ -83,6 +83,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } + bool enableLayoutAnimationsOnIOS() override { + return true; + } + bool enableLongTaskAPI() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 753405728cc..3185bc21352 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<<4324b1bb52eeb7d73b455abd3758bd0b>> + * @generated SignedSource<> */ /** @@ -39,6 +39,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool enableFabricLogs() = 0; virtual bool enableFabricRendererExclusively() = 0; virtual bool enableGranularShadowTreeStateReconciliation() = 0; + virtual bool enableLayoutAnimationsOnIOS() = 0; virtual bool enableLongTaskAPI() = 0; virtual bool enableMicrotasks() = 0; virtual bool enablePropsUpdateReconciliationAndroid() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 2bfafdfd300..6d861939a6d 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<<82f5464427c8411040c595775767a14c>> + * @generated SignedSource<<79105bae18d1d43c3d425ddc9e7eb56d>> */ /** @@ -107,6 +107,11 @@ bool NativeReactNativeFeatureFlags::enableGranularShadowTreeStateReconciliation( return ReactNativeFeatureFlags::enableGranularShadowTreeStateReconciliation(); } +bool NativeReactNativeFeatureFlags::enableLayoutAnimationsOnIOS( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS(); +} + bool NativeReactNativeFeatureFlags::enableLongTaskAPI( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::enableLongTaskAPI(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 1a986c4d857..bf9cdb6ace0 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -63,6 +63,8 @@ class NativeReactNativeFeatureFlags bool enableGranularShadowTreeStateReconciliation(jsi::Runtime& runtime); + bool enableLayoutAnimationsOnIOS(jsi::Runtime& runtime); + bool enableLongTaskAPI(jsi::Runtime& runtime); bool enableMicrotasks(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 011db86349e..bfa2e41d5c8 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -101,6 +101,11 @@ const definitions: FeatureFlagDefinitions = { description: 'When enabled, the renderer would only fail commits when they propagate state and the last commit that updated state changed before committing.', }, + enableLayoutAnimationsOnIOS: { + defaultValue: true, + description: + 'When enabled, LayoutAnimations API will animate state changes on iOS.', + }, enableLongTaskAPI: { defaultValue: false, description: diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 72a708f1e8a..c6545f9e203 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<<4ec8afb16cae6c04f166b0c28a906aff>> + * @generated SignedSource<<3c32ce3847859db45d2e8bafb3cc31a1>> * @flow strict-local */ @@ -60,6 +60,7 @@ export type ReactNativeFeatureFlags = { enableFabricLogs: Getter, enableFabricRendererExclusively: Getter, enableGranularShadowTreeStateReconciliation: Getter, + enableLayoutAnimationsOnIOS: Getter, enableLongTaskAPI: Getter, enableMicrotasks: Getter, enablePropsUpdateReconciliationAndroid: Getter, @@ -218,6 +219,10 @@ export const enableFabricRendererExclusively: Getter = createNativeFlag * When enabled, the renderer would only fail commits when they propagate state and the last commit that updated state changed before committing. */ export const enableGranularShadowTreeStateReconciliation: Getter = createNativeFlagGetter('enableGranularShadowTreeStateReconciliation', false); +/** + * When enabled, LayoutAnimations API will animate state changes on iOS. + */ +export const enableLayoutAnimationsOnIOS: Getter = createNativeFlagGetter('enableLayoutAnimationsOnIOS', true); /** * Enables the reporting of long tasks through `PerformanceObserver`. Only works if the event loop is enabled. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index af595740c6e..44271b26a35 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<<0795b225c6596461df69e979356a580d>> + * @generated SignedSource<<1f1710a12f6980b23bb6c0ece0060b59>> * @flow strict-local */ @@ -37,6 +37,7 @@ export interface Spec extends TurboModule { +enableFabricLogs?: () => boolean; +enableFabricRendererExclusively?: () => boolean; +enableGranularShadowTreeStateReconciliation?: () => boolean; + +enableLayoutAnimationsOnIOS?: () => boolean; +enableLongTaskAPI?: () => boolean; +enableMicrotasks?: () => boolean; +enablePropsUpdateReconciliationAndroid?: () => boolean;