Closed isles1217 closed 1 year ago
Navigation Compose already has a listener for this - the Lifecycle
of the NavBackStackEntry
only reaches RESUMED
when the animation completes.
The DisposableEffect
guide actually uses listening for lifecycle events as its example. b/209684871 tracks exposing Lifecycle.State
as Compose State much easier, which would help with this case as well.
Note that we have also talked about listening to observing navigation transition state in #633, something which we also added APIs to do for listening to transition effects outside of an individual destination (e.g., for cases like a bottom nav, etc. that is shared across all destinations).
Description I'd love it if an animation listener could be added to the
AnimatedNavHost
component. I use some components that have a scale modifier, and I'd like to prevent those composables from scaling until the navigation animation completes. The reason being, is that components that scale get put on a separate drawing layer, and end up looking "cut off" until the animation is complete.Steps to reproduce
.scale(1.2f)
modifier to the button.Additional context I imagine the simplest solution here would be to attach an animation listener to the screen transition, that I could use to let my composables know when they're allowed to scale (after the transition animation is complete).