Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/recyclerview/hooks/useBoundDetection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ export function useBoundDetection<T>(
if (onStartReached) {
const onStartReachedThreshold = onStartReachedThresholdProp ?? 0.2;
const startThresholdDistance = onStartReachedThreshold * visibleLength;
const startBaseline = Math.max(0, recyclerViewManager.firstItemOffset);

const isNearStart = lastScrollOffset <= startThresholdDistance;
const isNearStart = lastScrollOffset <= startBaseline + startThresholdDistance;

if (isNearStart && !pendingStartReached.current) {
pendingStartReached.current = true;
Expand Down Expand Up @@ -146,9 +147,10 @@ export function useBoundDetection<T>(
}
}, [requestAnimationFrame, scrollViewRef, recyclerViewManager]);

// Reset end reached state when data changes
// Reset start/end reached state when data changes
useMemo(() => {
pendingEndReached.current = false;
pendingStartReached.current = false;
// needs to run only when data changes
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data]);
Expand Down