Skip to content
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

Scroll to the bottom of timeline automatically #5484

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

Anderas
Copy link
Contributor

@Anderas Anderas commented Feb 2, 2022

Fixes #4524

The isBubblesTableScrollViewAtTheBottom method was being used in viewDidLayoutSubviews to determine, whether to scroll to the bottom-most bubble. The issue is however that viewDidLayoutSubviews may change the size of the view, making isBubblesTableScrollViewAtTheBottom give the wrong result.

To solve this we need to capture the value of isBubblesTableScrollViewAtTheBottom during viewWillLayout and use that value in viewDidLayoutSubviews

// stay at the bottom if already was
if (self.isBubblesTableScrollViewAtTheBottom)
// re-scroll to the bottom, if at bottom before the most recent layout
if (self.shouldScrollToBottomAfterLayout)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to make shouldScrollToBottomAfterLayout false again after we scrolled to bottom?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. In practice it would not cause issues without (will/didLayout go in pair), but it will make it more explicit to reset.

@Anderas Anderas force-pushed the andy/4524-fix-timeline-scroll branch from 3afe6e4 to 0c6034e Compare February 2, 2022 14:58
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

📱 Scan the QR code below to install the build for this PR.
🔒 This build is for internal testing purpose. Only devices listed in the ad-hoc provisioning profile can install Element Alpha.

QR code

If you can't scan the QR code you can install the build via this link: https://i.diawi.com/WAt4Wm

@Anderas Anderas merged commit 03e9208 into develop Feb 2, 2022
@Anderas Anderas deleted the andy/4524-fix-timeline-scroll branch February 2, 2022 16:03
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.

The timeline scroll view doesn't always start at the bottom.
2 participants