Detect that hardware "Back" is pressed

Hi!

I need your help. I create input text field via native.newTextField() also I add event listener on ‘key’ for detect hardware “Back” button pressed. When I edit input text field and press Back button I didn’t catch this event. How can I solve this? Maybe something check open or not hardware keyboard.

 

Thanks.

On my Google Nexus 9 running Android 6 when I tap into a text field, the back button changes to a down arrow. Tapping on that arrow dismisses the keyboard. This is not a key action that can be caught. The OS is in control of that key event.

Rob

And how solve it? I need smth catch this evenet…

You can’t. The OS does not allow capturing the dismiss keyboard event.

Maybe I can can check visibility of system keyboard?

Or exist any plugin that can trigger this event

Your text field’s event listener will likely get an phase == “ended” or “cancelled” when the keyboard is dismissed. You might be able to use that to detect the keyboard going away.

Rob

On my Google Nexus 9 running Android 6 when I tap into a text field, the back button changes to a down arrow. Tapping on that arrow dismisses the keyboard. This is not a key action that can be caught. The OS is in control of that key event.

Rob

And how solve it? I need smth catch this evenet…

You can’t. The OS does not allow capturing the dismiss keyboard event.

Maybe I can can check visibility of system keyboard?

Or exist any plugin that can trigger this event

Your text field’s event listener will likely get an phase == “ended” or “cancelled” when the keyboard is dismissed. You might be able to use that to detect the keyboard going away.

Rob