Flip cxxNativeAnimatedEnabled featureflag default to true (#57204)

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

## Changelog:

[General] [Changed] - Flip cxxNativeAnimatedEnabled featureflag default to true

Reviewed By: javache

Differential Revision: D108323433

fbshipit-source-id: 7f8157013bd7369ef520348db8b3f2eaf19a5e35
This commit is contained in:
Zeya Peng authored and meta-codesync[bot] committed 2026-06-16 11:18:24 -07:00
1 parent 723908a759
commit fc7dc741d2
5 files changed
+25 -14

No files matched your search

@@ -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<<98ed9f6f027f919cd31cd1e890750684>>
* @generated SignedSource<<0dcc15b419f6805bdbeec4727ad94761>>
*/
/**
@@ -27,7 +27,7 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun cdpInteractionMetricsEnabled(): Boolean = false
override fun cxxNativeAnimatedEnabled(): Boolean = false
override fun cxxNativeAnimatedEnabled(): Boolean = true
override fun defaultTextToOverflowHidden(): Boolean = 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<<94d2315cb9bfc2684e18770eff3a1cf6>>
* @generated SignedSource<<613be235a200f15ac2ec48d1f5d87053>>
*/
/**
@@ -36,7 +36,7 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
}
bool cxxNativeAnimatedEnabled() override {
return false;
return true;
}
bool defaultTextToOverflowHidden() override {
@@ -72,7 +72,7 @@ const definitions: FeatureFlagDefinitions = {
ossReleaseStage: 'none',
},
cxxNativeAnimatedEnabled: {
defaultValue: false,
defaultValue: true,
metadata: {
dateAdded: '2025-03-14',
description:
@@ -71,6 +71,21 @@ let globalEventEmitterAnimationFinishedListener: ?EventSubscription = null;
const shouldSignalBatch: boolean =
ReactNativeFeatureFlags.cxxNativeAnimatedEnabled();
// Schedules `API.flushQueue` after the current batch, replacing any pending
// flush. On device `setImmediate` is a microtask; under jest's fake timers it's
// a fake-timer entry that only `runAllTimers` drains — not `await` or
// `advanceTimersByTime` — so the deferred flush wouldn't run before a test's
// assertions. Flush synchronously in tests instead.
function scheduleQueueFlush(): void {
clearImmediate(flushQueueImmediate);
if (process.env.NODE_ENV === 'test') {
// TODO: T275950736 - remove this path
API.flushQueue();
} else {
flushQueueImmediate = setImmediate(API.flushQueue);
}
}
function createNativeOperations(): NonNullable<typeof NativeAnimatedModule> {
const methodNames = [
'createAnimatedNode', // 1
@@ -116,8 +131,7 @@ function createNativeOperations(): NonNullable<typeof NativeAnimatedModule> {
// details, see `NativeAnimatedModule.queueAndExecuteBatchedOperations`.
singleOpQueue.push(operationID, ...args);
if (shouldSignalBatch) {
clearImmediate(flushQueueImmediate);
flushQueueImmediate = setImmediate(API.flushQueue);
scheduleQueueFlush();
}
};
}
@@ -137,8 +151,7 @@ function createNativeOperations(): NonNullable<typeof NativeAnimatedModule> {
} else if (shouldSignalBatch) {
// $FlowExpectedError[incompatible-call] - Dynamism.
queue.push(() => method(...args));
clearImmediate(flushQueueImmediate);
flushQueueImmediate = setImmediate(API.flushQueue);
scheduleQueueFlush();
} else {
// $FlowExpectedError[incompatible-call] - Dynamism.
method(...args);
@@ -190,9 +203,7 @@ const API = {
invariant(NativeAnimatedModule, 'Native animated module is not available');
if (ReactNativeFeatureFlags.animatedShouldDebounceQueueFlush()) {
const prevImmediate = flushQueueImmediate;
clearImmediate(prevImmediate);
flushQueueImmediate = setImmediate(API.flushQueue);
scheduleQueueFlush();
} else {
API.flushQueue();
}
@@ -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<<b3888619bcbd9d40b0e1740a864a07cf>>
* @generated SignedSource<<1f64eab49a337feb5c9b1b41faf92730>>
* @flow strict
* @noformat
*/
@@ -221,7 +221,7 @@ export const cdpInteractionMetricsEnabled: Getter<boolean> = createNativeFlagGet
/**
* Use a C++ implementation of Native Animated instead of the platform implementation.
*/
export const cxxNativeAnimatedEnabled: Getter<boolean> = createNativeFlagGetter('cxxNativeAnimatedEnabled', false);
export const cxxNativeAnimatedEnabled: Getter<boolean> = createNativeFlagGetter('cxxNativeAnimatedEnabled', true);
/**
* When enabled, sets the default overflow style for Text components to hidden instead of visible.
*/