Skip to content

Commit

Permalink
Update transitionSpec to avoid behavior change
Browse files Browse the repository at this point in the history
  • Loading branch information
DevSrSouza committed May 21, 2024
1 parent e9127ac commit c9a3c07
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,25 @@ public fun ScreenTransition(
val contentTransform = transition()

val isPop = navigator.lastEvent == StackEvent.Pop
val exitTransition = if(isPop) {

val screenEnterTransition = if(isPop) {
(targetState as? ScreenTransition)?.enter()
} else {
(targetState as? ScreenTransition)?.enter()
}

val screenExitTransition = if(isPop) {
(initialState as? ScreenTransition)?.exit()
} else {
(initialState as? ScreenTransition)?.exit()
}
?: contentTransform.initialContentExit

val enterTransition = if(isPop) {
(targetState as? ScreenTransition)?.enter()
if(screenExitTransition != null || screenEnterTransition != null) {
(screenEnterTransition ?: contentTransform.targetContentEnter) togetherWith
(screenExitTransition ?: contentTransform.initialContentExit)
} else {
(targetState as? ScreenTransition)?.enter()
contentTransform
}
?: contentTransform.targetContentEnter

enterTransition togetherWith exitTransition
},
modifier = modifier
) { screen ->
Expand Down

0 comments on commit c9a3c07

Please sign in to comment.