Skip to content

Conversation

E-m-i-n-e-n-c-e
Copy link
Contributor

@E-m-i-n-e-n-c-e E-m-i-n-e-n-c-e commented Jan 17, 2025

Closes #83

Closes #82

Started working on this.
Here's what i did

  • Added an optional parameter anchor to MessageList and started fetching newer Messages similar to how older messages were being fetched around the anchor(if one is given)

  • Changed the single sliver to two slivers that grow in opposite directions. The center is after the anchor message with newer messages growing downward in the bottom sliver

  • Handled the case of when user is looking at the latest messages by adding a condition that when the scroll is less than (viewport size + 300 px) away from the bottom it scrolls down to the bottom. This is required now as adding new messages doesn't cause the messages to jump up. Fetching newer messages causes no jump or scroll though

  • The navigateToBottom button was initially set to scroll down to 0 which was after the changes was only scrolling down to the zero index of the toplist so i changed it to scrolldown to maxScrollExtent.

But still the navigate button works correctly when new messages are fetched as part of the scrolling process but when a single message is added to the list the maxScrollExtent does not scroll all the way down as it (for some reason) calculates the maxScrollExtent wrong.

What I did to fix the above problem was to call the scrollDown function repeatedly until the end is reached.

Videos:

20250119-1825-45.3281596.mp4
20250119-1831-50.5506127.mp4

Chat:

https://chat.zulip.org/#narrow/channel/516-mobile-dev-help/topic/Control.20scroll.20position.20on.20new.20and.20newly-fetched.20messages

@E-m-i-n-e-n-c-e E-m-i-n-e-n-c-e marked this pull request as draft January 17, 2025 15:12
@E-m-i-n-e-n-c-e E-m-i-n-e-n-c-e force-pushed the #82 branch 2 times, most recently from 6512c1e to 3d9e342 Compare January 19, 2025 18:13
@E-m-i-n-e-n-c-e E-m-i-n-e-n-c-e changed the title Started working Started working #82 Jan 19, 2025
@E-m-i-n-e-n-c-e E-m-i-n-e-n-c-e changed the title Started working #82 Started working #83 Jan 19, 2025
@E-m-i-n-e-n-c-e E-m-i-n-e-n-c-e force-pushed the #82 branch 2 times, most recently from 2b6fa9e to f013da3 Compare January 23, 2025 14:14
@gnprice
Copy link
Member

gnprice commented May 28, 2025

Thanks @E-m-i-n-e-n-c-e for giving this a try. Closing in favor of #1517 and the series of PRs that led up to it (including #1507 which fixed most of #83).

@gnprice gnprice closed this May 28, 2025
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.

Control scroll position on new and newly-fetched messages Open a message list in the middle of history, when requested

2 participants