Skip to content

fix(v3): sticky indices behavior#402

Open
huextrat wants to merge 1 commit intoLegendApp:webfrom
huextrat:feat/sticky-indices-v3
Open

fix(v3): sticky indices behavior#402
huextrat wants to merge 1 commit intoLegendApp:webfrom
huextrat:feat/sticky-indices-v3

Conversation

@huextrat
Copy link
Contributor

@huextrat huextrat commented Feb 20, 2026

fixes: #400

v2 -> #401

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-02-20.at.16.58.02.mov

Addresses an issue with sticky header indices.
Improves header behavior for push effect.

It now computes next sticky position and item size.
Adds a property to determine the position.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 370df1e43c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +574 to +580
if (currentStickyArrayIdx >= 0 && currentStickyArrayIdx < stickyIndicesArr.length - 1) {
const nextStickyDataIndex = stickyIndicesArr[currentStickyArrayIdx + 1];
const nextStickyId = idCache[nextStickyDataIndex] ?? getId(state, nextStickyDataIndex);
const nextStickyPos = nextStickyId ? positions.get(nextStickyId) : undefined;
const prevNextPos = peek$(ctx, `containerStickyNextPosition${containerIndex}`);
if (nextStickyPos !== prevNextPos) {
set$(ctx, `containerStickyNextPosition${containerIndex}`, nextStickyPos);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reset next-sticky position when no successor exists

This branch only updates containerStickyNextPosition when the current sticky item has a following sticky index, but it never clears the previous value when the container is reused for the last sticky item. In calculateItemsInView, a recycled sticky container can therefore keep a stale next-position from an earlier header, and PositionViewSticky/ReanimatedPositionViewSticky will still enable push behavior and push the final sticky header offscreen incorrectly. Add an else path to explicitly set containerStickyNextPosition to undefined when there is no next sticky item.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant