You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have a TextInput with selection property and try to long press on text, it is selected, but no context menu is displayed. When you long press on it the second time, it is displayed.
I've tried to debug in via Android Studio and sometimes this error appeared in console: W/TextView: TextView does not support text selection. Selection cancelled..
That led me to discovering this issue and this issue on Google's bugtracker. The recommended fix was to toggle setEnabled property inside the onAttachedToWindow method of EditText. So I did that inside of the ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java, inserted these two lines here:
super.setEnabled(false);
super.setEnabled(true);
That didn't resolve the issue.
I've also tried workarounds such as toggling editable property afret the first render (and after timeout), but that also didn't help.
Maybe someone has some suggestions/ideas of what can be done on JS side or on native side? Rebuilding react-native from source is a hassle, so if you have some ideas of what might work - please share them, I'll try them out myself.
Binaries:
Node: 18.0.0 - /usr/bin/node
Yarn: 1.22.18 - /usr/bin/yarn
npm: 8.6.0 - /usr/bin/npm
Watchman: 2022.03.21.00 - /home/linuxbrew/.linuxbrew/bin/watchman
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.1 => 0.68.1
npmGlobalPackages: react-native: Not Found
Steps to reproduce
Have a TextInput with selection property
Long press on text inside the TextInput to select it
Verify that copy/paste menu is not displayed
Snack, code example, screenshot, or link to a repository
Description
When you have a TextInput with
selectionproperty and try to long press on text, it is selected, but no context menu is displayed. When you long press on it the second time, it is displayed.I've tried to debug in via Android Studio and sometimes this error appeared in console:
W/TextView: TextView does not support text selection. Selection cancelled..That led me to discovering this issue and this issue on Google's bugtracker. The recommended fix was to toggle
setEnabledproperty inside theonAttachedToWindowmethod ofEditText. So I did that inside of the ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java, inserted these two lines here:That didn't resolve the issue.
I've also tried workarounds such as toggling editable
propertyafret the first render (and after timeout), but that also didn't help.Maybe someone has some suggestions/ideas of what can be done on JS side or on native side? Rebuilding react-native from source is a hassle, so if you have some ideas of what might work - please share them, I'll try them out myself.
Version
0.68.1
Output of
npx react-native infoBinaries:
Node: 18.0.0 - /usr/bin/node
Yarn: 1.22.18 - /usr/bin/yarn
npm: 8.6.0 - /usr/bin/npm
Watchman: 2022.03.21.00 - /home/linuxbrew/.linuxbrew/bin/watchman
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.1 => 0.68.1
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
TextInputwith selection propertyTextInputto select itSnack, code example, screenshot, or link to a repository
https://snack.expo.dev/V34Cbc4DW
22-04-23-14-03-56.mp4