Skip to content

Commit

Permalink
Allow passing range option to useSwipeTransition (#32412)
Browse files Browse the repository at this point in the history
Stacked on #32379

Track the range offsets along the timeline where previous/current/next
is. This can also be specified as an option. This lets you model more
than three states along a timeline by clamping them and then updating
the "current" as you go.

It also allows specifying the "current" offset as something different
than what it was when the gesture started such as if it has to start
after scroll has already happened (such as what happens if you listen to
the "scroll" event).

DiffTrain build for [662957c](662957c)
  • Loading branch information
sebmarkbage committed Feb 21, 2025
1 parent aeb2edf commit bdd0f24
Show file tree
Hide file tree
Showing 35 changed files with 91 additions and 86 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
88479c6fc31ba2902587694338350ae95733d6b2
662957cc735a7f630b497ada45af8ff39684d2b9
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
88479c6fc31ba2902587694338350ae95733d6b2
662957cc735a7f630b497ada45af8ff39684d2b9
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,4 +641,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,4 +641,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17387,10 +17387,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-classic-88479c6f-20250220",
version: "19.1.0-www-classic-662957cc-20250221",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-classic-662957cc-20250221"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17424,7 +17424,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -17159,10 +17159,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-modern-88479c6f-20250220",
version: "19.1.0-www-modern-662957cc-20250221",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-modern-662957cc-20250221"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17196,7 +17196,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -11257,10 +11257,10 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1550 = {
bundleType: 0,
version: "19.1.0-www-classic-88479c6f-20250220",
version: "19.1.0-www-classic-662957cc-20250221",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-classic-662957cc-20250221"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1551 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -11286,4 +11286,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10972,10 +10972,10 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1523 = {
bundleType: 0,
version: "19.1.0-www-modern-88479c6f-20250220",
version: "19.1.0-www-modern-662957cc-20250221",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-modern-662957cc-20250221"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1524 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -11001,4 +11001,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -28584,11 +28584,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-www-classic-88479c6f-20250220" !== isomorphicReactPackageVersion)
if ("19.1.0-www-classic-662957cc-20250221" !== 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-www-classic-88479c6f-20250220\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-www-classic-662957cc-20250221\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -28631,10 +28631,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-classic-88479c6f-20250220",
version: "19.1.0-www-classic-662957cc-20250221",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-classic-662957cc-20250221"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -29232,7 +29232,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -28370,11 +28370,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-www-modern-88479c6f-20250220" !== isomorphicReactPackageVersion)
if ("19.1.0-www-modern-662957cc-20250221" !== 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-www-modern-88479c6f-20250220\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-www-modern-662957cc-20250221\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -28417,10 +28417,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-modern-88479c6f-20250220",
version: "19.1.0-www-modern-662957cc-20250221",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-modern-662957cc-20250221"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -29018,7 +29018,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -18425,14 +18425,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1854 = React.version;
if (
"19.1.0-www-classic-88479c6f-20250220" !==
"19.1.0-www-classic-662957cc-20250221" !==
isomorphicReactPackageVersion$jscomp$inline_1854
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1854,
"19.1.0-www-classic-88479c6f-20250220"
"19.1.0-www-classic-662957cc-20250221"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -18450,10 +18450,10 @@ Internals.Events = [
];
var internals$jscomp$inline_2414 = {
bundleType: 0,
version: "19.1.0-www-classic-88479c6f-20250220",
version: "19.1.0-www-classic-662957cc-20250221",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-classic-662957cc-20250221"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2415 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -18817,4 +18817,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -18156,14 +18156,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1844 = React.version;
if (
"19.1.0-www-modern-88479c6f-20250220" !==
"19.1.0-www-modern-662957cc-20250221" !==
isomorphicReactPackageVersion$jscomp$inline_1844
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1844,
"19.1.0-www-modern-88479c6f-20250220"
"19.1.0-www-modern-662957cc-20250221"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -18181,10 +18181,10 @@ Internals.Events = [
];
var internals$jscomp$inline_2396 = {
bundleType: 0,
version: "19.1.0-www-modern-88479c6f-20250220",
version: "19.1.0-www-modern-662957cc-20250221",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-modern-662957cc-20250221"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2397 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -18548,4 +18548,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19117,14 +19117,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1951 = React.version;
if (
"19.1.0-www-classic-88479c6f-20250220" !==
"19.1.0-www-classic-662957cc-20250221" !==
isomorphicReactPackageVersion$jscomp$inline_1951
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1951,
"19.1.0-www-classic-88479c6f-20250220"
"19.1.0-www-classic-662957cc-20250221"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -19142,10 +19142,10 @@ Internals.Events = [
];
var internals$jscomp$inline_1953 = {
bundleType: 0,
version: "19.1.0-www-classic-88479c6f-20250220",
version: "19.1.0-www-classic-662957cc-20250221",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-classic-662957cc-20250221"
};
enableSchedulingProfiler &&
((internals$jscomp$inline_1953.getLaneLabelMap = getLaneLabelMap),
Expand Down Expand Up @@ -19512,7 +19512,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -18847,14 +18847,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1941 = React.version;
if (
"19.1.0-www-modern-88479c6f-20250220" !==
"19.1.0-www-modern-662957cc-20250221" !==
isomorphicReactPackageVersion$jscomp$inline_1941
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1941,
"19.1.0-www-modern-88479c6f-20250220"
"19.1.0-www-modern-662957cc-20250221"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -18872,10 +18872,10 @@ Internals.Events = [
];
var internals$jscomp$inline_1943 = {
bundleType: 0,
version: "19.1.0-www-modern-88479c6f-20250220",
version: "19.1.0-www-modern-662957cc-20250221",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-88479c6f-20250220"
reconcilerVersion: "19.1.0-www-modern-662957cc-20250221"
};
enableSchedulingProfiler &&
((internals$jscomp$inline_1943.getLaneLabelMap = getLaneLabelMap),
Expand Down Expand Up @@ -19242,7 +19242,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9459,5 +9459,5 @@ __DEV__ &&
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
})();
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9285,5 +9285,5 @@ __DEV__ &&
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
})();
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6194,4 +6194,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "19.1.0-www-classic-88479c6f-20250220";
exports.version = "19.1.0-www-classic-662957cc-20250221";
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -6106,4 +6106,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "19.1.0-www-modern-88479c6f-20250220";
exports.version = "19.1.0-www-modern-662957cc-20250221";
Loading

0 comments on commit bdd0f24

Please sign in to comment.