diff --git a/change/react-native-windows-f478c436-a66f-4944-b578-80fea3b12488.json b/change/react-native-windows-f478c436-a66f-4944-b578-80fea3b12488.json new file mode 100644 index 00000000000..ca76faf7040 --- /dev/null +++ b/change/react-native-windows-f478c436-a66f-4944-b578-80fea3b12488.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Change TextInput cursor behavior (#7285)", + "packageName": "react-native-windows", + "email": "erozell@outlook.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp b/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp index 1b3da186385..8324c21d818 100644 --- a/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp +++ b/vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp @@ -618,7 +618,7 @@ void TextInputShadowNode::SetText(const winrt::Microsoft::ReactNative::JSValue & auto newValue = react::uwp::asHstring(text); if (oldValue != newValue) { textBox.Text(newValue); - if (static_cast(oldCursor) <= newValue.size()) { + if (oldValue.size() == newValue.size()) { textBox.SelectionStart(oldCursor); } else { textBox.SelectionStart(newValue.size());