From 6a8c7fb6f1108577c97eeb5703018ece915dcdeb Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Tue, 7 Oct 2025 06:23:34 +0200 Subject: [PATCH] Release `` to Canary (#34712) ## Overview This PR ships the View Transition APIs to `react@canary`: - [``](https://react.dev/reference/react/ViewTransition) - [`addTransitionType`](https://react.dev/reference/react/addTransitionType) This means these APIs are ready for final feedback and prepare for semver stable release. ## What this means Shipping `` and `addTransitionType` to canary means they have gone through extensive testing in production, we are confident in the stability of the APIs, and we are preparing to release it in a future semver stable version. Libraries and frameworks following the [Canary Workflow](https://react.dev/blog/2023/05/03/react-canaries) should begin implementing and testing these features. ## Why we follow the Canary Workflow To prepare for semver stable, libraries should test canary features like `` with `react@canary` to confirm compatibility and prepare for the next semver release in a myriad of environments and configurations used throughout the React ecosystem. This provides libraries with ample time to catch any issues we missed before slamming them with problems in the wider semver release. Since these features have already gone through extensive production testing, and we are confident they are stable, frameworks following the [Canary Workflow](https://react.dev/blog/2023/05/03/react-canaries) can also begin adopting canary features like ``. This adoption is similar to how different Browsers implement new proposed browser features before they are added to the standard. If a frameworks adopts a canary feature, they are committing to stability for their users by ensuring any API changes before a semver stable release are opaque and non-breaking to their users. Apps not using a framework are also free to adopt canary features like `` as long as they follow the [Canary Workflow](https://react.dev/blog/2023/05/03/react-canaries), but we generally recommend waiting for a semver stable release unless you have the capacity to commit to following along with the canary changes and debugging library compatibility issues. Waiting for semver stable means you're able to benefit from libraries testing and confirming support, and use semver as signal for which version of a library you can use with support of the feature. ## Docs Check out the ["React Labs: View Transitions, Activity, and more"](https://react.dev/blog/2025/04/23/react-labs-view-transitions-activity-and-more#view-transitions) blog post, and [the new docs for ``](https://react.dev/reference/react/ViewTransition) and [`addTransitionType`](https://react.dev/reference/react/addTransitionType) for more info. --- fixtures/view-transition/src/components/App.js | 2 +- fixtures/view-transition/src/components/Page.js | 4 ++-- .../src/__tests__/storeComponentFilters-test.js | 3 ++- .../src/__tests__/ReactDOMFizzViewTransition-test.js | 2 +- .../react-reconciler/src/__tests__/ReactErrorStacks-test.js | 2 +- .../src/__tests__/ReactLazy-test.internal.js | 4 ++-- .../src/__tests__/ViewTransitionReactServer-test.js | 2 +- packages/react/index.development.js | 2 ++ packages/react/index.experimental.development.js | 4 ++-- packages/react/index.experimental.js | 4 ++-- packages/react/index.fb.js | 6 ++++-- packages/react/index.js | 4 ++-- packages/react/index.stable.development.js | 2 ++ packages/react/index.stable.js | 2 ++ packages/react/src/ReactClient.js | 4 ++-- packages/react/src/ReactServer.experimental.development.js | 2 +- packages/react/src/ReactServer.experimental.js | 2 +- packages/react/src/ReactServer.fb.js | 3 ++- packages/react/src/ReactServer.js | 2 ++ packages/shared/ReactFeatureFlags.js | 2 +- packages/shared/forks/ReactFeatureFlags.native-oss.js | 2 +- 21 files changed, 36 insertions(+), 24 deletions(-) diff --git a/fixtures/view-transition/src/components/App.js b/fixtures/view-transition/src/components/App.js index 6b41bdf4ea..80e0c45c91 100644 --- a/fixtures/view-transition/src/components/App.js +++ b/fixtures/view-transition/src/components/App.js @@ -3,7 +3,7 @@ import React, { useLayoutEffect, useEffect, useState, - unstable_addTransitionType as addTransitionType, + addTransitionType, } from 'react'; import Chrome from './Chrome.js'; diff --git a/fixtures/view-transition/src/components/Page.js b/fixtures/view-transition/src/components/Page.js index d411bb2453..fbaa901717 100644 --- a/fixtures/view-transition/src/components/Page.js +++ b/fixtures/view-transition/src/components/Page.js @@ -1,6 +1,6 @@ import React, { - unstable_addTransitionType as addTransitionType, - unstable_ViewTransition as ViewTransition, + addTransitionType, + ViewTransition, Activity, useLayoutEffect, useEffect, diff --git a/packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js b/packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js index b5cf97a473..439315dc85 100644 --- a/packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js +++ b/packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js @@ -251,7 +251,8 @@ describe('Store component filters', () => { }); it('should filter ViewTransition', async () => { - const ViewTransition = React.unstable_ViewTransition; + const ViewTransition = + React.ViewTransition || React.unstable_ViewTransition; if (ViewTransition != null) { await actAsync(async () => diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzViewTransition-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzViewTransition-test.js index 6ca7cfd4dc..ee87fdac9c 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzViewTransition-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzViewTransition-test.js @@ -40,7 +40,7 @@ describe('ReactDOMFizzViewTransition', () => { Stream = require('stream'); Suspense = React.Suspense; - ViewTransition = React.unstable_ViewTransition; + ViewTransition = React.ViewTransition; // Test Environment const jsdom = new JSDOM( diff --git a/packages/react-reconciler/src/__tests__/ReactErrorStacks-test.js b/packages/react-reconciler/src/__tests__/ReactErrorStacks-test.js index 5f74de7af0..5b96ad1ee6 100644 --- a/packages/react-reconciler/src/__tests__/ReactErrorStacks-test.js +++ b/packages/react-reconciler/src/__tests__/ReactErrorStacks-test.js @@ -29,7 +29,7 @@ describe('ReactFragment', () => { React = require('react'); Suspense = React.Suspense; Activity = React.Activity; - ViewTransition = React.unstable_ViewTransition; + ViewTransition = React.ViewTransition; ReactNoop = require('react-noop-renderer'); const InternalTestUtils = require('internal-test-utils'); waitForAll = InternalTestUtils.waitForAll; diff --git a/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js b/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js index ec88184d40..3afb0008ab 100644 --- a/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js @@ -941,7 +941,7 @@ describe('ReactLazy', () => { // @gate enableViewTransition it('throws with a useful error when wrapping ViewTransition with lazy()', async () => { - const BadLazy = lazy(() => fakeImport(React.unstable_ViewTransition)); + const BadLazy = lazy(() => fakeImport(React.ViewTransition)); const root = ReactTestRenderer.create( }> @@ -954,7 +954,7 @@ describe('ReactLazy', () => { await waitForAll(['Loading...']); - await resolveFakeImport(React.unstable_ViewTransition); + await resolveFakeImport(React.ViewTransition); root.update( }> diff --git a/packages/react-reconciler/src/__tests__/ViewTransitionReactServer-test.js b/packages/react-reconciler/src/__tests__/ViewTransitionReactServer-test.js index 8f1104a128..f6fa939e84 100644 --- a/packages/react-reconciler/src/__tests__/ViewTransitionReactServer-test.js +++ b/packages/react-reconciler/src/__tests__/ViewTransitionReactServer-test.js @@ -23,7 +23,7 @@ describe('ViewTransitionReactServer', () => { jest.resetModules(); jest.mock('react', () => require('react/react.react-server')); ReactServer = require('react'); - ViewTransition = ReactServer.unstable_ViewTransition; + ViewTransition = ReactServer.ViewTransition; ReactNoopFlightServer = require('react-noop-renderer/flight-server'); jest.resetModules(); diff --git a/packages/react/index.development.js b/packages/react/index.development.js index a2ec285743..ed4a5a325d 100644 --- a/packages/react/index.development.js +++ b/packages/react/index.development.js @@ -45,6 +45,8 @@ export { startTransition, unstable_LegacyHidden, Activity, + ViewTransition, + addTransitionType, unstable_Scope, unstable_SuspenseList, unstable_TracingMarker, diff --git a/packages/react/index.experimental.development.js b/packages/react/index.experimental.development.js index 211f1c5dfb..b237449307 100644 --- a/packages/react/index.experimental.development.js +++ b/packages/react/index.experimental.development.js @@ -33,9 +33,9 @@ export { unstable_postpone, unstable_getCacheForType, unstable_SuspenseList, - unstable_ViewTransition, + ViewTransition, unstable_startGestureTransition, - unstable_addTransitionType, + addTransitionType, unstable_useCacheRefresh, useId, useCallback, diff --git a/packages/react/index.experimental.js b/packages/react/index.experimental.js index 0330dde744..37800ede07 100644 --- a/packages/react/index.experimental.js +++ b/packages/react/index.experimental.js @@ -34,9 +34,9 @@ export { unstable_postpone, unstable_getCacheForType, unstable_SuspenseList, - unstable_ViewTransition, + ViewTransition, unstable_startGestureTransition, - unstable_addTransitionType, + addTransitionType, unstable_useCacheRefresh, useId, useCallback, diff --git a/packages/react/index.fb.js b/packages/react/index.fb.js index 10e2ca4b90..d61af001a5 100644 --- a/packages/react/index.fb.js +++ b/packages/react/index.fb.js @@ -39,9 +39,11 @@ export { unstable_LegacyHidden, unstable_Scope, unstable_SuspenseList, - unstable_ViewTransition, + ViewTransition, + ViewTransition as unstable_ViewTransition, unstable_TracingMarker, - unstable_addTransitionType, + addTransitionType, + addTransitionType as unstable_addTransitionType, unstable_useCacheRefresh, use, useActionState, diff --git a/packages/react/index.js b/packages/react/index.js index 804853b331..78b11b809e 100644 --- a/packages/react/index.js +++ b/packages/react/index.js @@ -48,8 +48,8 @@ export { unstable_Scope, unstable_SuspenseList, unstable_TracingMarker, - unstable_ViewTransition, - unstable_addTransitionType, + ViewTransition, + addTransitionType, unstable_getCacheForType, unstable_useCacheRefresh, useId, diff --git a/packages/react/index.stable.development.js b/packages/react/index.stable.development.js index 29df69ff3f..5fd89390bc 100644 --- a/packages/react/index.stable.development.js +++ b/packages/react/index.stable.development.js @@ -18,6 +18,8 @@ export { PureComponent, StrictMode, Suspense, + ViewTransition, + addTransitionType, cloneElement, createContext, createElement, diff --git a/packages/react/index.stable.js b/packages/react/index.stable.js index 76edd14e05..830a4e9bb5 100644 --- a/packages/react/index.stable.js +++ b/packages/react/index.stable.js @@ -18,6 +18,8 @@ export { PureComponent, StrictMode, Suspense, + ViewTransition, + addTransitionType, cloneElement, createContext, createElement, diff --git a/packages/react/src/ReactClient.js b/packages/react/src/ReactClient.js index b505dc49fc..9f7c5dce36 100644 --- a/packages/react/src/ReactClient.js +++ b/packages/react/src/ReactClient.js @@ -125,8 +125,8 @@ export { // enableTransitionTracing REACT_TRACING_MARKER_TYPE as unstable_TracingMarker, // enableViewTransition - REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition, - addTransitionType as unstable_addTransitionType, + REACT_VIEW_TRANSITION_TYPE as ViewTransition, + addTransitionType as addTransitionType, // enableGestureTransition startGestureTransition as unstable_startGestureTransition, // DEV-only diff --git a/packages/react/src/ReactServer.experimental.development.js b/packages/react/src/ReactServer.experimental.development.js index 9e9417677b..df8b3d79b3 100644 --- a/packages/react/src/ReactServer.experimental.development.js +++ b/packages/react/src/ReactServer.experimental.development.js @@ -63,6 +63,7 @@ export { REACT_PROFILER_TYPE as Profiler, REACT_STRICT_MODE_TYPE as StrictMode, REACT_SUSPENSE_TYPE as Suspense, + REACT_VIEW_TRANSITION_TYPE as ViewTransition, cloneElement, createElement, createRef, @@ -83,6 +84,5 @@ export { version, // Experimental REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList, - REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition, captureOwnerStack, // DEV-only }; diff --git a/packages/react/src/ReactServer.experimental.js b/packages/react/src/ReactServer.experimental.js index e380789d71..06c0a9bf89 100644 --- a/packages/react/src/ReactServer.experimental.js +++ b/packages/react/src/ReactServer.experimental.js @@ -62,6 +62,7 @@ export { REACT_PROFILER_TYPE as Profiler, REACT_STRICT_MODE_TYPE as StrictMode, REACT_SUSPENSE_TYPE as Suspense, + REACT_VIEW_TRANSITION_TYPE as ViewTransition, cloneElement, createElement, createRef, @@ -82,5 +83,4 @@ export { version, // Experimental REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList, - REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition, }; diff --git a/packages/react/src/ReactServer.fb.js b/packages/react/src/ReactServer.fb.js index fe6089fc16..5a4ea8145d 100644 --- a/packages/react/src/ReactServer.fb.js +++ b/packages/react/src/ReactServer.fb.js @@ -53,6 +53,8 @@ export { REACT_PROFILER_TYPE as Profiler, REACT_STRICT_MODE_TYPE as StrictMode, REACT_SUSPENSE_TYPE as Suspense, + REACT_VIEW_TRANSITION_TYPE as ViewTransition, + REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition, cloneElement, createElement, createRef, @@ -71,5 +73,4 @@ export { captureOwnerStack, // DEV-only // Experimental REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList, - REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition, }; diff --git a/packages/react/src/ReactServer.js b/packages/react/src/ReactServer.js index f218074dee..81d83cbf45 100644 --- a/packages/react/src/ReactServer.js +++ b/packages/react/src/ReactServer.js @@ -16,6 +16,7 @@ import { REACT_PROFILER_TYPE, REACT_STRICT_MODE_TYPE, REACT_SUSPENSE_TYPE, + REACT_VIEW_TRANSITION_TYPE, } from 'shared/ReactSymbols'; import { cloneElement, @@ -46,6 +47,7 @@ export { REACT_PROFILER_TYPE as Profiler, REACT_STRICT_MODE_TYPE as StrictMode, REACT_SUSPENSE_TYPE as Suspense, + REACT_VIEW_TRANSITION_TYPE as ViewTransition, cloneElement, createElement, createRef, diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 89095e7318..8f01217eae 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -84,7 +84,7 @@ export const enablePostpone = __EXPERIMENTAL__; export const enableHalt: boolean = true; -export const enableViewTransition = __EXPERIMENTAL__; +export const enableViewTransition: boolean = true; export const enableGestureTransition = __EXPERIMENTAL__; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 8335ca5857..37f196b9fb 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -62,7 +62,7 @@ export const enableHydrationLaneScheduling: boolean = true; export const enableYieldingBeforePassive: boolean = false; export const enableThrottledScheduling: boolean = false; -export const enableViewTransition: boolean = false; +export const enableViewTransition: boolean = true; export const enableGestureTransition: boolean = false; export const enableScrollEndPolyfill: boolean = true; export const enableSuspenseyImages: boolean = false;