mirror of
https://github.com/bbara04/Purefin.git
synced 2026-03-31 17:10:08 +02:00
fix: prevent popping the last item from backStack if it's the only item
This commit is contained in:
@@ -155,7 +155,7 @@ class PurefinActivity : ComponentActivity() {
|
||||
LaunchedEffect(navigationManager, backStack) {
|
||||
navigationManager.commands.collect { command ->
|
||||
when (command) {
|
||||
NavigationCommand.Pop -> backStack.removeLastOrNull()
|
||||
NavigationCommand.Pop -> if (backStack.size > 1) backStack.removeLastOrNull()
|
||||
is NavigationCommand.Navigate -> backStack.add(command.route)
|
||||
is NavigationCommand.ReplaceAll -> {
|
||||
backStack.clear()
|
||||
@@ -168,6 +168,7 @@ class PurefinActivity : ComponentActivity() {
|
||||
CompositionLocalProvider(LocalNavigationManager provides navigationManager) {
|
||||
NavDisplay(
|
||||
backStack = backStack,
|
||||
onBack = { navigationManager.pop() },
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
entryDecorators =
|
||||
listOf(
|
||||
|
||||
Reference in New Issue
Block a user