Is there a way to add Snapping behavior for `Horiz...
# compose
a
Is there a way to add Snapping behavior for
Horizontal Scroller
just like how
ViewPager
snaps per page?
h
I'm on mobile so I can't find the exact class but Jetpack Compose Playground app should have an example that implements this behavior
a
It seems that theres alot of examples there. Do you know which one I should look into?
z
I think there's some Fling-related stuff that does snapping. Maybe FlingConfig?
f
Take a look at SpringBackScrollingDemo . zachklipp is right, there is a fling() for an AnimatedFloat and a animateTo(). https://github.com/Foso/Jetpack-Compose-Playground/blob/master/compose/src/main/java/androidx/compose/animation/SpringBackScrollingDemo.kt
a
@Foso does this mean I have ditch
ScrollableRow
all together? And handle the scrolling by myself?
f
I don't know, i haven't seen an compose equivalent of a viewpager yet. I think you have to build yourself, or maybe this is working: https://github.com/vanpra/ComposeViewPager