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
7 changes: 3 additions & 4 deletions src/recyclerview/components/StickyHeaders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export const StickyHeaders = <TItem,>({
// Binary search for current sticky index
const currentIndexInArray = findCurrentStickyIndex(
sortedIndices,
adjustedScrollOffset + stickyHeaderOffset,
(index) => recyclerViewManager.getLayout(index).y
adjustedScrollOffset,
(index) => recyclerViewManager.getLayout(index).y - recyclerViewManager.firstItemOffset
);

const newStickyIndex = sortedIndices[currentIndexInArray] ?? -1;
Expand All @@ -113,8 +113,7 @@ export const StickyHeaders = <TItem,>({
const newNextStickyY =
newNextStickyIndex === -1
? Number.MAX_SAFE_INTEGER
: (recyclerViewManager.tryGetLayout(newNextStickyIndex)?.y ?? 0) +
recyclerViewManager.firstItemOffset;
: (recyclerViewManager.tryGetLayout(newNextStickyIndex)?.y ?? 0);
const newCurrentStickyHeight =
recyclerViewManager.tryGetLayout(newStickyIndex)?.height ?? 0;

Expand Down