Skip to content

Flush Android text editors before separate press actions - #147

Merged
simonhamp merged 1 commit into
NativePHP:mainfrom
wojt-janowski:fix/android-input-prepress-flush
Oct 24, 2026
Merged

simonhamp merged 1 commit into
NativePHP:mainfrom
wojt-janowski:fix/android-input-prepress-flush

Conversation

@wojt-janowski

@wojt-janowski wojt-janowski commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Register filled/outlined Android editors' existing selection/text flush with Mobile's focused-input policy, so pending blur/debounce text posts before a separate Button/pressable action, even when focus is retained.
  • Use rememberUpdatedState so the focused closure always uses current dispatcher/reporter callback props. Blur and pre-action flushing share existing deduplication and debounce cancellation.
  • Add a standalone Robolectric/Compose regression module compiling the production editors and Button plus actual Mobile policy/node models. Only the bridge boundary and unused menu/icon paths are substituted; PHP/JNI and device IME behaviour are not claimed.

Important

Do not merge until NativePHP Mobile ships a release containing NativePHP/mobile-air#565.

This relies on the companion Android fieldFocused(..., flush) change from NativePHP/mobile-air#565 (merged to main on 22 Oct 2026, not yet released; latest release is 4.6.0). Against unchanged Mobile 4.6.0 the pre-press flush won't work.

Before merging: bump nativephp/mobile in composer.json to the first release that includes #565.

Test plan

  • Retained tests/android module: 12 tests passed, no failures/skips, using JDK 21 / SDK 36 with -PmobileRoot=/absolute/path/to/patched/mobile (command documented in its README).
  • Negative control with unchanged Mobile UI renderers and the same core policy/test scenario: 8 blur/debounce cases fail, live controls pass.
  • Covers both editor variants, all three sync modes, keep-focus true/false, callback replacement while focused, latest value before PRESS, and no later duplicate after debounce interval.
  • git diff --check and local CodeRabbit review: passed, zero findings across all changed text files.
  • Native device/IME and PHP end-to-end checks remain outstanding. The Compose tests invoke Button's semantic click action; they are not hardware-keyboard dismissal or TalkBack evidence.
  • Existing PHP/Pint/Swift gates left to automatic CI; no PHP or Swift files changed.

Exercise the production editors and Button across sync modes and callback updates.
Requires the companion Mobile focused-input flush registration seam.

Amp-Thread-ID: https://ampcode.com/threads/T-01a15d54-08af-74af-a9fe-b7cfe5fd268c
Co-authored-by: Wojt Janowski <wojt@clinically.com.au>
@wojt-janowski
wojt-janowski marked this pull request as ready for review October 23, 2026 22:32
@simonhamp
simonhamp merged commit 742ce46 into NativePHP:main Oct 24, 2026
4 checks passed
@simonhamp

Copy link
Copy Markdown
Member

thanks

ricardovfreixo added a commit to ricardovfreixo/mobile-ui that referenced this pull request Oct 25, 2026
Bounded merge for the companion PR NativePHP#162: takes upstream's bounded
gesture areas (NativePHP#173), the text/font/keyboard/divider/sheet fixes
(NativePHP#142, NativePHP#155, NativePHP#156, NativePHP#163, NativePHP#147, NativePHP#168, NativePHP#170) and the tab-row chrome fix
(NativePHP#167), while keeping this branch's scroll-target seam intact — the
live pager page availability guard (PagerPageContext), the ancestor
pager chain in isAvailable(), and the Android list scroll-target
registration. TabRowRenderer.kt resolves to upstream's version: both
sides had independently removed the unsupported LocalTopBarColor /
LocalTopTabRow hooks, so nothing was reintroduced and no stubs added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants