Any opinions on <https://github.com/google/accompa...
# compose
f
Any opinions on https://github.com/google/accompanist/issues/729 (offering the possibility for animated navigation transitions with a single
NavHost
)? Should I report an issue on the Google Issue Tracker instead?
i
That's the right place for it
j
Same issue here. Currently I put the bottom bar outside the NavHost and am showing/hiding it depending on the backstack entry. This works well when transitioning between bottom bar destinations but not so well when transitioning to any other destination (the bottom bar will “suddenly” disappear just before the transition animation begins). I wish there was a better way, is it that much discouraged to nest NavHosts?
i
The only reason it suddenly disappears is because that's what you've written - there's so many ways to nicely animate composables out that even something like
AnimatedVisibility
will be way nicer than just a simple if statement
You might take a look at Navigation 2.4.0-alpha10's new
navController.visibleEntries
StateFlow: https://twitter.com/ianhlake/status/1443278698015170560
Since that contains entries that are animating in and out, you'll know what screen is animating out (it is the one that is only
CREATED
) and you can use it to only run an animation when the NavController finishes its transition (the last entry's Lifecycle reaches the
RESUMED
state)
f
But still, animating in a screen above the bottom bar is not possible. I hope we'll get there 🙂
i
What actually does 'animated in a screen above the bottom bar' actually mean? "Over the bottom bar" really just means that you want to ignore the bottom padding that the Scaffold provides (thus, overlapping the bottom bar) and setting a higher zIndex (via the modifier of that name). What makes you think that isn't possible right now?
f
The problem is that some destinations of the
NavHost
need to be under the bottom bar and some over it (at least that's required to allow all kinds of animations). Using
zIndex
in
Scaffold
to put the body over the bottom bar did not work when I last tried it (maybe I did something wrong), but it works with a custom
Scaffold
implementation, so that's a work around for a limited set of animations. Modifying
zIndex
per destination had not effect when I last tried it (which is what I would expect).