ScrollableList: track the second item instead of the top one

dnd
Alex Gleason 2022-06-02 21:22:40 -05:00
rodzic 606d6297a8
commit 526d8a1d83
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -170,7 +170,9 @@ const ScrollableList = React.forwardRef<VirtuosoHandle, IScrollableList>(({
};
const handleRangeChange = (range: ListRange) => {
topIndex.current = range.startIndex;
// HACK: using the first index can be buggy.
// Track the second item instead, unless the endIndex comes before it (eg one 1 item in view).
topIndex.current = Math.min(range.startIndex + 1, range.endIndex);
handleScroll();
};