Skip to content

Comments

List now scrolls down, left and right on dpad interaction#1

Open
AyoTheDev wants to merge 4 commits intothesauri:mainfrom
AyoTheDev:feature/scrollable
Open

List now scrolls down, left and right on dpad interaction#1
AyoTheDev wants to merge 4 commits intothesauri:mainfrom
AyoTheDev:feature/scrollable

Conversation

@AyoTheDev
Copy link

@AyoTheDev AyoTheDev commented Jan 21, 2022

I came across BringIntoViewRequester from this article:

https://medium.com/tech-takeaways/automatic-scrolling-to-composable-on-focus-change-with-bringintoviewrequester-in-jetpack-compose-bdeb72242bac

I've integrated this into ScrollableGrid.

I've also added a KeyEventListener so that if we're on the first or last item in a row, the d-pad event is not propagated

If you have any thoughts/idea's that would be greatly appreciated

@AyoTheDev AyoTheDev changed the title List now scrolls down, left and right on dpad interaction [WIP] List now scrolls down, left and right on dpad interaction Jan 21, 2022
@AyoTheDev AyoTheDev changed the title [WIP] List now scrolls down, left and right on dpad interaction List now scrolls down, left and right on dpad interaction Jan 21, 2022
@thesauri
Copy link
Owner

thesauri commented Jan 23, 2022

Thanks for the contribution!

Out-of-the-box support for this seems to have been added since when I initially wrote this.

I tried your repository that includes a newer version of Compose, but reverted the changes to ScrollableGrid. Even without calling .bringIntoView scrolling seems to occur:

Screen.Recording.2022-01-23.at.12.38.05.mov

Could you verify this behavior and revert the changes to ScrollableGrid if this is the case?
Also, could you update the compose_version variable and use it for androidx.compose.foundation:foundation as in the other Compose dependencies?

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.

2 participants