Skip to content

Commit 932dae1

Browse files
committed
Polyfill onScrollEnd Event in Safari (#32427)
We added support for `onScrollEnd` in #26789 but it only works in Chrome and Firefox. Safari still doesn't support `scrollend` and there's no indication that they will anytime soon so this polyfills it. While I don't particularly love our synthetic event system this tries to stay within the realm of how our other polyfills work. This implements all `onScrollEnd` events as a plugin. The basic principle is to first feature detect the `onscrollend` DOM property to see if there's native support and otherwise just use the native event. Then we listen to `scroll` events and set a timeout. If we don't get any more scroll events before the timeout we fire `onScrollEnd`. Basically debouncing it. If we're currently pressing down on touch or a mouse then we wait until it is lifted such as if you're scrolling with a finger or using the scrollbars on desktop but isn't currently moving. If we do get any native events even though we're in polyfilling mode, we use that as an indication to fire the `onScrollEnd` early. Part of the motivation is that this becomes extra useful pair for #32422. We also probably need these events to coincide with other gesture related internals so you're better off using our polyfill so they're synced. DiffTrain build for [605a880](605a880)
1 parent 001603f commit 932dae1

34 files changed

+126
-106
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ca12911d1fbe755b9b2b7d1bf548589317311a82
1+
605a880c8c5191e9f8c52468458709cd17a486c1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ca12911d1fbe755b9b2b7d1bf548589317311a82
1+
605a880c8c5191e9f8c52468458709cd17a486c1

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ __DEV__ &&
15331533
exports.useTransition = function () {
15341534
return resolveDispatcher().useTransition();
15351535
};
1536-
exports.version = "19.1.0-www-classic-ca12911d-20250228";
1536+
exports.version = "19.1.0-www-classic-605a880c-20250303";
15371537
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15381538
"function" ===
15391539
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ __DEV__ &&
15331533
exports.useTransition = function () {
15341534
return resolveDispatcher().useTransition();
15351535
};
1536-
exports.version = "19.1.0-www-modern-ca12911d-20250228";
1536+
exports.version = "19.1.0-www-modern-605a880c-20250303";
15371537
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15381538
"function" ===
15391539
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,4 +641,4 @@ exports.useSyncExternalStore = function (
641641
exports.useTransition = function () {
642642
return ReactSharedInternals.H.useTransition();
643643
};
644-
exports.version = "19.1.0-www-classic-ca12911d-20250228";
644+
exports.version = "19.1.0-www-classic-605a880c-20250303";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,4 +641,4 @@ exports.useSyncExternalStore = function (
641641
exports.useTransition = function () {
642642
return ReactSharedInternals.H.useTransition();
643643
};
644-
exports.version = "19.1.0-www-modern-ca12911d-20250228";
644+
exports.version = "19.1.0-www-modern-605a880c-20250303";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ exports.useSyncExternalStore = function (
645645
exports.useTransition = function () {
646646
return ReactSharedInternals.H.useTransition();
647647
};
648-
exports.version = "19.1.0-www-classic-ca12911d-20250228";
648+
exports.version = "19.1.0-www-classic-605a880c-20250303";
649649
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
650650
"function" ===
651651
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ exports.useSyncExternalStore = function (
645645
exports.useTransition = function () {
646646
return ReactSharedInternals.H.useTransition();
647647
};
648-
exports.version = "19.1.0-www-modern-ca12911d-20250228";
648+
exports.version = "19.1.0-www-modern-605a880c-20250303";
649649
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
650650
"function" ===
651651
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17349,10 +17349,10 @@ __DEV__ &&
1734917349
(function () {
1735017350
var internals = {
1735117351
bundleType: 1,
17352-
version: "19.1.0-www-classic-ca12911d-20250228",
17352+
version: "19.1.0-www-classic-605a880c-20250303",
1735317353
rendererPackageName: "react-art",
1735417354
currentDispatcherRef: ReactSharedInternals,
17355-
reconcilerVersion: "19.1.0-www-classic-ca12911d-20250228"
17355+
reconcilerVersion: "19.1.0-www-classic-605a880c-20250303"
1735617356
};
1735717357
internals.overrideHookState = overrideHookState;
1735817358
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -17386,7 +17386,7 @@ __DEV__ &&
1738617386
exports.Shape = Shape;
1738717387
exports.Surface = Surface;
1738817388
exports.Text = Text;
17389-
exports.version = "19.1.0-www-classic-ca12911d-20250228";
17389+
exports.version = "19.1.0-www-classic-605a880c-20250303";
1739017390
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1739117391
"function" ===
1739217392
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17121,10 +17121,10 @@ __DEV__ &&
1712117121
(function () {
1712217122
var internals = {
1712317123
bundleType: 1,
17124-
version: "19.1.0-www-modern-ca12911d-20250228",
17124+
version: "19.1.0-www-modern-605a880c-20250303",
1712517125
rendererPackageName: "react-art",
1712617126
currentDispatcherRef: ReactSharedInternals,
17127-
reconcilerVersion: "19.1.0-www-modern-ca12911d-20250228"
17127+
reconcilerVersion: "19.1.0-www-modern-605a880c-20250303"
1712817128
};
1712917129
internals.overrideHookState = overrideHookState;
1713017130
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -17158,7 +17158,7 @@ __DEV__ &&
1715817158
exports.Shape = Shape;
1715917159
exports.Surface = Surface;
1716017160
exports.Text = Text;
17161-
exports.version = "19.1.0-www-modern-ca12911d-20250228";
17161+
exports.version = "19.1.0-www-modern-605a880c-20250303";
1716217162
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1716317163
"function" ===
1716417164
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)