Add a ReactNativeFeatureFlag to enable/disable LayoutAnimations in Android (#46903)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46903

Add a ReactNativeFeatureFlag to enable/disable LayoutAnimations in Android, default false

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D64062268

fbshipit-source-id: 474e191e6a677065681b512a93af74908e8250f5
This commit is contained in:
David Vacca
2024-10-08 15:03:11 -07:00
committed by Facebook GitHub Bot
parent 6202319ed5
commit 4763ef3121
20 changed files with 168 additions and 57 deletions
@@ -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<<7d80322a6a37083c5e52e6914de49ce2>>
* @generated SignedSource<<405d53cd6aba78616b8690c26a0accad>>
*/
/**
@@ -124,6 +124,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableIOSViewClipToPaddingBox(): Boolean = accessor.enableIOSViewClipToPaddingBox()
/**
* When enabled, LayoutAnimations API will animate state changes on Android.
*/
@JvmStatic
public fun enableLayoutAnimationsOnAndroid(): Boolean = accessor.enableLayoutAnimationsOnAndroid()
/**
* When enabled, LayoutAnimations API will animate state changes on iOS.
*/
@@ -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<<761d3e7b100a4f5ee6f8bda71f84918b>>
* @generated SignedSource<<84ee754f916b48a7c55ea94e166510c7>>
*/
/**
@@ -36,6 +36,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var enableFabricRendererExclusivelyCache: Boolean? = null
private var enableGranularShadowTreeStateReconciliationCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
private var enableLongTaskAPICache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
@@ -213,6 +214,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun enableLayoutAnimationsOnAndroid(): Boolean {
var cached = enableLayoutAnimationsOnAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableLayoutAnimationsOnAndroid()
enableLayoutAnimationsOnAndroidCache = cached
}
return cached
}
override fun enableLayoutAnimationsOnIOS(): Boolean {
var cached = enableLayoutAnimationsOnIOSCache
if (cached == null) {
@@ -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<<1ed46e0bf712406c1bf6159e1bca3c15>>
* @generated SignedSource<<eebeaa749dafac5d49d9d6b356f88817>>
*/
/**
@@ -60,6 +60,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun enableIOSViewClipToPaddingBox(): Boolean
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnIOS(): Boolean
@DoNotStrip @JvmStatic public external fun enableLongTaskAPI(): Boolean
@@ -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<<19cf402242ebd8b3a08dfb7c755b801b>>
* @generated SignedSource<<d44c7d51caea5eaa3074217361959b3a>>
*/
/**
@@ -55,6 +55,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enableIOSViewClipToPaddingBox(): Boolean = false
override fun enableLayoutAnimationsOnAndroid(): Boolean = false
override fun enableLayoutAnimationsOnIOS(): Boolean = true
override fun enableLongTaskAPI(): Boolean = false
@@ -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<<a307a1f9b5064547ce32f9519bbf27c4>>
* @generated SignedSource<<4dc2364f5bcd765d7b61dbcab0d9533d>>
*/
/**
@@ -40,6 +40,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var enableFabricRendererExclusivelyCache: Boolean? = null
private var enableGranularShadowTreeStateReconciliationCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
private var enableLongTaskAPICache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
@@ -233,6 +234,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableLayoutAnimationsOnAndroid(): Boolean {
var cached = enableLayoutAnimationsOnAndroidCache
if (cached == null) {
cached = currentProvider.enableLayoutAnimationsOnAndroid()
accessedFeatureFlags.add("enableLayoutAnimationsOnAndroid")
enableLayoutAnimationsOnAndroidCache = cached
}
return cached
}
override fun enableLayoutAnimationsOnIOS(): Boolean {
var cached = enableLayoutAnimationsOnIOSCache
if (cached == null) {
@@ -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<<bda9e94a5fe61a16e7d001ea3acfed0c>>
* @generated SignedSource<<193bb7803261004003d9009b44810c2c>>
*/
/**
@@ -55,6 +55,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enableIOSViewClipToPaddingBox(): Boolean
@DoNotStrip public fun enableLayoutAnimationsOnAndroid(): Boolean
@DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean
@DoNotStrip public fun enableLongTaskAPI(): Boolean
@@ -167,8 +167,10 @@ void FabricUIManagerBinding::startSurfaceWithSurfaceHandler(
surfaceHandler.start();
surfaceHandler.getMountingCoordinator()->setMountingOverrideDelegate(
animationDriver_);
if (ReactNativeFeatureFlags::enableLayoutAnimationsOnAndroid()) {
surfaceHandler.getMountingCoordinator()->setMountingOverrideDelegate(
animationDriver_);
}
{
std::unique_lock lock(surfaceHandlerRegistryMutex_);
@@ -214,8 +216,10 @@ void FabricUIManagerBinding::startSurface(
surfaceHandler.start();
surfaceHandler.getMountingCoordinator()->setMountingOverrideDelegate(
animationDriver_);
if (ReactNativeFeatureFlags::enableLayoutAnimationsOnAndroid()) {
surfaceHandler.getMountingCoordinator()->setMountingOverrideDelegate(
animationDriver_);
}
{
SystraceSection s2("FabricUIManagerBinding::startSurface::surfaceId::lock");
@@ -284,8 +288,10 @@ void FabricUIManagerBinding::startSurfaceWithConstraints(
surfaceHandler.start();
surfaceHandler.getMountingCoordinator()->setMountingOverrideDelegate(
animationDriver_);
if (ReactNativeFeatureFlags::enableLayoutAnimationsOnAndroid()) {
surfaceHandler.getMountingCoordinator()->setMountingOverrideDelegate(
animationDriver_);
}
{
SystraceSection s2(
@@ -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<<0ec332b341bc55ba1a0ab75f2ede82f6>>
* @generated SignedSource<<0bb021affcef5162b578ad3f1e45508f>>
*/
/**
@@ -135,6 +135,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool enableLayoutAnimationsOnAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableLayoutAnimationsOnAndroid");
return method(javaProvider_);
}
bool enableLayoutAnimationsOnIOS() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableLayoutAnimationsOnIOS");
@@ -411,6 +417,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableIOSViewClipToPaddingBox(
return ReactNativeFeatureFlags::enableIOSViewClipToPaddingBox();
}
bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableLayoutAnimationsOnAndroid();
}
bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS();
@@ -636,6 +647,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableIOSViewClipToPaddingBox",
JReactNativeFeatureFlagsCxxInterop::enableIOSViewClipToPaddingBox),
makeNativeMethod(
"enableLayoutAnimationsOnAndroid",
JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnAndroid),
makeNativeMethod(
"enableLayoutAnimationsOnIOS",
JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS),
@@ -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<<a0c02cb18082c572be8d584737cea8fa>>
* @generated SignedSource<<fe97369e30d5359ffcd9c8e304dbc121>>
*/
/**
@@ -78,6 +78,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableIOSViewClipToPaddingBox(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableLayoutAnimationsOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableLayoutAnimationsOnIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -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<<2cf7555474bd4808f9f451485da01d1a>>
* @generated SignedSource<<013c1fa01cf029635c04b50f83cc80ef>>
*/
/**
@@ -85,6 +85,10 @@ bool ReactNativeFeatureFlags::enableIOSViewClipToPaddingBox() {
return getAccessor().enableIOSViewClipToPaddingBox();
}
bool ReactNativeFeatureFlags::enableLayoutAnimationsOnAndroid() {
return getAccessor().enableLayoutAnimationsOnAndroid();
}
bool ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS() {
return getAccessor().enableLayoutAnimationsOnIOS();
}
@@ -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<<c7dceca0eab479fd67c8e8e25656b1bf>>
* @generated SignedSource<<3bbe3eb333030be7f32c0965c9db4a5c>>
*/
/**
@@ -117,6 +117,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableIOSViewClipToPaddingBox();
/**
* When enabled, LayoutAnimations API will animate state changes on Android.
*/
RN_EXPORT static bool enableLayoutAnimationsOnAndroid();
/**
* When enabled, LayoutAnimations API will animate state changes on iOS.
*/
@@ -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<<543c299c20c21d2d2e353c30645f94c7>>
* @generated SignedSource<<087de432d750fea45c0c564e626ce1d9>>
*/
/**
@@ -317,6 +317,24 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSViewClipToPaddingBox() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnAndroid() {
auto flagValue = enableLayoutAnimationsOnAndroid_.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, "enableLayoutAnimationsOnAndroid");
flagValue = currentProvider_->enableLayoutAnimationsOnAndroid();
enableLayoutAnimationsOnAndroid_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnIOS() {
auto flagValue = enableLayoutAnimationsOnIOS_.load();
@@ -326,7 +344,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(16, "enableLayoutAnimationsOnIOS");
markFlagAsAccessed(17, "enableLayoutAnimationsOnIOS");
flagValue = currentProvider_->enableLayoutAnimationsOnIOS();
enableLayoutAnimationsOnIOS_ = flagValue;
@@ -344,7 +362,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(17, "enableLongTaskAPI");
markFlagAsAccessed(18, "enableLongTaskAPI");
flagValue = currentProvider_->enableLongTaskAPI();
enableLongTaskAPI_ = flagValue;
@@ -362,7 +380,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(18, "enableMicrotasks");
markFlagAsAccessed(19, "enableMicrotasks");
flagValue = currentProvider_->enableMicrotasks();
enableMicrotasks_ = flagValue;
@@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePreciseSchedulingForPremountItemsOnA
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(19, "enablePreciseSchedulingForPremountItemsOnAndroid");
markFlagAsAccessed(20, "enablePreciseSchedulingForPremountItemsOnAndroid");
flagValue = currentProvider_->enablePreciseSchedulingForPremountItemsOnAndroid();
enablePreciseSchedulingForPremountItemsOnAndroid_ = flagValue;
@@ -398,7 +416,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(20, "enablePropsUpdateReconciliationAndroid");
markFlagAsAccessed(21, "enablePropsUpdateReconciliationAndroid");
flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid();
enablePropsUpdateReconciliationAndroid_ = flagValue;
@@ -416,7 +434,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(21, "enableReportEventPaintTime");
markFlagAsAccessed(22, "enableReportEventPaintTime");
flagValue = currentProvider_->enableReportEventPaintTime();
enableReportEventPaintTime_ = flagValue;
@@ -434,7 +452,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(22, "enableSynchronousStateUpdates");
markFlagAsAccessed(23, "enableSynchronousStateUpdates");
flagValue = currentProvider_->enableSynchronousStateUpdates();
enableSynchronousStateUpdates_ = flagValue;
@@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::enableTextPreallocationOptimisation() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(23, "enableTextPreallocationOptimisation");
markFlagAsAccessed(24, "enableTextPreallocationOptimisation");
flagValue = currentProvider_->enableTextPreallocationOptimisation();
enableTextPreallocationOptimisation_ = flagValue;
@@ -470,7 +488,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(24, "enableUIConsistency");
markFlagAsAccessed(25, "enableUIConsistency");
flagValue = currentProvider_->enableUIConsistency();
enableUIConsistency_ = flagValue;
@@ -488,7 +506,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(25, "enableViewRecycling");
markFlagAsAccessed(26, "enableViewRecycling");
flagValue = currentProvider_->enableViewRecycling();
enableViewRecycling_ = flagValue;
@@ -506,7 +524,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(26, "excludeYogaFromRawProps");
markFlagAsAccessed(27, "excludeYogaFromRawProps");
flagValue = currentProvider_->excludeYogaFromRawProps();
excludeYogaFromRawProps_ = flagValue;
@@ -524,7 +542,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(27, "fetchImagesInViewPreallocation");
markFlagAsAccessed(28, "fetchImagesInViewPreallocation");
flagValue = currentProvider_->fetchImagesInViewPreallocation();
fetchImagesInViewPreallocation_ = flagValue;
@@ -542,7 +560,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(28, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
markFlagAsAccessed(29, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMountingCoordinatorReportedPendingTrans
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(29, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
markFlagAsAccessed(30, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
flagValue = currentProvider_->fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
fixMountingCoordinatorReportedPendingTransactionsOnAndroid_ = flagValue;
@@ -578,7 +596,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(30, "forceBatchingMountItemsOnAndroid");
markFlagAsAccessed(31, "forceBatchingMountItemsOnAndroid");
flagValue = currentProvider_->forceBatchingMountItemsOnAndroid();
forceBatchingMountItemsOnAndroid_ = flagValue;
@@ -596,7 +614,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(31, "fuseboxEnabledDebug");
markFlagAsAccessed(32, "fuseboxEnabledDebug");
flagValue = currentProvider_->fuseboxEnabledDebug();
fuseboxEnabledDebug_ = flagValue;
@@ -614,7 +632,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(32, "fuseboxEnabledRelease");
markFlagAsAccessed(33, "fuseboxEnabledRelease");
flagValue = currentProvider_->fuseboxEnabledRelease();
fuseboxEnabledRelease_ = flagValue;
@@ -632,7 +650,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(33, "initEagerTurboModulesOnNativeModulesQueueAndroid");
markFlagAsAccessed(34, "initEagerTurboModulesOnNativeModulesQueueAndroid");
flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid();
initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue;
@@ -650,7 +668,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(34, "lazyAnimationCallbacks");
markFlagAsAccessed(35, "lazyAnimationCallbacks");
flagValue = currentProvider_->lazyAnimationCallbacks();
lazyAnimationCallbacks_ = flagValue;
@@ -668,7 +686,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(35, "loadVectorDrawablesOnImages");
markFlagAsAccessed(36, "loadVectorDrawablesOnImages");
flagValue = currentProvider_->loadVectorDrawablesOnImages();
loadVectorDrawablesOnImages_ = flagValue;
@@ -686,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::removeNestedCallsToDispatchMountItemsOnAnd
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(36, "removeNestedCallsToDispatchMountItemsOnAndroid");
markFlagAsAccessed(37, "removeNestedCallsToDispatchMountItemsOnAndroid");
flagValue = currentProvider_->removeNestedCallsToDispatchMountItemsOnAndroid();
removeNestedCallsToDispatchMountItemsOnAndroid_ = flagValue;
@@ -704,7 +722,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(37, "setAndroidLayoutDirection");
markFlagAsAccessed(38, "setAndroidLayoutDirection");
flagValue = currentProvider_->setAndroidLayoutDirection();
setAndroidLayoutDirection_ = flagValue;
@@ -722,7 +740,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(38, "traceTurboModulePromiseRejectionsOnAndroid");
markFlagAsAccessed(39, "traceTurboModulePromiseRejectionsOnAndroid");
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
@@ -740,7 +758,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(39, "useFabricInterop");
markFlagAsAccessed(40, "useFabricInterop");
flagValue = currentProvider_->useFabricInterop();
useFabricInterop_ = flagValue;
@@ -758,7 +776,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(40, "useImmediateExecutorInAndroidBridgeless");
markFlagAsAccessed(41, "useImmediateExecutorInAndroidBridgeless");
flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless();
useImmediateExecutorInAndroidBridgeless_ = flagValue;
@@ -776,7 +794,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(41, "useModernRuntimeScheduler");
markFlagAsAccessed(42, "useModernRuntimeScheduler");
flagValue = currentProvider_->useModernRuntimeScheduler();
useModernRuntimeScheduler_ = flagValue;
@@ -794,7 +812,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(42, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(43, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -812,7 +830,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(43, "useOptimisedViewPreallocationOnAndroid");
markFlagAsAccessed(44, "useOptimisedViewPreallocationOnAndroid");
flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid();
useOptimisedViewPreallocationOnAndroid_ = flagValue;
@@ -830,7 +848,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(44, "useOptimizedEventBatchingOnAndroid");
markFlagAsAccessed(45, "useOptimizedEventBatchingOnAndroid");
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
@@ -848,7 +866,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(45, "useRuntimeShadowNodeReferenceUpdate");
markFlagAsAccessed(46, "useRuntimeShadowNodeReferenceUpdate");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
@@ -866,7 +884,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(46, "useTurboModuleInterop");
markFlagAsAccessed(47, "useTurboModuleInterop");
flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
@@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(47, "useTurboModules");
markFlagAsAccessed(48, "useTurboModules");
flagValue = currentProvider_->useTurboModules();
useTurboModules_ = flagValue;
@@ -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<<ca86e53cf26c0103d12e8800fd427845>>
* @generated SignedSource<<447de2c56cd16e313210f14d0ee3e9e9>>
*/
/**
@@ -47,6 +47,7 @@ class ReactNativeFeatureFlagsAccessor {
bool enableFabricRendererExclusively();
bool enableGranularShadowTreeStateReconciliation();
bool enableIOSViewClipToPaddingBox();
bool enableLayoutAnimationsOnAndroid();
bool enableLayoutAnimationsOnIOS();
bool enableLongTaskAPI();
bool enableMicrotasks();
@@ -89,7 +90,7 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 48> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 49> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> allowRecursiveCommitsWithSynchronousMountOnAndroid_;
@@ -107,6 +108,7 @@ class ReactNativeFeatureFlagsAccessor {
std::atomic<std::optional<bool>> enableFabricRendererExclusively_;
std::atomic<std::optional<bool>> enableGranularShadowTreeStateReconciliation_;
std::atomic<std::optional<bool>> enableIOSViewClipToPaddingBox_;
std::atomic<std::optional<bool>> enableLayoutAnimationsOnAndroid_;
std::atomic<std::optional<bool>> enableLayoutAnimationsOnIOS_;
std::atomic<std::optional<bool>> enableLongTaskAPI_;
std::atomic<std::optional<bool>> enableMicrotasks_;
@@ -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<<797150005bc7d5e76d4d004b54f8942b>>
* @generated SignedSource<<b32553b00b1b1b81d4d0fdc89b05da38>>
*/
/**
@@ -91,6 +91,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool enableLayoutAnimationsOnAndroid() override {
return false;
}
bool enableLayoutAnimationsOnIOS() override {
return true;
}
@@ -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<<49caf46d37d3321cd7c8a51385d15fc8>>
* @generated SignedSource<<7cc1ba6a89d06d8cabf1271a725e7379>>
*/
/**
@@ -41,6 +41,7 @@ class ReactNativeFeatureFlagsProvider {
virtual bool enableFabricRendererExclusively() = 0;
virtual bool enableGranularShadowTreeStateReconciliation() = 0;
virtual bool enableIOSViewClipToPaddingBox() = 0;
virtual bool enableLayoutAnimationsOnAndroid() = 0;
virtual bool enableLayoutAnimationsOnIOS() = 0;
virtual bool enableLongTaskAPI() = 0;
virtual bool enableMicrotasks() = 0;
@@ -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<<630740f6b6c7a145658494862c697ce6>>
* @generated SignedSource<<a1350a6f18522255cadc713cfa7fefd7>>
*/
/**
@@ -117,6 +117,11 @@ bool NativeReactNativeFeatureFlags::enableIOSViewClipToPaddingBox(
return ReactNativeFeatureFlags::enableIOSViewClipToPaddingBox();
}
bool NativeReactNativeFeatureFlags::enableLayoutAnimationsOnAndroid(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableLayoutAnimationsOnAndroid();
}
bool NativeReactNativeFeatureFlags::enableLayoutAnimationsOnIOS(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS();
@@ -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<<710fbb44aa7ffbc03d54b29b63aa0a73>>
* @generated SignedSource<<83fc6efe6c6c5c52ffe081b9696919e1>>
*/
/**
@@ -67,6 +67,8 @@ class NativeReactNativeFeatureFlags
bool enableIOSViewClipToPaddingBox(jsi::Runtime& runtime);
bool enableLayoutAnimationsOnAndroid(jsi::Runtime& runtime);
bool enableLayoutAnimationsOnIOS(jsi::Runtime& runtime);
bool enableLongTaskAPI(jsi::Runtime& runtime);
@@ -171,6 +171,14 @@ const definitions: FeatureFlagDefinitions = {
purpose: 'experimentation',
},
},
enableLayoutAnimationsOnAndroid: {
defaultValue: false,
metadata: {
description:
'When enabled, LayoutAnimations API will animate state changes on Android.',
purpose: 'release',
},
},
enableLayoutAnimationsOnIOS: {
defaultValue: true,
metadata: {
@@ -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<<6141605aee700061696d61dc3121862c>>
* @generated SignedSource<<75865f1371182e1ed3bce0f8f367faeb>>
* @flow strict
*/
@@ -66,6 +66,7 @@ export type ReactNativeFeatureFlags = {
enableFabricRendererExclusively: Getter<boolean>,
enableGranularShadowTreeStateReconciliation: Getter<boolean>,
enableIOSViewClipToPaddingBox: Getter<boolean>,
enableLayoutAnimationsOnAndroid: Getter<boolean>,
enableLayoutAnimationsOnIOS: Getter<boolean>,
enableLongTaskAPI: Getter<boolean>,
enableMicrotasks: Getter<boolean>,
@@ -249,6 +250,10 @@ export const enableGranularShadowTreeStateReconciliation: Getter<boolean> = crea
* iOS Views will clip to their padding box vs border box
*/
export const enableIOSViewClipToPaddingBox: Getter<boolean> = createNativeFlagGetter('enableIOSViewClipToPaddingBox', false);
/**
* When enabled, LayoutAnimations API will animate state changes on Android.
*/
export const enableLayoutAnimationsOnAndroid: Getter<boolean> = createNativeFlagGetter('enableLayoutAnimationsOnAndroid', false);
/**
* When enabled, LayoutAnimations API will animate state changes on iOS.
*/
@@ -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<<c948481de027909f00fbbe4e4ea76b9b>>
* @generated SignedSource<<e6477fcd9bf64a5c84496dfb55ae3700>>
* @flow strict
*/
@@ -39,6 +39,7 @@ export interface Spec extends TurboModule {
+enableFabricRendererExclusively?: () => boolean;
+enableGranularShadowTreeStateReconciliation?: () => boolean;
+enableIOSViewClipToPaddingBox?: () => boolean;
+enableLayoutAnimationsOnAndroid?: () => boolean;
+enableLayoutAnimationsOnIOS?: () => boolean;
+enableLongTaskAPI?: () => boolean;
+enableMicrotasks?: () => boolean;