Implement keep-focus-on-submit on Android and report focus state for press dispatch - #53
gwleuverink wants to merge 2 commits into
Conversation
… on submit by default
…onor keep-focus-on-submit
|
Review notes for this pair are on NativePHP/mobile-air#353. Two apply here directly: this PR alone breaks every native build because it imports |
|
Thanks for this, Willem. Same story as NativePHP/mobile-air#353: the review fixes couldn't be pushed here because your fork is owned by an organisation, and GitHub only allows maintainer pushes to forks owned by a user. I've opened #115 instead. It has your two commits, a merge of current main, and the fixes on top. The core companion is NativePHP/mobile-air#521. Closing this in favour of #115. |
Companion to NativePHP/mobile-air#353, the input-renderer half of the keyboard-dismissal fix for NativePHP/mobile-air#335. The full story and behaviour matrix live there.
The reproduced problem was a chat composer losing the keyboard on every button send. The direction is symmetry: both platforms drop the keyboard on submit and on taps outside the field, keep-focus-on-submit is the one opt-out, and it has to actually work everywhere. iOS defaults were already right. Android's were not, and the attribute did nothing there.
On Android, the renderers never parsed keep_focus_on_submit, and supplying KeyboardActions had silently replaced Compose's default hide-on-Done, which is why Android kept the keyboard on submit while the docs said otherwise. The prop is now parsed, and submit clears focus by default and keeps it with the attribute, in all three input variants.
On both platforms the inputs now report their focus state and keep-focus flag to mobile-air's KeyboardFocusPolicy, which press dispatch consults to decide whether a button tap dismisses. The iOS input also registers a flush hook so a press can push the field's latest text, including a tap-committed autocorrection, to PHP before the press event lands.
This PR carries the Android behavioural change: submit and button taps start dropping the keyboard by default. Existing code keeps running, chat-style screens add keep-focus-on-submit to keep the old feel.
It also references KeyboardFocusPolicy, which ships in the mobile-air companion, so the composer constraint on nativephp/mobile needs to require the release that includes it. Left untouched pending the release plan.