Skip to content

Commit

Permalink
add one more check to compare current and target state
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk committed Jul 10, 2024
1 parent 93bfb0e commit 02d742a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ object WaitUntilTransitionEndsWrapper : DestinationWrapper {
override fun <T> DestinationScope<T>.Wrap(screenContent: @Composable () -> Unit) {
(this as? AnimatedDestinationScope<T>)?.let {
var transitionComplete by remember { mutableStateOf(false) }
LaunchedEffect(transition.isRunning, transition.currentState) {
transitionComplete = !transition.isRunning && transition.currentState == EnterExitState.Visible
LaunchedEffect(transition.isRunning, transition.currentState, transition.targetState) {
with(transition) {
transitionComplete = !isRunning && currentState == targetState && currentState == EnterExitState.Visible
}
}
screenContent()
if (!transitionComplete) {
Expand Down

0 comments on commit 02d742a

Please sign in to comment.