I am using Jetpack Compose ui version 1.3.0-beta08
and navigation compose version 2.4.0-alpha02
and working Bloom app with all new Architecture components. After login success I need to clear all previous compose login screens, but even added popUpTo("HomeScreen"){inclusive = true}
, my login screen removed from backstack, but login welcome screen not removed from backstack, when I click back from Home screen. is it anything I am missing/wrong in compose navigation?
composable(Screen.LoginScreen.route) {
LoginScreen {
Log.d("AppMainNavigation", "AppMainNavigation: ${navController.backQueue}")
navController.navigate(Screen.HomeBaseScreen.route){
popUpTo(Screen.LoginScreen.route){
inclusive = true
}
launchSingleTop = true
}
}
}
GitHub Link : https://github.com/rramprasad/BloomApp/blob/main/app/src/main/java/dev/ramprasad/bloom/MainActivity.kt
update your jetpack compose version to the latest release preview version and all other dependencies.
current jetpack composes version: 1.0.0-rc02
and also which screen you want to popup just use this
my splash screen code:
@Composable
fun Navigate(navController: NavController) {
produceState(initialValue = -1) {
delay(1500)
navController.popBackStack()
val route = if (Firebase.auth.currentUser == null) AppRouter.Intro.route else AppRouter.Home.route
navController.navigate(route)
}
}
so here you can use this below line to remove screen from backstack
navController.popBackStack()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With