Skip to content

Conversation

@rectified95
Copy link
Contributor

@rectified95 rectified95 commented Feb 5, 2021

When modifying the contents of a TextInput programmatically, the cursor position gets moved to the front, which is the default behavior of XAML. Overriding it to enable dynamic re-write scenarios - eg. auto-capitalize, removing forbidden characters etc..

Fixes #6786

Microsoft Reviewers: Open in CodeFlow

@rectified95 rectified95 merged commit c9f6405 into microsoft:master Feb 12, 2021
rectified95 added a commit to rectified95/react-native-windows that referenced this pull request Feb 12, 2021
* Fix cursor resetting in TextInput.

* Change files

* Do no preserve selection, just cursor.

Co-authored-by: Igor Klemenski <igklemen@microsoft.com>
rectified95 added a commit that referenced this pull request Feb 22, 2021
* Fix cursor resetting in TextInput.

* Change files

* Do no preserve selection, just cursor.

Co-authored-by: Igor Klemenski <igklemen@microsoft.com>

Co-authored-by: Igor Klemenski <igklemen@microsoft.com>
rozele added a commit to rozele/react-native-windows that referenced this pull request Oct 6, 2021
…tInput selection

Summary:
This diff cherry-picks the following commits from react-native-windows:
* **4af6037c** - Integrate 4/22 Nightly Build (microsoft#5690)
  * Only kept native changes to TextInputViewManager.cpp from this commit.
* **b8c063d1** - Fix Errant "Nested elements in TextInput are currently unsupported on…
  * Needed to eliminate spurious yellow box cherry-picked in **4af6037c**
* **c9f64057** - [FIX] Cursor resetting in TextInput (microsoft#7056)
  * Actual fix for TextBox selection reset

Test Plan:
1. Cloned to FBS
2. Compile Archon
3. Confirm TextInput cursor fixed

{F447085524}

For reference, here was the old behavior:

{F447112485}


Reviewers: skyle, mylando

Reviewed By: skyle

Subscribers: eliwhite

Differential Revision: https://phabricator.intern.facebook.com/D26781359

Tasks: T85939098

Tags: ddr_ml_flagged_advice

Signature: 26781359:1614791211:f409bbfd5723d484e15ea5cb78ff7f1f69105a66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextInput cursor position gets reset when text is changed

3 participants