From d2043706325d902b5a015a9c4a9763c54af86239 Mon Sep 17 00:00:00 2001 From: Isaac Udy Date: Wed, 1 Mar 2023 19:10:19 +1300 Subject: [PATCH] A little tweak to getting the animations for an exiting instruction from the NavigationContainer; if the current backstack is empty, always get the closing animation. --- enro-core/src/main/java/dev/enro/core/NavigationAnimations.kt | 2 +- .../main/java/dev/enro/core/container/NavigationContainer.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/enro-core/src/main/java/dev/enro/core/NavigationAnimations.kt b/enro-core/src/main/java/dev/enro/core/NavigationAnimations.kt index 8a8f74e4..9ebdb471 100644 --- a/enro-core/src/main/java/dev/enro/core/NavigationAnimations.kt +++ b/enro-core/src/main/java/dev/enro/core/NavigationAnimations.kt @@ -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 } diff --git a/enro-core/src/main/java/dev/enro/core/container/NavigationContainer.kt b/enro-core/src/main/java/dev/enro/core/container/NavigationContainer.kt index bbe2542f..124f198d 100644 --- a/enro-core/src/main/java/dev/enro/core/container/NavigationContainer.kt +++ b/enro-core/src/main/java/dev/enro/core/container/NavigationContainer.kt @@ -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