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

Added support for components with vertical scroll #163

Merged
merged 4 commits into from
Aug 5, 2021

Conversation

vinaygaba
Copy link
Collaborator

@vinaygaba vinaygaba commented Aug 5, 2021

Fixes #138

Showkase wasn't able to preview components that contained vertical scroll functionality. This was due to a check added by Compose internally to crash on nested scroll components when the scrollers are in the same direction. This is an intentional design decision by Compose. I'm adding a screenshot below to explain why this design decision was made for anyone that is curious.

You might ask why this happens in Showkase even when a component doesn't have a nested scroller. That's because the Showkase browser itself is written in Compose and it renders all the components inside a LazyColumn. That's why when you tried entering a screen where the components with a scroller are being previewed, it would crash.

In this PR, I add a maxHeight limit that's equal to the size of the screen to the card that previews the component. This ensures that each component is only occupying at most the height of the screen. This is a reasonable size limit as most components should be able to sufficiently render their preview.

Screen Shot 2021-08-04 at 10 29 57 PM

Screen Shot 2021-08-04 at 10 41 56 PM

@BenSchwab @elihart @Dambakk

@vinaygaba vinaygaba merged commit 15e4f43 into master Aug 5, 2021
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.

Previewing a component that is scrollable
2 participants