https://kotlinlang.org logo
#compose
Title
# compose
z

Zach Klippenstein (he/him) [MOD]

07/31/2020, 5:08 PM
Unrelated text input question: the kdoc for text fields say that
onValueChanged
should not be used to change the value of the text field to anything other than what the IME sent. This implies it shouldn't be used to implement something like
InputFilter
for eg phone numbers. Is this a temporary limitation, or is there a plan to address this use case another way?
s

Siyamed

07/31/2020, 5:25 PM
It can be changed but it will reset the ime connection. We added VisualFilter as an API for formatting. Feedback would be awesome :)
z

Zach Klippenstein (he/him) [MOD]

07/31/2020, 5:29 PM
Oh, derp. For some reason I thought VisualTransformation could only do 1:1 character mapping.
s

Siyamed

07/31/2020, 5:30 PM
That part is imho a little hard right now.
z

Zach Klippenstein (he/him) [MOD]

07/31/2020, 5:30 PM
Could you use it to implement a filter, eg only allow certain characters to be typed?
s

Siyamed

07/31/2020, 5:31 PM
I believe that requires changing the text.
z

Zach Klippenstein (he/him) [MOD]

07/31/2020, 5:33 PM
Is the resetting the IME connection behavior the same thing that would happen with EditText right now?
s

Siyamed

07/31/2020, 5:33 PM
Should be yes.
👍 1