Open yoobi opened 1 month ago
Based on what I came up with as a solution, I guess it should be something like this. You should directly pass the destination.
navigator.navigate(NextScreenDestination) { popUpTo(CurrentScreenDestination) { inclusive = true } }
Yes that could be a solution, this composable is used by many destination, it would require to add a new parameter currentDestination
As DestinationsNavigator is meant to be a wrapper around NavController, it could be nice to have currentDestination in it as well
Previously I used to pull it off like this:
private fun executeNavigation( navController: NavHostController, direction: Direction?, addToBackstack: Boolean? ) { direction?.let { dir -> navController.navigate(dir) { if (addToBackstack != true) { this.popUpTo(navController.currentBackStackEntry?.destination?.route.toString()) { inclusive = true } } } } }
However, it is no longer available in the v2.
Oh and btw, I just submitted a new issue, could you please revise it and tell me if you have met the problem as well?
I'm not using v2 sorry :/
Hello !
My current use case is something like this, navigating to another destination and removing the current one from the backstack, I don't see any currentDestination using DestinationsNavigator.