-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update screen transition #428
Conversation
@Composable | ||
public fun ScreenTransition( | ||
navigator: Navigator, | ||
screenTransition: ScreenTransition, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
practice has shown that it is convenient to get a default transition as ScreenTransition
argument here
|
||
import cafe.adriel.voyager.transitions.ScreenTransition | ||
|
||
data class NoCustomAnimationSampleScreen( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we navigate to this screen, or pop from it, default animation will be used
override val index: Int, | ||
) : BaseSampleScreen() | ||
|
||
data class FadeAnimationSampleScreen( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we navigate to this screen, or pop from it, fade animation will be used
b9eb285
to
c4d22da
Compare
c4d22da
to
2a68388
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Looking great.
voyager-transitions/src/commonMain/kotlin/cafe/adriel/voyager/transitions/ScreenTransition.kt
Show resolved
Hide resolved
public fun enter(isPop: Boolean): EnterTransition? = null | ||
|
||
/** | ||
* Defines the exit transition for the Screen. | ||
* | ||
* Returns null when it should not define a transition for this screen. | ||
*/ | ||
public fun exit(): ExitTransition? = null | ||
public fun exit(isPop: Boolean): ExitTransition? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still not 100% sure if isPop
is enough, there are cases where other events maters for transition besides pop? if so, we could pass the navigation last event directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Can you also update the docs in the repo? We have moved to the repo |
4b6530a
to
683bd46
Compare
683bd46
to
c195baf
Compare
@DevSrSouza If there are no more problems, maybe we can merge the request? |
@shpasha Can you update this docs @shpasha https://github.com/adrielcafe/voyager/blob/main/docs/transitions-api.md ? Adding the new ScreenTransition function and some examples using delegate implementation, etc. |
@DevSrSouza docs updated |
Awesome work, thanks for the contribution |
A slightly different approach to screen transitions. Now the active screen (the one we push) determines the animation. We already have this approach in our approach and it is very convenient.
I also added lastEvent to the enter/exit to understand the slide direction
sample.webm