Anyone know what the status is on shared element t...
# compose
n
Anyone know what the status is on shared element transitions in compose navigation ?
j
Early stages, but you can experiment with this: https://github.com/skydoves/Orbital
n
Is the Orbital lib in anyway related to what is being worked on in accompanist?
j
i don't think so, it's related to LookaheadLayout
n
Aight thanks, will check it out 👍
i
LookaheadLayout has been ~superceded by usages of LookaheadScope as part of yesterday's release https://developer.android.com/jetpack/androidx/releases/compose-animation#1.5.0-alpha02 (see for example the example experiment at https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]mpose/animation/demos/lookahead/AnimateBoundsModifier.kt;l=47 which implements animating the bounds of a view with just a modifier)
That LookaheadScope part is what needs to be applied to APIs like AnimatedContent first. That would allow shared elements between screens you display in AnimatedContent
And it is AnimatedContent that powers Accompanist Navigation Compose, so as soon as AnimatedContent gains such super powers, so will the Navigation Compose integration
🚀 1
n
Thanks a lot for the update Ian, is there any issue tracker or similar where we can follow the status on Accompanist or AnimatedContent?
i
https://issuetracker.google.com/issues/202470191 is the issue for supporting shared elements, which would include up through
AnimatedContent
And https://issuetracker.google.com/issues/197140101 is for moving Accompanist Navigation Animation back into Navigation Compose itself (which is possible now that AnimatedContent is no longer experimental - it'll be part of the Navigation 2.7 release)
n
Aight looking forward to the new features 🎂 Will there be lots of API changes compared to how Accompanist Navigation is now?
i
I don't know - do you like the Accompanist Navigation API? 🙂
n
😄 Was more out of a sense of curiosity on how it will change. I'm not very attached to it, as long as I can create UI flows with shared elements i'm happy 😁
i
ha, no changes expected, but everything is tbd until we see what the shared element API looks like
Which would preclude needing specific APIs at the Navigation level
n
Read through the thread you linked, I like the modifier approach as well. Is there any of these changes that would make having shared elements in a nested graph ? e.g. on the official example:
Copy code
NavHost(navController, startDestination = "home") {
    ...
    // Navigating to the graph via its route ('login') automatically
    // navigates to the graph's start destination - 'username'
    // therefore encapsulating the graph's internal routing logic
    navigation(startDestination = "username", route = "login") {
        SharedElementLoginLevel()
        composable("username") { ... }
        composable("password") { ... }
        composable("registration") { ... }
    }
    ...
}
So a shared element between all login routes.