google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.43k stars 598 forks source link

[Navigation Animation] Possibility to define ContentTransform #1611

Closed hrach closed 1 year ago

hrach commented 1 year ago

Description

Currently, transitions are defined per screen, e.g. screen has horizontal Slide transitions for enter and exist transitions.

In some scenarios (like opening a "picker" screen), we want the picker to slide from the bottom. That's possible by setting this vertical slide transition for this destination.

The problem is, that this vertical enter slide transition is combined with horizontal exit slide transition of the previous destination. In these cases, we would like to keep the current destination without any animation (e.g. using ExitTransition.None).

AnimatedContent support this, but the way how AnimatedNavHost provodes an API and "joins" those enter/exit transitions together makes this impossible. The only alternative is copy over AnimatedNavHost and add additional API.

ianhanniballake commented 1 year ago

As per the Animations in Navigation Compose, you can control both the enter and exit transition not only at a single destination level, but at the navigation graph level as well.

That would allow you to also customize the exit transition to always be ExitTransition.None when going from your picker screen from whatever screen you are returning to.