How can I close the software keyboard in onClick o...
# compose
g
How can I close the software keyboard in onClick on a button? I can see we get
softwareKeyboardController
in
onImeActionPerformed
but what about other places? I didn’t find an Ambient for this
f
I think you need to store it in a “””lateinit””” local variable by using onKeyboardReady or something like that in TextField
You have a nullable SoftwareKeyboardController? and assign it in the callback you are given
g
That would work only if the imeAction was performed
f
no you get the controller earlier
There are more callbacks in textfield
g
Ah ok!
f
It is a dreadful pattern, i wish TextField just returned the controller somehow
g
onTextInputStarted
returns it, gotcha
Yes this is quite disappointing to have to do that
Worked like a charm. thank you @Fudge