Package: nativephp/mobile-ui 0.4.0, reproduces on current main
Platforms: iOS and Android, <text-input> bound with native:model or @change
A PR follows this issue.
Steps to reproduce
- Bind a text input to a property that the server round-trips, with a debounce, against a server a few hundred milliseconds away.
- Type a word quickly.
Expected: the field shows what was typed.
Actual: characters typed after an earlier keystroke disappear when that keystroke's round trip lands, then come back when the later one lands. On a search field this looks like the input fighting the user.
Cause
The echo-prevention in the text-input renderers keeps only the last value sent to PHP. With several commits in flight, PHP republishes an earlier keystroke's value; it differs from lastSentValue, so the "is this our own echo?" check passes and the field is set to the stale value.
Proposed fix
While the field is focused the user owns the text: server pushes are dropped for the focused field. iOS keeps the keep-focus-on-submit exception, where an empty server value clears the field. Unfocused fields keep accepting server values, so programmatic updates still land.
On Android the renderer tracks focus through the interaction source and returns early from the server-value LaunchedEffect while focused; on iOS the same check guards isFocused.
Patched for the outlined variant both platforms share; the bare and filled variants follow the same pattern and could take the same change.
Files involved
resources/ios/NativeUITextInputCore.swift, resources/android/OutlinedTextInputRenderer.kt.
Package: nativephp/mobile-ui 0.4.0, reproduces on current
mainPlatforms: iOS and Android,
<text-input>bound withnative:modelor@changeA PR follows this issue.
Steps to reproduce
Expected: the field shows what was typed.
Actual: characters typed after an earlier keystroke disappear when that keystroke's round trip lands, then come back when the later one lands. On a search field this looks like the input fighting the user.
Cause
The echo-prevention in the text-input renderers keeps only the last value sent to PHP. With several commits in flight, PHP republishes an earlier keystroke's value; it differs from
lastSentValue, so the "is this our own echo?" check passes and the field is set to the stale value.Proposed fix
While the field is focused the user owns the text: server pushes are dropped for the focused field. iOS keeps the keep-focus-on-submit exception, where an empty server value clears the field. Unfocused fields keep accepting server values, so programmatic updates still land.
On Android the renderer tracks focus through the interaction source and returns early from the server-value
LaunchedEffectwhile focused; on iOS the same check guardsisFocused.Patched for the outlined variant both platforms share; the bare and filled variants follow the same pattern and could take the same change.
Files involved
resources/ios/NativeUITextInputCore.swift,resources/android/OutlinedTextInputRenderer.kt.