-
Notifications
You must be signed in to change notification settings - Fork 74
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
In UIViewLazyList's UITableView, adding special-case handling for programmatic scroll-to-top calls #1944
Conversation
|
||
// Notify the scrollProcessor as needed | ||
if (wasDoingProgrammaticScroll) { | ||
scrollViewDidScroll(scrollView) |
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.
I know that this method should not be called for programmatic scrolls, but without this call, the placeholders at the top of the scrollView remain in place after the scroll animation finishes, without being swapped out for rendered widgets.
With this call in place, we see two animations: the scroll itself (up to the top of the scrollView), followed by a second animation where the "wall of placeholders" being shown collapses upward, to be replaced with rendered widgets.
Is there a better hook to call here? Ideally the placeholders would swap out for rendered widgets without the second animation after the scroll finishes.
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.
cc @swankjesse
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.
I played around with some alternatives, replacing the scrollViewDidScroll(scrollView)
call with each of the following:
updateProcessor.onEndChanges()
(scrollView as? UITableView)?.reloadData()
scrollView.setNeedsDisplay()
but all of them kept the "wall of placeholders" in place. I wish we could do something akin to the lazyPagingItems.refresh()
call we're doing in the Treehouse layer, which repopulates the feed without animation.
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.
Marginal improvement: rather than keeping track of wasDoingProgrammaticScroll
, it's better to just use the native scrollViewDidScrollToTop hook (which is actually fired earlier than this hook).
This feels better, but the above concern (needing to get rid of the second animation) remains to be addressed.
19d7259
to
1cb4930
Compare
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.
Would prefer Jesse take a look still
...lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt
Outdated
Show resolved
Hide resolved
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.
Just to confirm before merging. Did you test this on the money app from regressions?
I'm not seeing anything happen at all when tapping on the tab bar icon for the Money tab--looks like scroll-to-top behavior hasn't been implemented on the client side yet? |
1cb4930
to
ed0f4cd
Compare
Oh yeah, the tab button isn't hooked up (not sure if that's part of the plan, but does tapping to status bar still work? It will scroll to top for us rn without doing anything extra |
Yep, that still works as expected! |
7ef0945
to
9b25379
Compare
…grammatic scroll-to-top calls
9b25379
to
8a74958
Compare
… the LazyListScrollProcessor so that it can update its viewport early Follow-up to PR #1944
… the LazyListScrollProcessor so that it can update its viewport early Follow-up to PR #1944
… the LazyListScrollProcessor so that it can update its viewport early Follow-up to PR #1944
… the LazyListScrollProcessor so that it can update its viewport early Follow-up to PR #1944
… the LazyListScrollProcessor so that it can update its viewport early Follow-up to PR #1944
CHANGELOG.md
's "Unreleased" section has been updated, if applicable.