Created
October 19, 2021 21:43
-
-
Save victorbrndls/e3da7120655933de30789b996ab3b90c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var backHandlingEnabled by remember { mutableStateOf(true) } | |
var backPressedCount by remember { mutableStateOf(0) } | |
BackHandler(backHandlingEnabled) { backPressedCount++ } | |
val dispatcher = LocalOnBackPressedDispatcherOwner.current!!.onBackPressedDispatcher | |
Button(onClick = { dispatcher.onBackPressed() }) { | |
Text("Press Back count $backPressedCount") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment