Back press
By default, Voyager will handle back presses but you can override its behavior. Use the onBackPressed to manually handle it: return true to pop the current screen, or false otherwise. To disable, just set to null.
1
setContent {
2
Navigator(
3
initialScreen = HomeScreen,
4
onBackPressed = { currentScreen ->
5
false // won't pop the current screen
6
// true will pop, default behavior
7
}
8
// To disable:
9
// onBackPressed = null
10
)
11
}
Copied!
Last modified 3mo ago
Copy link