mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
snap bounds in virtual list
This commit is contained in:
parent
296bed18d5
commit
1254e8f4d8
@ -109,16 +109,16 @@ export function VirtualList({ id, items, itemRenderer, loadMore }) {
|
||||
const range = getContainerRange();
|
||||
if (range.bottom - range.top < state.listHeight) {
|
||||
if (scrollTop.current + state.listHeight != range.bottom) {
|
||||
list.current.scrollTo({ top: range.bottom - state.listHeight, left: 0, behavior: 'smooth' });
|
||||
list.current.scrollTo({ top: range.bottom - state.listHeight, left: 0 });
|
||||
actions.latch();
|
||||
}
|
||||
}
|
||||
else if (scrollTop.current + state.listHeight > range.bottom) {
|
||||
list.current.scrollTo({ top: range.bottom - state.listHeight, left: 0, behavior: 'smooth' });
|
||||
list.current.scrollTo({ top: range.bottom - state.listHeight, left: 0 });
|
||||
actions.latch();
|
||||
}
|
||||
else if (scrollTop.current < range.top) {
|
||||
list.current.scrollTo({ top: range.top, left: 0, behavior: 'smooth' });
|
||||
list.current.scrollTo({ top: range.top, left: 0 });
|
||||
}
|
||||
}
|
||||
}, pushDelay);
|
||||
|
Loading…
Reference in New Issue
Block a user