| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…wrote `TextField`'s `shouldChangeCharactersInRange` delegate raised `textChange` with the typed result and then returned `true`, so when a listener set a different `text` during that event (a formatter, a cap, a reset) the setter pushed that value to the native field and UIKit inserted the typed character on top of it: typing `b` into a field an uppercasing handler had left at `A` showed `ABb` for a property value of `AB`. Every framework whose state applies synchronously inside the event hit it; `TextView` did not, because its delegate reports after the edit is applied. The delegate now returns `false` when the listener wrote a different `text`, as the `valueFormatter` path already does, so the native field keeps the listener's value.
|
View your CI Pipeline Execution ↗ for commit 9620822
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at 2026-09-23 00:45:13 UTC |
Sorry, something went wrong.
npm i https://pkg.pr.new/@nativescript/core@11443 npm i https://pkg.pr.new/@nativescript/vite@11443 npm i https://pkg.pr.new/@nativescript/webpack@11443 commit: 9620822 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Checklist
What is the current behavior?
On iOS, TextField.textFieldShouldChangeCharactersInRangeReplacementString computes the typed result, raises textChange through textProperty.nativeValueChange, and then returns true. If a textChange listener sets a different text inside that event, Property.set pushes the new value to the native field right away, and UIKit then inserts the typed character on top of it. Typing b into a field an uppercasing handler had left at A shows ABb while the property reads AB; a handler that resets or caps the value sees the rejected character appear anyway.
This is not framework-specific. Any integration whose state update runs synchronously inside the native event (Angular change detection in the zone task, Solid and Svelte signals, Octane, plain textChange handlers) hits it; integrations that flush asynchronously (Vue's scheduler, React 18 batching) instead see the caret jump to the end after the transformed write lands. Surfaced through nativescript-community/octane#3 while verifying a controlled-input fix there. TextView is unaffected because its delegate reports after the edit is applied, and Android's TextWatcher does too.
What is the new behavior?
After raising textChange, the delegate returns false when the listener wrote a different text: the setter has already put that value in the native field, so nothing is applied on top. The valueFormatter branch already worked this way. A listener that leaves text alone, or writes the same value, changes nothing (the write is a no-op in core and the delegate still returns true).
Tests
apps/automated gains typeCharacterNatively, which delivers one keystroke the way UIKit does (ask the delegate, apply the replacement only if it agrees; append on Android), and testTextWrittenByTextChangeListenerIsNotRepeatedByTheKeystroke, an uppercasing textChange listener typed a then b, asserting AB on both the property and the native field. It is gated to iOS since only that delegate can apply a keystroke after the listener ran.
Full automated iOS suite on the simulator: 1817 OK, 0 failed with the fix; with only the core change stashed, the same suite fails exactly this test (Actual: <AAB>), so it guards the regression.