@@ -66,21 +66,19 @@ actual fun NavHost(
6666
6767 // Find the ComposeNavigator, returning early if it isn't found
6868 // (such as is the case when using TestNavHostController)
69- val composeNavigator = navController.navigatorProvider.get< Navigator < out NavDestination >>(
70- ComposeNavigator .NAME
71- ) as ? ComposeNavigator ? : return
69+ val composeNavigator =
70+ navController.navigatorProvider.get< Navigator < out NavDestination >>( ComposeNavigator .NAME )
71+ as ? ComposeNavigator ? : return
7272
7373 // val currentBackStack by composeNavigator.backStack.collectAsState()
7474
75- // BackHandler(currentBackStack.size > 1) {
76- // navController.popBackStack()
77- // }
75+ // `progress`, `isPredictiveBack`, etc.
7876
7977 /*
8078 DisposableEffect(lifecycleOwner) {
8179 // Setup the navController with proper owners
8280 navController.setLifecycleOwner(lifecycleOwner)
83- onDispose { }
81+ onDispose {}
8482 }
8583 */
8684
@@ -100,6 +98,13 @@ actual fun NavHost(
10098 val backStackEntry: NavBackStackEntry ? = visibleEntries.lastOrNull()
10199
102100 if (backStackEntry != null ) {
101+ // TODO remove this if not needed
102+ DisposableEffect (true ) {
103+ onDispose {
104+ visibleEntries.forEach { entry -> composeNavigator.onTransitionComplete(entry) }
105+ }
106+ }
107+
103108 // `fillMaxSize` is added here to make the Box align to the size of its parent
104109 // TODO consider adding a version of `NavHost` without `modifier` and `contentAlignment`
105110 // Originally it was `transition.AnimatedContent` here.
@@ -110,8 +115,9 @@ actual fun NavHost(
110115 // while in the scope of the composable, we provide the navBackStackEntry as the
111116 // ViewModelStoreOwner and LifecycleOwner
112117 currentEntry?.LocalOwnersProvider(saveableStateHolder) {
113- (currentEntry.destination as ComposeNavigator.Destination)
114- .content(currentEntry)
118+ (currentEntry.destination as ComposeNavigator.Destination).content(
119+ currentEntry
120+ )
115121 }
116122 */
117123 currentEntry?.let {
@@ -120,19 +126,18 @@ actual fun NavHost(
120126 }
121127 }
122128
129+ // TODO remove this if not needed
123130 DisposableEffect (true ) {
124131 onDispose {
125- visibleEntries.forEach { entry ->
126- composeNavigator.onTransitionComplete(entry)
127- }
132+ visibleEntries.forEach { entry -> composeNavigator.onTransitionComplete(entry) }
128133 }
129134 }
130135 }
131136
132137 /*
133- val dialogNavigator = navController.navigatorProvider.get<Navigator<out NavDestination>>(
134- DialogNavigator.NAME
135- ) as? DialogNavigator ?: return
138+ val dialogNavigator =
139+ navController.navigatorProvider.get<Navigator<out NavDestination>>( DialogNavigator.NAME)
140+ as? DialogNavigator ?: return
136141
137142 // Show any dialog destinations
138143 DialogHost(dialogNavigator)
0 commit comments