mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 00:20:04 +01:00
Release <ViewTransition /> to Canary (#34712)
## Overview This PR ships the View Transition APIs to `react@canary`: - [`<ViewTransition />`](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 `<ViewTransition />` 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 `<ViewTransition />` 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 `<ViewTransition />`. 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 `<ViewTransition>` 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 `<ViewTransition />`](https://react.dev/reference/react/ViewTransition) and [`addTransitionType`](https://react.dev/reference/react/addTransitionType) for more info.
This commit is contained in:
parent
b65e6fc58b
commit
6a8c7fb6f1
|
|
@ -3,7 +3,7 @@ import React, {
|
||||||
useLayoutEffect,
|
useLayoutEffect,
|
||||||
useEffect,
|
useEffect,
|
||||||
useState,
|
useState,
|
||||||
unstable_addTransitionType as addTransitionType,
|
addTransitionType,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
import Chrome from './Chrome.js';
|
import Chrome from './Chrome.js';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React, {
|
import React, {
|
||||||
unstable_addTransitionType as addTransitionType,
|
addTransitionType,
|
||||||
unstable_ViewTransition as ViewTransition,
|
ViewTransition,
|
||||||
Activity,
|
Activity,
|
||||||
useLayoutEffect,
|
useLayoutEffect,
|
||||||
useEffect,
|
useEffect,
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,8 @@ describe('Store component filters', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should filter ViewTransition', async () => {
|
it('should filter ViewTransition', async () => {
|
||||||
const ViewTransition = React.unstable_ViewTransition;
|
const ViewTransition =
|
||||||
|
React.ViewTransition || React.unstable_ViewTransition;
|
||||||
|
|
||||||
if (ViewTransition != null) {
|
if (ViewTransition != null) {
|
||||||
await actAsync(async () =>
|
await actAsync(async () =>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ describe('ReactDOMFizzViewTransition', () => {
|
||||||
Stream = require('stream');
|
Stream = require('stream');
|
||||||
|
|
||||||
Suspense = React.Suspense;
|
Suspense = React.Suspense;
|
||||||
ViewTransition = React.unstable_ViewTransition;
|
ViewTransition = React.ViewTransition;
|
||||||
|
|
||||||
// Test Environment
|
// Test Environment
|
||||||
const jsdom = new JSDOM(
|
const jsdom = new JSDOM(
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ describe('ReactFragment', () => {
|
||||||
React = require('react');
|
React = require('react');
|
||||||
Suspense = React.Suspense;
|
Suspense = React.Suspense;
|
||||||
Activity = React.Activity;
|
Activity = React.Activity;
|
||||||
ViewTransition = React.unstable_ViewTransition;
|
ViewTransition = React.ViewTransition;
|
||||||
ReactNoop = require('react-noop-renderer');
|
ReactNoop = require('react-noop-renderer');
|
||||||
const InternalTestUtils = require('internal-test-utils');
|
const InternalTestUtils = require('internal-test-utils');
|
||||||
waitForAll = InternalTestUtils.waitForAll;
|
waitForAll = InternalTestUtils.waitForAll;
|
||||||
|
|
|
||||||
|
|
@ -941,7 +941,7 @@ describe('ReactLazy', () => {
|
||||||
|
|
||||||
// @gate enableViewTransition
|
// @gate enableViewTransition
|
||||||
it('throws with a useful error when wrapping ViewTransition with lazy()', async () => {
|
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(
|
const root = ReactTestRenderer.create(
|
||||||
<Suspense fallback={<Text text="Loading..." />}>
|
<Suspense fallback={<Text text="Loading..." />}>
|
||||||
|
|
@ -954,7 +954,7 @@ describe('ReactLazy', () => {
|
||||||
|
|
||||||
await waitForAll(['Loading...']);
|
await waitForAll(['Loading...']);
|
||||||
|
|
||||||
await resolveFakeImport(React.unstable_ViewTransition);
|
await resolveFakeImport(React.ViewTransition);
|
||||||
root.update(
|
root.update(
|
||||||
<Suspense fallback={<Text text="Loading..." />}>
|
<Suspense fallback={<Text text="Loading..." />}>
|
||||||
<BadLazy />
|
<BadLazy />
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ describe('ViewTransitionReactServer', () => {
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
jest.mock('react', () => require('react/react.react-server'));
|
jest.mock('react', () => require('react/react.react-server'));
|
||||||
ReactServer = require('react');
|
ReactServer = require('react');
|
||||||
ViewTransition = ReactServer.unstable_ViewTransition;
|
ViewTransition = ReactServer.ViewTransition;
|
||||||
ReactNoopFlightServer = require('react-noop-renderer/flight-server');
|
ReactNoopFlightServer = require('react-noop-renderer/flight-server');
|
||||||
|
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ export {
|
||||||
startTransition,
|
startTransition,
|
||||||
unstable_LegacyHidden,
|
unstable_LegacyHidden,
|
||||||
Activity,
|
Activity,
|
||||||
|
ViewTransition,
|
||||||
|
addTransitionType,
|
||||||
unstable_Scope,
|
unstable_Scope,
|
||||||
unstable_SuspenseList,
|
unstable_SuspenseList,
|
||||||
unstable_TracingMarker,
|
unstable_TracingMarker,
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ export {
|
||||||
unstable_postpone,
|
unstable_postpone,
|
||||||
unstable_getCacheForType,
|
unstable_getCacheForType,
|
||||||
unstable_SuspenseList,
|
unstable_SuspenseList,
|
||||||
unstable_ViewTransition,
|
ViewTransition,
|
||||||
unstable_startGestureTransition,
|
unstable_startGestureTransition,
|
||||||
unstable_addTransitionType,
|
addTransitionType,
|
||||||
unstable_useCacheRefresh,
|
unstable_useCacheRefresh,
|
||||||
useId,
|
useId,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@ export {
|
||||||
unstable_postpone,
|
unstable_postpone,
|
||||||
unstable_getCacheForType,
|
unstable_getCacheForType,
|
||||||
unstable_SuspenseList,
|
unstable_SuspenseList,
|
||||||
unstable_ViewTransition,
|
ViewTransition,
|
||||||
unstable_startGestureTransition,
|
unstable_startGestureTransition,
|
||||||
unstable_addTransitionType,
|
addTransitionType,
|
||||||
unstable_useCacheRefresh,
|
unstable_useCacheRefresh,
|
||||||
useId,
|
useId,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,11 @@ export {
|
||||||
unstable_LegacyHidden,
|
unstable_LegacyHidden,
|
||||||
unstable_Scope,
|
unstable_Scope,
|
||||||
unstable_SuspenseList,
|
unstable_SuspenseList,
|
||||||
unstable_ViewTransition,
|
ViewTransition,
|
||||||
|
ViewTransition as unstable_ViewTransition,
|
||||||
unstable_TracingMarker,
|
unstable_TracingMarker,
|
||||||
unstable_addTransitionType,
|
addTransitionType,
|
||||||
|
addTransitionType as unstable_addTransitionType,
|
||||||
unstable_useCacheRefresh,
|
unstable_useCacheRefresh,
|
||||||
use,
|
use,
|
||||||
useActionState,
|
useActionState,
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ export {
|
||||||
unstable_Scope,
|
unstable_Scope,
|
||||||
unstable_SuspenseList,
|
unstable_SuspenseList,
|
||||||
unstable_TracingMarker,
|
unstable_TracingMarker,
|
||||||
unstable_ViewTransition,
|
ViewTransition,
|
||||||
unstable_addTransitionType,
|
addTransitionType,
|
||||||
unstable_getCacheForType,
|
unstable_getCacheForType,
|
||||||
unstable_useCacheRefresh,
|
unstable_useCacheRefresh,
|
||||||
useId,
|
useId,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ export {
|
||||||
PureComponent,
|
PureComponent,
|
||||||
StrictMode,
|
StrictMode,
|
||||||
Suspense,
|
Suspense,
|
||||||
|
ViewTransition,
|
||||||
|
addTransitionType,
|
||||||
cloneElement,
|
cloneElement,
|
||||||
createContext,
|
createContext,
|
||||||
createElement,
|
createElement,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ export {
|
||||||
PureComponent,
|
PureComponent,
|
||||||
StrictMode,
|
StrictMode,
|
||||||
Suspense,
|
Suspense,
|
||||||
|
ViewTransition,
|
||||||
|
addTransitionType,
|
||||||
cloneElement,
|
cloneElement,
|
||||||
createContext,
|
createContext,
|
||||||
createElement,
|
createElement,
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,8 @@ export {
|
||||||
// enableTransitionTracing
|
// enableTransitionTracing
|
||||||
REACT_TRACING_MARKER_TYPE as unstable_TracingMarker,
|
REACT_TRACING_MARKER_TYPE as unstable_TracingMarker,
|
||||||
// enableViewTransition
|
// enableViewTransition
|
||||||
REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition,
|
REACT_VIEW_TRANSITION_TYPE as ViewTransition,
|
||||||
addTransitionType as unstable_addTransitionType,
|
addTransitionType as addTransitionType,
|
||||||
// enableGestureTransition
|
// enableGestureTransition
|
||||||
startGestureTransition as unstable_startGestureTransition,
|
startGestureTransition as unstable_startGestureTransition,
|
||||||
// DEV-only
|
// DEV-only
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ export {
|
||||||
REACT_PROFILER_TYPE as Profiler,
|
REACT_PROFILER_TYPE as Profiler,
|
||||||
REACT_STRICT_MODE_TYPE as StrictMode,
|
REACT_STRICT_MODE_TYPE as StrictMode,
|
||||||
REACT_SUSPENSE_TYPE as Suspense,
|
REACT_SUSPENSE_TYPE as Suspense,
|
||||||
|
REACT_VIEW_TRANSITION_TYPE as ViewTransition,
|
||||||
cloneElement,
|
cloneElement,
|
||||||
createElement,
|
createElement,
|
||||||
createRef,
|
createRef,
|
||||||
|
|
@ -83,6 +84,5 @@ export {
|
||||||
version,
|
version,
|
||||||
// Experimental
|
// Experimental
|
||||||
REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList,
|
REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList,
|
||||||
REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition,
|
|
||||||
captureOwnerStack, // DEV-only
|
captureOwnerStack, // DEV-only
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ export {
|
||||||
REACT_PROFILER_TYPE as Profiler,
|
REACT_PROFILER_TYPE as Profiler,
|
||||||
REACT_STRICT_MODE_TYPE as StrictMode,
|
REACT_STRICT_MODE_TYPE as StrictMode,
|
||||||
REACT_SUSPENSE_TYPE as Suspense,
|
REACT_SUSPENSE_TYPE as Suspense,
|
||||||
|
REACT_VIEW_TRANSITION_TYPE as ViewTransition,
|
||||||
cloneElement,
|
cloneElement,
|
||||||
createElement,
|
createElement,
|
||||||
createRef,
|
createRef,
|
||||||
|
|
@ -82,5 +83,4 @@ export {
|
||||||
version,
|
version,
|
||||||
// Experimental
|
// Experimental
|
||||||
REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList,
|
REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList,
|
||||||
REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition,
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ export {
|
||||||
REACT_PROFILER_TYPE as Profiler,
|
REACT_PROFILER_TYPE as Profiler,
|
||||||
REACT_STRICT_MODE_TYPE as StrictMode,
|
REACT_STRICT_MODE_TYPE as StrictMode,
|
||||||
REACT_SUSPENSE_TYPE as Suspense,
|
REACT_SUSPENSE_TYPE as Suspense,
|
||||||
|
REACT_VIEW_TRANSITION_TYPE as ViewTransition,
|
||||||
|
REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition,
|
||||||
cloneElement,
|
cloneElement,
|
||||||
createElement,
|
createElement,
|
||||||
createRef,
|
createRef,
|
||||||
|
|
@ -71,5 +73,4 @@ export {
|
||||||
captureOwnerStack, // DEV-only
|
captureOwnerStack, // DEV-only
|
||||||
// Experimental
|
// Experimental
|
||||||
REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList,
|
REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList,
|
||||||
REACT_VIEW_TRANSITION_TYPE as unstable_ViewTransition,
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import {
|
||||||
REACT_PROFILER_TYPE,
|
REACT_PROFILER_TYPE,
|
||||||
REACT_STRICT_MODE_TYPE,
|
REACT_STRICT_MODE_TYPE,
|
||||||
REACT_SUSPENSE_TYPE,
|
REACT_SUSPENSE_TYPE,
|
||||||
|
REACT_VIEW_TRANSITION_TYPE,
|
||||||
} from 'shared/ReactSymbols';
|
} from 'shared/ReactSymbols';
|
||||||
import {
|
import {
|
||||||
cloneElement,
|
cloneElement,
|
||||||
|
|
@ -46,6 +47,7 @@ export {
|
||||||
REACT_PROFILER_TYPE as Profiler,
|
REACT_PROFILER_TYPE as Profiler,
|
||||||
REACT_STRICT_MODE_TYPE as StrictMode,
|
REACT_STRICT_MODE_TYPE as StrictMode,
|
||||||
REACT_SUSPENSE_TYPE as Suspense,
|
REACT_SUSPENSE_TYPE as Suspense,
|
||||||
|
REACT_VIEW_TRANSITION_TYPE as ViewTransition,
|
||||||
cloneElement,
|
cloneElement,
|
||||||
createElement,
|
createElement,
|
||||||
createRef,
|
createRef,
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ export const enablePostpone = __EXPERIMENTAL__;
|
||||||
|
|
||||||
export const enableHalt: boolean = true;
|
export const enableHalt: boolean = true;
|
||||||
|
|
||||||
export const enableViewTransition = __EXPERIMENTAL__;
|
export const enableViewTransition: boolean = true;
|
||||||
|
|
||||||
export const enableGestureTransition = __EXPERIMENTAL__;
|
export const enableGestureTransition = __EXPERIMENTAL__;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ export const enableHydrationLaneScheduling: boolean = true;
|
||||||
export const enableYieldingBeforePassive: boolean = false;
|
export const enableYieldingBeforePassive: boolean = false;
|
||||||
|
|
||||||
export const enableThrottledScheduling: boolean = false;
|
export const enableThrottledScheduling: boolean = false;
|
||||||
export const enableViewTransition: boolean = false;
|
export const enableViewTransition: boolean = true;
|
||||||
export const enableGestureTransition: boolean = false;
|
export const enableGestureTransition: boolean = false;
|
||||||
export const enableScrollEndPolyfill: boolean = true;
|
export const enableScrollEndPolyfill: boolean = true;
|
||||||
export const enableSuspenseyImages: boolean = false;
|
export const enableSuspenseyImages: boolean = false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user