fornewid / material-motion-compose

Material Motion for Jetpack Compose and Compose Multiplatform
https://fornewid.github.io/material-motion-compose/
Apache License 2.0
614 stars 12 forks source link

Integration with navigation-compose #27

Closed fornewid closed 3 years ago

fornewid commented 3 years ago

It is expected that transition animations can be applied to navigation-compose after some time. The following link is related to this.

Then, it seems that it needs to be changed to a form that can be combined with navigation-compose.

itsandreramon commented 3 years ago

Excited for this one.

fornewid commented 3 years ago

Jetpack Navigation team is working for this. https://android-review.googlesource.com/c/platform/frameworks/support/+/1754655

fornewid commented 3 years ago

Maybe a new library will be added to accompanist..? 👀 https://github.com/google/accompanist/pull/574

pblinux commented 3 years ago

accompanist v0.16.0 now includes support for animations in navigation 🥳 🎉

We can use EnterTransition and ExitTransition with the new AnimatedNavHost

val navController = rememberAnimatedNavController()

AnimatedNavHost(
    navController = navController,
    startDestination = 'some-route',
    enterTransition = { _, _ ->
        materialSharedAxisX(forward = true, slideDistance = 30).enter.transition
    },
    exitTransition = { _, _ ->
        materialSharedAxisX(forward = false, slideDistance = 30).exit.transition
    }
) {
    // Our composables can have individual transitions too
}