-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add inputType textNoSuggestions in react-native to disable the autocomplete #35691
Conversation
…mplete functionality (comment, comment-2, user-comment, user-comment-2) android:inputType=“textFilter|textNoSuggestions” P | type | task -- | -- | -- 1 | review | Review information from your previous investigation (comment) 1.2 | review | Review comments from Issues facebook#33139 (facebook#30263, facebook#35155, facebook#35590, facebook#35350) 2 | bug | Build RNTester on Android 13 and test TextInput example with Grammarly (example-without-scrollview, example-with-scrollview) 2.1 | task | Enter timemachine and restore previous android sdk configs in folder /Users/fabriziobertoglio/Library/Android/sdk 2.2 | task | Check sdk supported in build.gradle configs in react-native (commit) 2.3 | task | Read react-native environment setup instructions 2.4 | task | Follow instructions on discord to fix build error (1-2 hours) 3 | bug | Add inputType textNoSuggestions in react-native to disable the autocomplete functionality (comment, comment-2, user-comment, user-comment-2) android:inputType=“textFilter\|textNoSuggestions” 3.1 | task | Review implementation of InternalKeyListener 3.2 | task | Find configs inputMode in sourcecode (setKeyboardType) 3.3 | task | Add type “textFilter\|textNoSuggestions” to setKeyboardType 3.4 | task | Test that auto-corrections are disabled in a TextInput with Grammarly Keyboard 3.5 | task | Refactor functionality in branch 3.6 | task | Record test case P type task 1 review Review information from your previous investigation ([comment](facebook#35590 (comment))) 1.2 review Review comments from Issues [facebook#33139](facebook#33139) ([facebook#30263](facebook#30263), [facebook#35155](facebook#35155), [facebook#35590](facebook#35590), [facebook#35350](facebook#35350)) 2 bug Build RNTester on Android 13 and test TextInput example with Grammarly ([example-without-scrollview](facebook#35155), [example-with-scrollview](facebook#35590)) 2.1 task Enter timemachine and restore previous android sdk configs in folder /Users/fabriziobertoglio/Library/Android/sdk 2.2 task Check sdk supported in build.gradle configs in react-native ([commit](394486e)) 2.3 task Read react-native [environment setup instructions](https://reactnative.dev/docs/next/environment-setup) 2.4 task Follow [instructions on discord](https://discord.com/channels/514829729862516747/1050309907787808768/1050462841028743309) to fix build error (1-2 hours) 3 bug Add inputType textNoSuggestions in react-native to disable the autocomplete functionality ([comment](facebook#35155 (comment)), [comment-2](facebook#35590 (comment)), [user-comment](facebook#33139 (comment)), [user-comment-2](facebook#33139 (comment))) android:inputType=“textFilter|textNoSuggestions” 3.1 task Review implementation of [InternalKeyListener](https://github.com/facebook/react-native/blob/76a14454d7f1f2b2ba8f5a79c2f640fafb42de6d/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L1153-L1168) 3.2 task Find configs [inputMode](https://reactnative.dev/docs/next/textinput#inputmode) in sourcecode ([setKeyboardType](https://github.com/facebook/react-native/blob/9f78517d6401f3a7ece453825a059a13b73f6140/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java#L849-L881)) 3.3 task Add type “textFilter|textNoSuggestions” to [setKeyboardType](https://github.com/facebook/react-native/blob/9f78517d6401f3a7ece453825a059a13b73f6140/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java#L849-L881) 3.4 task Test that auto-corrections are disabled in a TextInput with Grammarly Keyboard 3.5 task Refactor functionality in branch 3.6 task Record test case
P type task |
|
Base commit: 9f78517 |
Base commit: 9f78517 |
PR build artifact for 6d47816 is ready. |
PR build artifact for 6d47816 is ready. |
This seems like a pretty big stretch of the intent of keyboardType… TextInput has separate props for things like “autoCorrect” already which set TYPE_TEXT_FLAG_AUTO_CORRECT, we shouldn’t conflate the type of input with wanting to disable suggestions. |
It looks like autoCorrect also sets TYPE_TEXT_FLAG_NO_SUGGESTIONS already. So the prop controls both flags. So really it seems like we want a prop like it with more granularity. |
Yes. You are right. Related #35155 (comment) #35155 (comment) TextView removes or adds SuggestionSpan when the InputType changes. I believe the SuggestionSpans trigger the ANR on One UI5 when deleting text with backspace key (see the breakdown of the error here). It isa One UI5 issue. I can not join One UI5 Beta with my Samsung device in Italy, and I believe it is One UI5 Issue with their Samsung Keyboard integration with Grammarly. More One UI5 updates are released these days (see comment) and for this reason, I thought of pausing the development of this functionality (more info about One UI5 Beta program in my comment here). Thanks for the feedback. 🙏 I believe issues #33139 #35155 #35590 #30263 should be reported to Samsung One UI5 Beta or UI4. I have attached the info below just for documentation.
Task completed
P type task Task planned (not completed)
P type task |
Just wanted to say thank you for trying to fix this 🙏 We're receiving many 1 star reviews in the Play Store because a multi-line input on Samsung Androids is unusable. |
android 13 Sumsung Galaxy A71 , Sumsung Galaxy A32, Sumsung Galaxy A53 phone the following crash occurs , hope to give me solution,thanks React Native Version Samsung android 13 Output of npx react-native info Steps to reproduce Snack, screenshot, or link to a repository |
Summary
UPDATE #35691 (comment)
Several users tested this solution (using visible-password, see comments in #35155).
Adding inputType
textNoSuggestions
in react-native to disable the autocomplete functionality.https://stackoverflow.com/a/1992201/7295772
react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
Lines 1153 to 1168 in 76a1445
More info in #35590 (comment)
fixes #33139 fixes #35155 fixes #35590
Related #30263, #35350
Changelog
[ANDROID] [FIXED] - Fixes TextInput causing app to hang on Samsung devices with Android 13 with autocomplete/Grammarly enabled
Test Plan
2022-12-20.20-20-22.mp4