diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java index 92cd700113c..ed4ab7a4ddf 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java @@ -1035,12 +1035,18 @@ public class ReactEditText extends AppCompatEditText { public void onAttachedToWindow() { super.onAttachedToWindow(); + int selectionStart = getSelectionStart(); + int selectionEnd = getSelectionEnd(); + // Used to ensure that text is selectable inside of removeClippedSubviews // See https://github.com/facebook/react-native/issues/6805 for original // fix that was ported to here. super.setTextIsSelectable(true); + // Restore the selection since `setTextIsSelectable` changed it. + setSelection(selectionStart, selectionEnd); + if (mContainsImages) { Spanned text = getText(); TextInlineImageSpan[] spans = text.getSpans(0, text.length(), TextInlineImageSpan.class);