Skip to content

fix(android): read every scroll offset from the offset model - #48

Open
SectionTN wants to merge 3 commits into
feat/android-model-feedfrom
feat/android-model-offsets
Open

SectionTN wants to merge 3 commits into
feat/android-model-feedfrom
feat/android-model-offsets

Conversation

@SectionTN

Copy link
Copy Markdown
Owner

stacked on #47. Android took its scroll offset from RecyclerView's estimate: the average length of the laid-out rows times the rows above them. rows of different heights threw it off, so scrollTo({ y: 400 }) stopped at 415. 118 dp down the React example the offset read 73 dp, under an autoscrollToTopThreshold of 100, so a prepend there would scroll the list to the top.

both layout managers now read offset, range and extent from the offset model. onScroll, the content size, the edge events, the anchoring threshold, pull to refresh and the scroll bars all get the real offset. when a row above the viewport measures and moves the offset without a scroll, a scroll event goes out, as UIKit does.

scrollToOffset and scrollTo now land on the row that holds the offset, plus the remainder, through the same jump as scrollToIndex. React rows render before it lands, and an offset sent right after an index in the same frame now wins. an instant scrollToOffset to the end of the React example used to take frames of 48 to 85 ms, now none goes over 32 ms.

RecyclerView estimated the scroll offset as the laid-out rows' average
length times the rows above them, so offsets, content size, edge distances
and the anchoring threshold drifted with row lengths. 118 dp down the React
example it read 73 dp, under an autoscrollToTopThreshold of 100. Both layout
managers now read offset, range and extent from the offset model, which pull
to refresh and the scroll bars read too.
… length

A row above the viewport that measured at another length than its estimate
moved the offset with no scroll, so onScroll could keep the old value until
the next scroll step. A card above row 300 in the React example moved it by
84 dp. A layout pass that moves the offset now sends a scroll event, as
UIKit does when it adjusts contentOffset.
scrollToOffset scrolled by the distance from RecyclerView's estimated
offset, so scrollTo({ y: 400 }) stopped at 415 when the rows above it had
other heights. It now lands on the row that holds the offset, plus the
remainder, through the same jump as scrollToIndex: React rows render before
it lands, and data that changes before the landing moves the landing with
it. An animated scroll jumps near a far target first, then glides to that row.
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 969b419b-b25e-44e6-9014-b29edb6a7895

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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