From 77677cead3664f31cdfd2a2b65421fe61ff190f3 Mon Sep 17 00:00:00 2001 From: GG Bond Date: Wed, 27 Dec 2023 22:08:52 +0800 Subject: [PATCH] Fix regression --- .../androidx/navigation/compose/NavHost.kt | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/app/src/main/kotlin/androidx/navigation/compose/NavHost.kt b/app/src/main/kotlin/androidx/navigation/compose/NavHost.kt index 392269ae7..6694e3fa1 100644 --- a/app/src/main/kotlin/androidx/navigation/compose/NavHost.kt +++ b/app/src/main/kotlin/androidx/navigation/compose/NavHost.kt @@ -324,31 +324,17 @@ public fun NavHost( else -> initialZIndex + 1f }.also { zIndices[targetState.id] = it } - ContentTransform(finalEnter(this), finalExit(this), targetZIndex, null) + ContentTransform(finalEnter(this), finalExit(this), targetZIndex) } else { EnterTransition.None togetherWith ExitTransition.None } }, contentAlignment, contentKey = { it.id }, - ) { - // In some specific cases, such as clearing your back stack by changing your - // start destination, AnimatedContent can contain an entry that is no longer - // part of visible entries since it was cleared from the back stack and is not - // animating. In these cases the currentEntry will be null, and in those cases, - // AnimatedContent will just skip attempting to transition the old entry. - // See https://issuetracker.google.com/238686802 - val currentEntry = if (inPredictiveBack) { - // We have to do this because the previous entry does not show up in visibleEntries - // even if we prepare it above as part of onBackStackChangeStarted - it - } else { - visibleEntries.lastOrNull { entry -> it == entry } - } - + ) { currentEntry -> // while in the scope of the composable, we provide the navBackStackEntry as the // ViewModelStoreOwner and LifecycleOwner - currentEntry?.LocalOwnersProvider(saveableStateHolder) { + currentEntry.LocalOwnersProvider(saveableStateHolder) { (currentEntry.destination as ComposeNavigator.Destination) .content(this, currentEntry) }