mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-08-15 18:45:06 +00:00
@@ -18,7 +18,6 @@
|
||||
"dependencies": {
|
||||
"array-find-index": "^1.0.2",
|
||||
"create-react-class": "^15.6.2",
|
||||
"debounce": "^1.2.0",
|
||||
"deep-assign": "^3.0.0",
|
||||
"fbjs": "^1.0.0",
|
||||
"hyphenate-style-name": "^1.0.3",
|
||||
|
||||
@@ -11,7 +11,6 @@ import type { ViewProps } from '../View';
|
||||
|
||||
import * as React from 'react';
|
||||
import { forwardRef, useRef } from 'react';
|
||||
import debounce from 'debounce';
|
||||
import StyleSheet from '../StyleSheet';
|
||||
import View from '../View';
|
||||
|
||||
@@ -93,6 +92,7 @@ const ScrollViewBase = forwardRef<Props, *>((props, forwardedRef) => {
|
||||
} = props;
|
||||
|
||||
const scrollState = useRef({ isScrolling: false, scrollLastTick: 0 });
|
||||
const scrollTimeout = useRef(null);
|
||||
|
||||
function createPreventableScrollHandler(handler: Function) {
|
||||
return (e: Object) => {
|
||||
@@ -107,9 +107,11 @@ const ScrollViewBase = forwardRef<Props, *>((props, forwardedRef) => {
|
||||
function handleScroll(e: Object) {
|
||||
e.persist();
|
||||
e.stopPropagation();
|
||||
// A scroll happened, so the scroll bumps the debounce.
|
||||
const debouncedOnScrollEnd = debounce(handleScrollEnd, 100);
|
||||
debouncedOnScrollEnd(e);
|
||||
// A scroll happened, so the scroll resets the scrollend timeout.
|
||||
if (scrollTimeout.current != null) {
|
||||
clearTimeout(scrollTimeout.current);
|
||||
}
|
||||
scrollTimeout.current = setTimeout(handleScrollEnd, 100);
|
||||
if (scrollState.current.isScrolling) {
|
||||
// Scroll last tick may have changed, check if we need to notify
|
||||
if (shouldEmitScrollEvent(scrollState.current.scrollLastTick, scrollEventThrottle)) {
|
||||
|
||||
@@ -6234,10 +6234,6 @@ de-indent@^1.0.2:
|
||||
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
|
||||
integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=
|
||||
|
||||
debounce@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131"
|
||||
|
||||
debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.8, debug@^2.6.9:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
|
||||
Reference in New Issue
Block a user