Mobile: Fixes #11820: Fix cursor moves to incorrect position when revising TextInput value #11821
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an issue on mobile whereby making amendments to text in React Native TextInput components causes the cursor to move before the new character which has just been typed, when the cursor is not currently at the end of the string. A similar issue has been raised here callstack/react-native-paper#1668 and the fix proposed there resolves the issue. It is fixed by simply using the defaultValue attribute instead of the value attribute on the TextInput component, to map the value to be displayed by the component.
This PR fixes #11820
Existing behaviour:
https://github.com/user-attachments/assets/c296269c-1ba5-492e-a00f-9a0b1e30e576
New behaviour with code change:
https://github.com/user-attachments/assets/559d9155-b526-4da7-92c4-448c06d0f0b8
Testing:
I have verified that amending and saving the value of a STRING type configuration setting (eg. WebDAV sync target settings / proxy url setting) updates and saves as expected