Make createScroller honor reverse param

This commit is contained in:
Jon Staab
2026-02-16 12:48:42 -08:00
parent 7f6450375b
commit ca7d126a3c
3 changed files with 12 additions and 11 deletions
+5 -2
View File
@@ -47,9 +47,12 @@ export const createScroller = ({
if (container) {
// While we have empty space, fill it
const {scrollY, innerHeight} = window
const {scrollHeight, scrollTop} = container
const {scrollHeight, scrollTop, clientHeight} = container
const viewHeight = clientHeight || innerHeight
const offset = Math.abs(scrollTop || scrollY)
const shouldLoad = offset + innerHeight + threshold > scrollHeight
const shouldLoad = reverse
? offset < threshold
: offset + viewHeight + threshold > scrollHeight
// Only trigger loading the first time we reach the threshold
if (shouldLoad) {