diff --git a/packages/@react-aria/virtualizer/src/ScrollView.tsx b/packages/@react-aria/virtualizer/src/ScrollView.tsx index e89d2f2df1c..7c4988a5b3e 100644 --- a/packages/@react-aria/virtualizer/src/ScrollView.tsx +++ b/packages/@react-aria/virtualizer/src/ScrollView.tsx @@ -86,15 +86,6 @@ export function useScrollView(props: ScrollViewProps, ref: RefObject { - state.isScrolling = false; - setScrolling(false); - state.scrollTimeout = null; - - window.dispatchEvent(new Event('tk.connect-observer')); - onScrollEnd?.(); - }, [state, onScrollEnd]); - let onScroll = useCallback((e) => { if (e.target !== e.currentTarget) { return; @@ -128,21 +119,29 @@ export function useScrollView(props: ScrollViewProps, ref: RefObject { + state.isScrolling = false; + setScrolling(false); + state.scrollTimeout = null; + + window.dispatchEvent(new Event('tk.connect-observer')); + if (onScrollEnd) { + onScrollEnd(); + } + }, 300); } }); - }, [props, direction, state, contentSize, onVisibleRectChange, onScrollStart, onScrollTimeout]); + }, [props, direction, state, contentSize, onVisibleRectChange, onScrollStart, onScrollEnd]); // Attach event directly to ref so RAC Virtualizer doesn't need to send props upward. useEvent(ref, 'scroll', onScroll); - useEvent(ref, 'scrollend', onScrollTimeout); useEffect(() => { return () => {