Commit e6a844d
fix: show soft keyboard when long-press starts text selection in TextInput on Android
ReactEditText marks itself textIsSelectable in onAttachedToWindow (a
removeClippedSubviews workaround, #6805), which makes the platform
Editor treat every RN TextInput as read-only selectable text and skip
its "Show the IME to be able to replace text" branch when a selection
action mode starts (Editor#startActionModeInternal gates that branch on
!isTextSelectable()). RN's own keyboard paths only cover clicks and
programmatic focus, so long-pressing to select text in an unfocused
input — or in a focused input after the keyboard was dismissed — left
the user with a selection toolbar and no keyboard.
Compensate in ReactEditText: request the keyboard when a selection or
insertion action mode is created, and when focus is gained with a
non-collapsed selection (the action mode can precede focus). Guarded by
isEnabled (the editable prop), isInTouchMode, and showSoftInputOnFocus,
mirroring both requestFocusProgrammatically() and the platform branch.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 0015d1e commit e6a844d
1 file changed
Lines changed: 23 additions & 0 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
261 | 268 | | |
262 | 269 | | |
263 | 270 | | |
| |||
499 | 506 | | |
500 | 507 | | |
501 | 508 | | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
502 | 517 | | |
503 | 518 | | |
504 | 519 | | |
| |||
909 | 924 | | |
910 | 925 | | |
911 | 926 | | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
912 | 935 | | |
913 | 936 | | |
914 | 937 | | |
| |||
0 commit comments