I'm looking for an equivalent method of EditText's InputFilter in Jetpack Compose TextField.
Because I'm trying to prevent users input unwanted values like %@*()- characters for example.
I'm looking for an equivalent method of EditText's InputFilter in Jetpack Compose TextField.
Because I'm trying to prevent users input unwanted values like %@*()- characters for example.
skafle
On
If you just want to display the numberOnly keyboard, we can do this way:
TextField(
value = textState,
onValueChange = { text ->
textState = text
},
keyboardOptions = KeyboardOptions.Default.copy(
keyboardType = KeyboardType.NumberPassword
),
visualTransformation = VisualTransformation.None
)
Copyright © 2021 Jogjafile Inc.
There is a solution with Regex here:
Using: