Sitelet https://github.com/android/compose-samples/pull/778
Skip to content

[JetSnack] Move scroll state reads into layout phase via lambdas - #778

Merged
bentrengrove merged 1 commit into
mainfrom
ben/recomp_counts
Apr 13, 2022
Merged

bentrengrove merged 1 commit into
mainfrom
ben/recomp_counts

Conversation

@bentrengrove

@bentrengrove bentrengrove commented Apr 13, 2022 •

Copy link
Copy Markdown
Member

Fixes janky scrolling on the JetSnack details page.
Fixes #231

It should not be necessary to recompose just to relayout a page. JetSnack has a collapsing toolbar like layout on the details page, it shrinks the image and moves the title text up on scroll. This was previously done using composition but by moving the read of the scroll value into a lambda, we can read the value only during layout and skip the composition phase entirely.

@bentrengrove
bentrengrove merged commit e9f5d03 into main Apr 13, 2022
@bentrengrove
bentrengrove deleted the ben/recomp_counts branch April 13, 2022 23:58
@wnduqrla

wnduqrla commented Oct 1, 2022

Copy link
Copy Markdown

Your idea is so impressive for me.
Thank you 👍

@manosbatsis

Copy link
Copy Markdown

Great example for explaining this within my team. Thank you @bentrengrove !

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.

[Jetsnack] Vertical scrolling is janky

4 participants