jacob314/drag scrollbar (#12998)

This commit is contained in:
Jacob Richman
2025-11-13 14:13:18 -08:00
committed by GitHub
parent fb99b95372
commit 2b8adf8cf3
4 changed files with 799 additions and 3 deletions

View File

@@ -133,6 +133,16 @@ function ScrollableList<T>(
Math.min(maxScrollTop, effectiveTarget),
);
if (duration === 0) {
if (targetScrollTop === SCROLL_TO_ITEM_END) {
virtualizedListRef.current?.scrollTo(SCROLL_TO_ITEM_END);
} else {
virtualizedListRef.current?.scrollTo(Math.round(clampedTarget));
}
flashScrollbar();
return;
}
smoothScrollState.current = {
active: true,
start: Date.now(),
@@ -205,10 +215,17 @@ function ScrollableList<T>(
ref: containerRef as React.RefObject<DOMElement>,
getScrollState,
scrollBy: scrollByWithAnimation,
scrollTo: smoothScrollTo,
hasFocus: hasFocusCallback,
flashScrollbar,
}),
[getScrollState, hasFocusCallback, flashScrollbar, scrollByWithAnimation],
[
getScrollState,
hasFocusCallback,
flashScrollbar,
scrollByWithAnimation,
smoothScrollTo,
],
);
useScrollable(scrollableEntry, hasFocus);