You hold the state so you can enforce the rules you need yourself.
In other words, don't let the state change into something you don't wont it to be in
onValueChange
callback.
✅ 1
a
Ankit Dubey
03/02/2022, 11:26 AM
got it, thanks
Ankit Dubey
03/02/2022, 11:34 AM
Done
Copy code
onValueChange = {
if (it.matches("^[a-zA-Z0-9@.]*$".toRegex()))
onValueChange(it)
}