Skip to content

Commit

Permalink
A little tweak to getting the animations for an exiting instruction f…
Browse files Browse the repository at this point in the history
…rom the NavigationContainer; if the current backstack is empty, always get the closing animation.
  • Loading branch information
isaac-udy committed Mar 1, 2023
1 parent ba0835a commit d204370
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public object DefaultAnimations {
else -> ForView.presentCloseEnter
}

val exitingAnimation = when (exiting.originalNavigationDirection()) {
val exitingAnimation = when (exiting.navigationDirection) {
NavigationDirection.Push, NavigationDirection.Forward -> ForView.pushCloseExit
else -> ForView.presentCloseExit
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public fun NavigationContainer.getAnimationsForExiting(instruction: AnyOpenInstr
val activeInstruction = currentTransition.activeBackstack.active
?: return animations.closing(instruction, null).exiting

if(currentTransition.lastInstruction is NavigationInstruction.Close) {
if(currentTransition.lastInstruction is NavigationInstruction.Close || backstack.isEmpty()) {
return animations.closing(instruction, activeInstruction).exiting
}
return animations.opening(instruction, activeInstruction).exiting
Expand Down

0 comments on commit d204370

Please sign in to comment.