-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
native: increase channel scroll position stability when loading to anchor #3878
Conversation
- Rename (flipped) `hasFoundAnchor` -> `needsScrollToAnchor` - Move scroll-to-anchor to shared callback with built-in checks - Stop attempting imperative scroll-to-anchor when laying out any item - Attempt scroll-to-anchor again after failing to scroll - Disable autoscrollToTopThreshold when user hasn't scrolled yet
- Use enum to explicitly track anchor layout status - Mark page as ready for display if either (1) scroll-to-anchor succeeded, or (2) we gave up waiting for anchor - Avoid concurrent attempts to scroll to anchor - Animate scroll when jumping to anchor if we're already showing the page; if we're not showing, jump without animation
Heroic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much easier to read through! Appreciate the copious amount of comments <3
The posts disappearing during search scrollback feels like a regression we should address before merging, but otherwise this feels like a much better base to build off of.
…il/anchor-scroll-lock-2
In the before case, I didn't record jumping to the selection anchor from search page – it anchored correctly to the item, but only after scroll position jumped up and down a few times.
There are still some white flashes at 5817765, which I tried to capture but could not – in any case, I think the flashes are much briefer. starting at 6765d3f...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes make sense to me. Likewise curious if you'd have feedback on the modified post fetch count @dnbrwstr.
Excellent work on the fixes! Was feeling really good on my dev build.
around
anchor – here's the worst case I could find for the "before" case - most of the time it's relatively stable with a small blip in position.before-load-around-worstcase.mp4
after-load-around.mp4
before-load-blitz.mp4
after-load-blitz.mp4
Load newer
button that adds posts to the "new" end of the timelinebefore-loading-newer-posts.mp4
after-loading-newer-posts.mp4
Math.random
with a seeded random infakeData.ts
– this ensures that Cosmos fixtures always look the same (unless you change the seed).Channel
fixtures: one that simply loads a chat with an unread anchor, and one that has a toolbar for interactively loading posts in different ways.anchorIndex
) – removed attempts to scroll when non-anchor list items are laid out. (My guess is that this used to be the case to emulatemaintainVisibleContentPosition
as list items moved the anchor around, but we can rely on mvcp now.)needsScrollToAnchor = true
, and wait for an anchor layout to trigger a scroll.I kept the existing code for
autoscrollToTopThreshold
, but I believe that that feature is broken in the build of RN that we are using – we should apply facebook/react-native#38245 (tested in a quick-n-dirty patch and appears to work)Content is still shifting a little bit as things load in: I believe this is due to images in messages resizing themselves, and thus their
ChatMessage
containers.I've logged into this client on my live ship and browsed around to channels with lots of unreads, and some with no unreads – things seem fairly stable. (Did the same with current release client and it is less scroll-stable.)