Created
May 25, 2022 19:55
-
-
Save jaredmdobson/1b114c0c2cf1b1fb88b5cc03edd4eb1e to your computer and use it in GitHub Desktop.
Prevent DEL Button crashing on jetpack compose android textfield
This file contains hidden or 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
@Composable | |
fun SafeTextField(modifier = Modifier){ | |
TextField( | |
modifier = modifier.onPreviewKeyEvent { | |
it.nativeKeyEvent.keyCode == KeyEvent.KEYCODE_DEL | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment