Skip to content

Commit

Permalink
[Fiber] Support only View Transitions v2 (#31996)
Browse files Browse the repository at this point in the history
Stacked on #31975.

We're going to recommend that the primary way you style a View
Transition is using a View Transition Class (and/or Type). These are
only available in the View Transitions v2 spec. When they're not
available it's better to fallback to just not animating instead of
animating with the wrong styling rules applied.

This is already widely supported in Chrome and Safari 18.2. Safari 18.2
usage is still somewhat low but it's rolling out quickly as we speak.

A way to detect this is by just passing the object form to
`startViewTransition` which throws if it's an earlier version. The
object form is required for `types` but luckily classes rolled out at
the same time. Therefore we're only indirectly detecting class support.

This means that in practice Safari 18.0 and 18.1 won't animate. We could
try to only apply the feature detection if you're actually using classes
or types, but that would create an unfortunate ecosystem burden to try
to support names. It also leads to flaky effects when only some
animations work. Better to just disable them all.

Firefox has yet to ship anything. We'll have to look out for how the
feature detection happens there and if they roll things out in different
order but if you ship late, you deal with web compat as the ball lies.

DiffTrain build for [38127b2](38127b2)
  • Loading branch information
sebmarkbage committed Jan 8, 2025
1 parent a2c4172 commit ef7a1ae
Show file tree
Hide file tree
Showing 22 changed files with 85 additions and 85 deletions.
2 changes: 1 addition & 1 deletion compiled-rn/VERSION_NATIVE_FB
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.1.0-native-fb-3a5496b3-20250108
19.1.0-native-fb-38127b28-20250108
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b663a0e709dc61af267e3a4ed6370332>>
* @generated SignedSource<<a5907ac6d8c935a838c49cab076677f9>>
*/

"use strict";
Expand Down Expand Up @@ -420,5 +420,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<584ea7291159b96f95bfa685757cda41>>
* @generated SignedSource<<24ed921d12020cf625ff914fb35495ee>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<584ea7291159b96f95bfa685757cda41>>
* @generated SignedSource<<24ed921d12020cf625ff914fb35495ee>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<86d910062cde1f7669cb85e62acd4dcd>>
* @generated SignedSource<<1774e836c2a7b70ca4262db777405dbf>>
*/

/*
Expand Down Expand Up @@ -25918,11 +25918,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-native-fb-3a5496b3-20250108" !== isomorphicReactPackageVersion)
if ("19.1.0-native-fb-38127b28-20250108" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.1.0-native-fb-3a5496b3-20250108\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-native-fb-38127b28-20250108\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -25959,10 +25959,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-native-fb-3a5496b3-20250108",
version: "19.1.0-native-fb-38127b28-20250108",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3a5496b3-20250108"
reconcilerVersion: "19.1.0-native-fb-38127b28-20250108"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -26108,5 +26108,5 @@ __DEV__ &&
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<272f04cb7d07853225293973ac057657>>
* @generated SignedSource<<0d9c07a289ec2ff1fb4891e7547371e2>>
*/

/*
Expand Down Expand Up @@ -15944,14 +15944,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1771 = React.version;
if (
"19.1.0-native-fb-3a5496b3-20250108" !==
"19.1.0-native-fb-38127b28-20250108" !==
isomorphicReactPackageVersion$jscomp$inline_1771
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1771,
"19.1.0-native-fb-3a5496b3-20250108"
"19.1.0-native-fb-38127b28-20250108"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -15973,10 +15973,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2219 = {
bundleType: 0,
version: "19.1.0-native-fb-3a5496b3-20250108",
version: "19.1.0-native-fb-38127b28-20250108",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3a5496b3-20250108"
reconcilerVersion: "19.1.0-native-fb-38127b28-20250108"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2220 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16082,4 +16082,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c79892102a3b0bfb5f5c1c64099a812b>>
* @generated SignedSource<<947cce3cdb7ca8e14164c121b0b56b9a>>
*/

/*
Expand Down Expand Up @@ -16591,14 +16591,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1866 = React.version;
if (
"19.1.0-native-fb-3a5496b3-20250108" !==
"19.1.0-native-fb-38127b28-20250108" !==
isomorphicReactPackageVersion$jscomp$inline_1866
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1866,
"19.1.0-native-fb-3a5496b3-20250108"
"19.1.0-native-fb-38127b28-20250108"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -16620,10 +16620,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_1873 = {
bundleType: 0,
version: "19.1.0-native-fb-3a5496b3-20250108",
version: "19.1.0-native-fb-38127b28-20250108",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3a5496b3-20250108",
reconcilerVersion: "19.1.0-native-fb-38127b28-20250108",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$293 = 0;
Expand Down Expand Up @@ -16744,4 +16744,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3cdc965dca30290ccf0eb7193b8197e6>>
* @generated SignedSource<<079dbae19bc30169d8e4ecf8c571d8cd>>
*/

/*
Expand Down Expand Up @@ -25979,11 +25979,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-native-fb-3a5496b3-20250108" !== isomorphicReactPackageVersion)
if ("19.1.0-native-fb-38127b28-20250108" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.1.0-native-fb-3a5496b3-20250108\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-native-fb-38127b28-20250108\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -26020,10 +26020,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-native-fb-3a5496b3-20250108",
version: "19.1.0-native-fb-38127b28-20250108",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3a5496b3-20250108"
reconcilerVersion: "19.1.0-native-fb-38127b28-20250108"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -26485,7 +26485,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<07cdb940a6eaed2ab8c77360157de423>>
* @generated SignedSource<<fe7d64373c07d195c02fdb9ca3c97945>>
*/

/*
Expand Down Expand Up @@ -15955,14 +15955,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1772 = React.version;
if (
"19.1.0-native-fb-3a5496b3-20250108" !==
"19.1.0-native-fb-38127b28-20250108" !==
isomorphicReactPackageVersion$jscomp$inline_1772
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1772,
"19.1.0-native-fb-3a5496b3-20250108"
"19.1.0-native-fb-38127b28-20250108"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -15984,10 +15984,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2222 = {
bundleType: 0,
version: "19.1.0-native-fb-3a5496b3-20250108",
version: "19.1.0-native-fb-38127b28-20250108",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3a5496b3-20250108"
reconcilerVersion: "19.1.0-native-fb-38127b28-20250108"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2223 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16247,4 +16247,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a73292522056f0357f1c4c529130a185>>
* @generated SignedSource<<26630afdd83745cb8fe3afb31e47d4cf>>
*/

/*
Expand Down Expand Up @@ -16606,14 +16606,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1867 = React.version;
if (
"19.1.0-native-fb-3a5496b3-20250108" !==
"19.1.0-native-fb-38127b28-20250108" !==
isomorphicReactPackageVersion$jscomp$inline_1867
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1867,
"19.1.0-native-fb-3a5496b3-20250108"
"19.1.0-native-fb-38127b28-20250108"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -16635,10 +16635,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_1874 = {
bundleType: 0,
version: "19.1.0-native-fb-3a5496b3-20250108",
version: "19.1.0-native-fb-38127b28-20250108",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3a5496b3-20250108",
reconcilerVersion: "19.1.0-native-fb-38127b28-20250108",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$293 = 0;
Expand Down Expand Up @@ -16913,7 +16913,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4882763938b0db11e9582d000f49c020>>
* @generated SignedSource<<a4191f7b561da3c3282cc6ea71c409a2>>
*/

"use strict";
Expand Down Expand Up @@ -15620,10 +15620,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-native-fb-3a5496b3-20250108",
version: "19.1.0-native-fb-38127b28-20250108",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3a5496b3-20250108"
reconcilerVersion: "19.1.0-native-fb-38127b28-20250108"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -15768,5 +15768,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<1d142d98cfc8e92267cfe31c593b81b5>>
* @generated SignedSource<<a796643e6dac8983d6dc3b2f6fadebc6>>
*/

"use strict";
Expand Down Expand Up @@ -9820,10 +9820,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1405 = {
bundleType: 0,
version: "19.1.0-native-fb-3a5496b3-20250108",
version: "19.1.0-native-fb-38127b28-20250108",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-native-fb-3a5496b3-20250108"
reconcilerVersion: "19.1.0-native-fb-38127b28-20250108"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1406 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -9959,4 +9959,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.1.0-native-fb-3a5496b3-20250108";
exports.version = "19.1.0-native-fb-38127b28-20250108";
Loading

0 comments on commit ef7a1ae

Please sign in to comment.