JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.27k stars 1.18k forks source link

Make iOS-like animations in `navigation-compose` by default #4528

Closed PMARZV closed 1 month ago

PMARZV commented 7 months ago

Since @MatkovIvan is working in commonizing all androidx libraries related to Navigation (lifecycle, navigation, savestate), it would be super cool to have IOS-like back animations for IOS (or maybe for all platforms). I've seen users say they can tell when an app is native or not depending on the back animation.

It would be a great addition to the overall experience!!

predictive back gesture would be great too (but for all version codes!!!)

Example:

https://github.com/JetBrains/compose-multiplatform/assets/100836358/21a93b71-9b09-4d1e-b0e4-25159f2c8758

MatkovIvan commented 7 months ago

it would be super cool to have IOS-like back animations

I know it's not the same, but sliding animations might be easily implemented like:

val animationSpec = tween<IntOffset>(700)
NavHost(
    navController = navController,
    startDestination = startDestination,
    enterTransition = { slideIntoContainer(SlideDirection.Left, animationSpec) },
    exitTransition = { slideOutOfContainer(SlideDirection.Left, animationSpec) },
    popEnterTransition = { slideIntoContainer(SlideDirection.Right, animationSpec) },
    popExitTransition = { slideOutOfContainer(SlideDirection.Right, animationSpec) }
) { ... }

We might tune default behaviour in the future, but don't expect it in first versions. Our general vision here is that should be possible to implement this via only public API, so everyone might customize it for their specific needs

predictive back gesture

It on our radar too, no promises about ETA yet

liufeng382641424 commented 7 months ago

@MatkovIvan Does navigation-compose already support kmp?

MatkovIvan commented 7 months ago

JetBrains started to publish dev builds of a multiplatform version of this package, but there is no stable version yet. Usage example: https://github.com/MatkovIvan/nav_cupcake Tracking of adding multiplatform support was there: https://github.com/JetBrains/compose-multiplatform/issues/85#issuecomment-2036264640

okushnikov commented 4 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.