Skip to content

fix: keep native content in place when a header above the viewport resizes - #607

Open
chrispader wants to merge 1 commit into
LegendApp:mainfrom
chrispader:fix/native-header-size-mvcp
Open

chrispader wants to merge 1 commit into
LegendApp:mainfrom
chrispader:fix/native-header-size-mvcp

Conversation

@chrispader

Copy link
Copy Markdown

setHeaderSize only compensates header size changes on web (#468). On native, maintainVisibleContentPosition anchors to the absolutely positioned ScrollAdjust view, which a header resize doesn't move. The scroll offset stays where it was, and the visible items move by the size difference. With this change, header size changes above the viewport request the same adjustment on every platform.

On Android, a header that shrinks near the end of the content can first clamp the scroll offset to the new end. The item-resize path in prepareMVCP already handled that clamp, so it moves to a shared helper that both paths use.

We hit this in Expensify/App#100733, which moves the chat message list to LegendList. While offline, the chat shows a loading placeholder as the list header, and when it disappeared on reconnect, the messages on screen moved by its height. Expensify currently carries this fix as a patch.

Reproduction

  1. On iOS or Android, render a list with maintainVisibleContentPosition and a ListHeaderComponent whose height can change, scrolled so that the header is above the viewport.
  2. Change the header's height.
  3. Verify the items on screen don't move.

🤖 Generated with Claude Code

…sizes

setHeaderSize only compensated header size changes on web. On native,
maintainVisibleContentPosition anchors to the absolutely positioned
ScrollAdjust view, which a header resize does not move, so the native
scroll offset stayed where it was and the visible items moved by the size
difference. For example, removing a loading placeholder rendered as the
list header shifted the rows the user was reading.

Header changes above the viewport now request the same adjustment on every
platform. On Android, shrinking content can first clamp the scroll offset to
the new end. The MVCP item-resize path already handled that clamp, so it
moves to a shared helper that both paths use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-11T12:15:26.026792Z
We couldn’t complete this review. Comment @codex review to try again.
e56e135 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

chrispader added a commit to margelo/Expensify that referenced this pull request Nov 12, 2026
The patch now is the build output of LegendApp/legend-list#607. That PR
applies LegendList's header-size adjustment on every platform and reuses the
Android clamp handling that item resizes already have, instead of the
header-only copy of it. The patch also gets its details.md entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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