From 594ac6b59257778254b4dafc28317ba770913c4c Mon Sep 17 00:00:00 2001 From: Zeya Peng Date: Thu, 12 Feb 2026 08:37:34 -0800 Subject: [PATCH] Create featureflag viewTransitionEnabled Summary: Changelog: [General] [Added] - Create featureflag viewTransitionEnabled This diff adds a new React Native feature flag `viewTransitionEnabled` to gate the View Transition API feature. The View Transition API enables animated transitions between views, providing a smooth visual experience when navigating between screens or updating UI elements. This flag allows the feature to be gradually rolled out and tested before full enablement. The flag is added across all platform layers: - JavaScript (ReactNativeFeatureFlags.js, NativeReactNativeFeatureFlags.js) - Android Kotlin (ReactNativeFeatureFlags.kt, provider, accessor, defaults) - C++/JNI (ReactNativeFeatureFlags.cpp/h, JReactNativeFeatureFlagsCxxInterop) - Feature flag config (ReactNativeFeatureFlags.config.js) Default value is `false` to ensure the feature is opt-in during experimentation. Reviewed By: NickGerleman Differential Revision: D92713074 --- .../featureflags/ReactNativeFeatureFlags.kt | 8 ++++++- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +++++++++- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +++- .../ReactNativeFeatureFlagsDefaults.kt | 4 +++- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 ++++++++++- .../ReactNativeFeatureFlagsProvider.kt | 4 +++- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +++++++++++++- .../JReactNativeFeatureFlagsCxxInterop.h | 5 ++++- .../featureflags/ReactNativeFeatureFlags.cpp | 6 ++++- .../featureflags/ReactNativeFeatureFlags.h | 7 +++++- .../ReactNativeFeatureFlagsAccessor.cpp | 22 +++++++++++++++++-- .../ReactNativeFeatureFlagsAccessor.h | 6 +++-- .../ReactNativeFeatureFlagsDefaults.h | 6 ++++- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +++++++++- .../ReactNativeFeatureFlagsProvider.h | 3 ++- .../NativeReactNativeFeatureFlags.cpp | 7 +++++- .../NativeReactNativeFeatureFlags.h | 4 +++- .../ReactNativeFeatureFlags.config.js | 11 ++++++++++ .../featureflags/ReactNativeFeatureFlags.js | 7 +++++- .../specs/NativeReactNativeFeatureFlags.js | 3 ++- 20 files changed, 138 insertions(+), 21 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 74b86e799810..5f5a9275d654 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<<049cc0a1aa5ab53ad2ab11c359f49827>> + * @generated SignedSource<<4549fc9a4f431306b7dc70ef3903b8fd>> */ /** @@ -504,6 +504,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun viewCullingOutsetRatio(): Double = accessor.viewCullingOutsetRatio() + /** + * Enable the View Transition API for animating transitions between views. + */ + @JvmStatic + public fun viewTransitionEnabled(): Boolean = accessor.viewTransitionEnabled() + /** * Initial prerender ratio for VirtualView. */ 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 765b88debb10..659be742cc70 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<<6d1fc28e24576c1a63dceaa8c974cc1f>> + * @generated SignedSource<<0db6bbb173a96ab07c80a3fbe43671b3>> */ /** @@ -99,6 +99,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var useTurboModuleInteropCache: Boolean? = null private var useTurboModulesCache: Boolean? = null private var viewCullingOutsetRatioCache: Double? = null + private var viewTransitionEnabledCache: Boolean? = null private var virtualViewPrerenderRatioCache: Double? = null override fun commonTestFlag(): Boolean { @@ -812,6 +813,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun viewTransitionEnabled(): Boolean { + var cached = viewTransitionEnabledCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.viewTransitionEnabled() + viewTransitionEnabledCache = cached + } + return cached + } + override fun virtualViewPrerenderRatio(): Double { var cached = virtualViewPrerenderRatioCache 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 f25107cc6feb..d0f40e261e91 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<<26410c9e406969734991456f635be4af>> + * @generated SignedSource<> */ /** @@ -186,6 +186,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun viewCullingOutsetRatio(): Double + @DoNotStrip @JvmStatic public external fun viewTransitionEnabled(): Boolean + @DoNotStrip @JvmStatic public external fun virtualViewPrerenderRatio(): Double @DoNotStrip @JvmStatic public external fun override(provider: Any) 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 2bb5cab976f7..f344b30a174c 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<<102ac98a8c3f2c1a2150c223a099cf72>> */ /** @@ -181,5 +181,7 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun viewCullingOutsetRatio(): Double = 0.0 + override fun viewTransitionEnabled(): Boolean = false + override fun virtualViewPrerenderRatio(): Double = 5.0 } 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 ffe01d0c090f..f3cbafc8ec53 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<> */ /** @@ -103,6 +103,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var useTurboModuleInteropCache: Boolean? = null private var useTurboModulesCache: Boolean? = null private var viewCullingOutsetRatioCache: Double? = null + private var viewTransitionEnabledCache: Boolean? = null private var virtualViewPrerenderRatioCache: Double? = null override fun commonTestFlag(): Boolean { @@ -895,6 +896,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } + override fun viewTransitionEnabled(): Boolean { + var cached = viewTransitionEnabledCache + if (cached == null) { + cached = currentProvider.viewTransitionEnabled() + accessedFeatureFlags.add("viewTransitionEnabled") + viewTransitionEnabledCache = cached + } + return cached + } + override fun virtualViewPrerenderRatio(): Double { var cached = virtualViewPrerenderRatioCache 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 cb9050023baa..3abb8b0778c4 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<<50f2ea7e87e80a247b6c6ce8e2afd0ec>> */ /** @@ -181,5 +181,7 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun viewCullingOutsetRatio(): Double + @DoNotStrip public fun viewTransitionEnabled(): Boolean + @DoNotStrip public fun virtualViewPrerenderRatio(): Double } 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 a861c047e82b..ccbb1be9cdf9 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<<698b775afb6ad9295c181ea3d12118d3>> + * @generated SignedSource<<0460a8b25bfb176e47fb12dc091b1961>> */ /** @@ -513,6 +513,12 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } + bool viewTransitionEnabled() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("viewTransitionEnabled"); + return method(javaProvider_); + } + double virtualViewPrerenderRatio() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("virtualViewPrerenderRatio"); @@ -918,6 +924,11 @@ double JReactNativeFeatureFlagsCxxInterop::viewCullingOutsetRatio( return ReactNativeFeatureFlags::viewCullingOutsetRatio(); } +bool JReactNativeFeatureFlagsCxxInterop::viewTransitionEnabled( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::viewTransitionEnabled(); +} + double JReactNativeFeatureFlagsCxxInterop::virtualViewPrerenderRatio( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::virtualViewPrerenderRatio(); @@ -1191,6 +1202,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "viewCullingOutsetRatio", JReactNativeFeatureFlagsCxxInterop::viewCullingOutsetRatio), + makeNativeMethod( + "viewTransitionEnabled", + JReactNativeFeatureFlagsCxxInterop::viewTransitionEnabled), makeNativeMethod( "virtualViewPrerenderRatio", JReactNativeFeatureFlagsCxxInterop::virtualViewPrerenderRatio), 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 260c4f4ea049..37ef763ce1ac 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<<7be3a44c6ffc2c9d390f66902ef80d30>> + * @generated SignedSource<<88f40502abd13f8f57015429dd087519>> */ /** @@ -267,6 +267,9 @@ class JReactNativeFeatureFlagsCxxInterop static double viewCullingOutsetRatio( facebook::jni::alias_ref); + static bool viewTransitionEnabled( + facebook::jni::alias_ref); + static double virtualViewPrerenderRatio( 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 8c2a06e0224d..b48a7e48ba0f 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<<88b22330e8486a820eb42b59fb7279e4>> + * @generated SignedSource<> */ /** @@ -342,6 +342,10 @@ double ReactNativeFeatureFlags::viewCullingOutsetRatio() { return getAccessor().viewCullingOutsetRatio(); } +bool ReactNativeFeatureFlags::viewTransitionEnabled() { + return getAccessor().viewTransitionEnabled(); +} + double ReactNativeFeatureFlags::virtualViewPrerenderRatio() { return getAccessor().virtualViewPrerenderRatio(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 902ac9787e74..f42f4d26f23f 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<> + * @generated SignedSource<<51a4817654c04c979a33f44e42312dd5>> */ /** @@ -434,6 +434,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static double viewCullingOutsetRatio(); + /** + * Enable the View Transition API for animating transitions between views. + */ + RN_EXPORT static bool viewTransitionEnabled(); + /** * Initial prerender ratio for VirtualView. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 5b23711102e9..7c2cc35cb5a0 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<<65ca2267e4bd81dcc21f35bbfc880ba8>> + * @generated SignedSource<> */ /** @@ -1451,6 +1451,24 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::viewTransitionEnabled() { + auto flagValue = viewTransitionEnabled_.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(79, "viewTransitionEnabled"); + + flagValue = currentProvider_->viewTransitionEnabled(); + viewTransitionEnabled_ = flagValue; + } + + return flagValue.value(); +} + double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() { auto flagValue = virtualViewPrerenderRatio_.load(); @@ -1460,7 +1478,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(79, "virtualViewPrerenderRatio"); + markFlagAsAccessed(80, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 1c89cab6d623..4f5b133375d0 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<<1aed21628664154ea7f66f15b1f760c2>> + * @generated SignedSource<<545708e361d01a42b3aef51ba71d646d>> */ /** @@ -111,6 +111,7 @@ class ReactNativeFeatureFlagsAccessor { bool useTurboModuleInterop(); bool useTurboModules(); double viewCullingOutsetRatio(); + bool viewTransitionEnabled(); double virtualViewPrerenderRatio(); void override(std::unique_ptr provider); @@ -123,7 +124,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 80> accessedFeatureFlags_; + std::array, 81> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -204,6 +205,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> useTurboModuleInterop_; std::atomic> useTurboModules_; std::atomic> viewCullingOutsetRatio_; + std::atomic> viewTransitionEnabled_; std::atomic> virtualViewPrerenderRatio_; }; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 43e9c6556b1c..13360f4656a9 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<777478fa4d8beba140a30edb68cc34d9>> */ /** @@ -343,6 +343,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return 0.0; } + bool viewTransitionEnabled() override { + return false; + } + double virtualViewPrerenderRatio() override { return 5.0; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 293067a1e2a4..61a4ec167f97 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<55247339124401e105501f3d9d3b5b92>> */ /** @@ -756,6 +756,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::viewCullingOutsetRatio(); } + bool viewTransitionEnabled() override { + auto value = values_["viewTransitionEnabled"]; + if (!value.isNull()) { + return value.getBool(); + } + + return ReactNativeFeatureFlagsDefaults::viewTransitionEnabled(); + } + double virtualViewPrerenderRatio() override { auto value = values_["virtualViewPrerenderRatio"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 7ec722a2d328..f86dab964cf5 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<<0308cb63246c4576859383adc3cc9593>> + * @generated SignedSource<<05c9d90f759f2a6116219a1e61eeee82>> */ /** @@ -104,6 +104,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool useTurboModuleInterop() = 0; virtual bool useTurboModules() = 0; virtual double viewCullingOutsetRatio() = 0; + virtual bool viewTransitionEnabled() = 0; virtual double virtualViewPrerenderRatio() = 0; }; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 4a08c4efb5ef..e6cc9a06f375 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<> + * @generated SignedSource<<39413a3a4416946e3ade57074664492d>> */ /** @@ -439,6 +439,11 @@ double NativeReactNativeFeatureFlags::viewCullingOutsetRatio( return ReactNativeFeatureFlags::viewCullingOutsetRatio(); } +bool NativeReactNativeFeatureFlags::viewTransitionEnabled( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::viewTransitionEnabled(); +} + double NativeReactNativeFeatureFlags::virtualViewPrerenderRatio( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::virtualViewPrerenderRatio(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 70e9f241ad60..fc15199230e4 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<<1fa17a0bb7f29a34541d362d1ecdc788>> + * @generated SignedSource<<6ed865d409cf5df84607ffa599e46fe7>> */ /** @@ -194,6 +194,8 @@ class NativeReactNativeFeatureFlags double viewCullingOutsetRatio(jsi::Runtime& runtime); + bool viewTransitionEnabled(jsi::Runtime& runtime); + double virtualViewPrerenderRatio(jsi::Runtime& runtime); }; diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 7ce10ba669ed..6de466798201 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -890,6 +890,17 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, + viewTransitionEnabled: { + defaultValue: false, + metadata: { + dateAdded: '2026-02-09', + description: + 'Enable the View Transition API for animating transitions between views.', + expectedReleaseValue: true, + purpose: 'experimentation', + }, + ossReleaseStage: 'none', + }, virtualViewPrerenderRatio: { defaultValue: 5, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 95ab5702bf9a..542bde64dad8 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<> * @flow strict * @noformat */ @@ -126,6 +126,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ useTurboModuleInterop: Getter, useTurboModules: Getter, viewCullingOutsetRatio: Getter, + viewTransitionEnabled: Getter, virtualViewPrerenderRatio: Getter, }>; @@ -509,6 +510,10 @@ export const useTurboModules: Getter = createNativeFlagGetter('useTurbo * Outset the culling context frame with the provided ratio. The culling context frame size will be outset by width * ratio on the left and right, and height * ratio on the top and bottom. */ export const viewCullingOutsetRatio: Getter = createNativeFlagGetter('viewCullingOutsetRatio', 0); +/** + * Enable the View Transition API for animating transitions between views. + */ +export const viewTransitionEnabled: Getter = createNativeFlagGetter('viewTransitionEnabled', false); /** * Initial prerender ratio for VirtualView. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 01ef6a7f3a4e..87718d2a0259 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<> + * @generated SignedSource<<1fe995d928d6ea2770936cdd6e2b8320>> * @flow strict * @noformat */ @@ -104,6 +104,7 @@ export interface Spec extends TurboModule { +useTurboModuleInterop?: () => boolean; +useTurboModules?: () => boolean; +viewCullingOutsetRatio?: () => number; + +viewTransitionEnabled?: () => boolean; +virtualViewPrerenderRatio?: () => number; }