has anyone using compose-navigation figured out a ...
# compose
c
has anyone using compose-navigation figured out a reliable way to match the animation specs of the NavHost with whether or not the navigation is a "tab navigation" to a different graph? I would have thought that
popEnterTransition
would be activated when using the typical tab navigation -
Copy code
navController.navigate(myTab) {
    popUpTo(navController.graph.findStartDestination().id) { 
        ...
    }
    ...
}
s
Hmm could you elaborate further? Do you want a different animation to play when you specifically navigate between your top tabs, but not all other destinations?
i
This was actually one of the examples in the original blog post: https://medium.com/androiddevelopers/animations-in-navigation-compose-36d48870776b See the paragraph that starts with "If you instead want to change the default for only one subgraph"
thank you color 1
c
thanks Ian - seems like the best way is checking the initial & destination routes and specifying the animation accordingly then 👍
@Stylianos Gakis the idea is to implement the 'Top Level' transition pattern like described in the m3 docs - https://m3.material.io/styles/motion/transitions/transition-patterns#f852afd2-396f-49fd-a265-5f6d96680e16 Personally I like lateral transitions (like turning a book page) for navigating deeper to child routes with detail screens. Then I use a top level transition like a 'blink' when changing tabs to make it clear the content isn't related in any child/parent hierarchy. The default SwiftUI navigation in iOS follows this pattern too and is quite nice. Very doable in compose but it's not the default behaviour
👍 1