Hi :slightly_smiling_face: With compose navigation...
# compose
c
Hi 🙂 With compose navigation bottom bar, how can I get the usual behaviour of scrolling to top when tapping the icon of the screen i'm already on ?
p
Hi, I had similar problem to solve but not for nav bottom bar so may be, my solution will not be ideal for your case. The idea is to recreate [scrollState] and recompose with new state:
Copy code
val scrollState = remember(key) {
    ScrollState(
        flingConfig = flingConfig,
        initial = 0f,
        animationClock = animationClock,
        interactionState = null,
    )
}

ScrollableColumn(
    scrollState = scrollState,
) {...}
when you detect tap on the icon - update the [key] and trigger recomposition. I'm not sure this is the best approach, so if someone has different approach in mind please let me know.
👍 1
c
oh ok yeah that's not super intuitive but it's smart, thanks ! ^^