-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
TextInput crashes an app if Samsung Keyboard uses Predictive Text & Suggest text corrections #33139
Comments
UPD: Seems like it's related with Samsung devices upgraded to Android 12 |
I have the same issue. |
Not sure is it related but received app crash when typing.
|
@tarouboy For me it's:
|
@JoshuaGross , @RSNara , @mdvacca , sorry for mentioning you all straight, but It seems very important issue for me. Maybe somebody can take at least a quick look at the repo I attached and give this higher priority status. |
we having the exact same issue. |
Any updates regarding this issue? It’s happening on both Android 11 & 12 (rn 0.67.3), we get lot’s of crashes every day. It also lags a lot if a user enters a big block of text and it leads to ANR. |
We were able to reproduce this bug and we found that setting Try this and let me know if it works for you. P.S.: Since this is happening only for Samsung devices with Android 12 I made this util to only set autoCorrect to false when the device meets these props:
|
@JuanAlejandro working as expected as workaround for this kind of issue. Thank you very much! |
@JuanAlejandro Any update on whether your fix continues to solve the issue? |
any fix for this issue? because lot of our users facing the same issue if they have Samsung Device |
doesn't fix the issue |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Bad bot, issue still exists to this day |
Hey fellow devs, please upvote the comment under the Meta discussion about what to improve: react-native-community/discussions-and-proposals#528 (comment) let’s hope it will get enough attention |
Issue also exists with native android :D so I really don't think React can do anything apart from disabling hints on Samsung |
@carstenhag I have many samsung devices, I do not face such an issue with native apps. Can you please link a repro or a link to an issue? Thanks |
@efstathiosntonas This is the code that we are using (native android project):
Here's a repro description (sorry, only got it as png) I can also reproduce it with a Samsung Galaxy S22. |
This issue is still exist any work around of this issue? |
@smali-kazmi Did you get any work around? |
|
@j-duggirala @smali-kazmi I opened another issue because we are having problems again with Android 13. This time the text suggestions setting is causing the ANRs in our app. The temporary solution we implemented was to set the I'm worried about this because this issue was opened almost one year ago and we haven't got one single response from the react-native team. |
@JuanAlejandro I have the same issue on our Samsung devices and received a lot of reports related to it. Just typing a sentence, the application will throw the ANR pop-up and must be forced close, the render thread is running forever. It can be solved by turning off the predictive and spell check but it causes a lot of bad situations 😕 We are crazy about this, any update for this? |
@JuanAlejandro Any update on this? |
Just tested it with Facebook app on a Samsung S22 Android 13 and it ANR, no crash. The amount of entered text was huge when it started lagging compared to my app which starts lagging with much fewer text. |
Btw from the manual testing we've done it looks like what makes a difference is wether the |
@Houguiram did you check if it makes a difference to use a text child instead of a value to render the input? not sure if it can eliminate the re-renders. |
I haven't yet. Could be worth trying if you need a controlled input. |
@nes123 and @Houguiram Can you please elaborate what you mean by this? Sorry I am relatively new to React Native so still not familiar with the terminology/APIs for all of the components. |
@sabidhasan You can use two forms
or
I doubt that there is a difference, but worth checking. I am not familiar with Textinput implementation. |
Thanks for the response. Confirming that the latter form doesn't make a difference - the keyboard/inputs still slow down after typing ~1 paragraph of text. Appreciate the help/suggeston though! |
Any updates on the issue? |
…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
Thanks @Houguiram, I tested your solution and so far it seems to have a far better result. I still have not pushed it to prod. I was just testing on my Samsung device (Android 13). This video shows ANR and it is the old implementation of our TextInput (Not memoized). This one results in ANR. This is with memoized. |
For anyone dealing with this issue, the freezing only seems to be happening using the default Samsung keyboard. We've been able to recommend to our users to install Google's Keyboard and the freezing does not happen. https://play.google.com/store/apps/details?id=com.google.android.inputmethod.latin&hl=en_US&gl=US Not a great long term solution, but hopefully can help provide some relief while this is investigated. |
Hello everyone here are my findings to avoid keyboard crash issue
|
Please we need a solution for this. |
@here any solution on this yet please reply. Thank you. |
Any solution. |
We've finally solved this issue for our app, the root cause was re-renders locking up the UI. Echoing @Houguiram on this comment #33139 (comment), making the component fully uncontrolled makes a huge difference. For us we had a class component using Formik, so memoizing wasn't possible. Formik was causing double re-renders every time the user typed. We refactored our component to remove Formik and make sure that zero re-renders happened while typing. This might be complex for some if you're doing something like updating state on the component onDataChanged. We're using mobx as our data store and are simply updating the value in data store with onDataChanged, to be accessed when the form is submitted. Since there's no state update..no re-render. Obviously it'd still be great to figure out the actual root cause of why this is only happening on Samsung devices. But for those looking for immediate relief, look into how often your components are re-rendering on text changes and try to eliminate/reduce that. |
@mglobel did you push the fix to prod? I also had seen a good result which I mentioned here, #33139 (comment) But I have not yet pushed it to production. |
@Saad-Bashar Our fix is currently rolling out. We were also able to see an improvement on our own Samsung Android 13 device. By Monday I should have more confirmation from our users whether the fix is a widespread improvement. |
@Saad-Bashar We've rolled out the fix and have confirmation from several users that it resolved the issue for them. |
Thanks for the feedback! I just wanted to confirm again, uncontrolled input and removing re-renders solve the issue for you? |
I have the same issue and tried some of the solutions but not working fine. Now simply I have fixed this by changing the keyboard type to email-address. |
Thanks this helps, but still not a perfect solution, because of adding "@" and ".com" buttons to the keyboard layout, but works better with multiline inputs than "visible-password" type |
@LunyovYuriy yes right its not a perfect solution but its not crashing the app and autocorrect is not working when we use email-address keyboard. |
Closing issue as we're addressing in #35590 (comment) |
Description
Main issue: Generated release .apk TextInput crash the app on Samsung when Predictive Text & Suggest text corrections is activated.
React-native versions checked: 0.63.3, 0.67.2
Phones produced the issue: Samsung S20 Ultra, Samsung Galaxy S21 Plus
Another possible issue: For all the crashes captured some parts of the text were underlined green or red, maybe the issue is with that suggestions...
It was first produced by the production project based on 0.63.3v, then I created bare 0.67.2v project and added simple TextInput, and the issue still exists. Attaching a video so everybody can replicate.
record-20220217-094302.mp4
Version
0.63.3, 0.67.2
Output of
npx react-native info
System:
OS: macOS 12.2.1
CPU: (8) arm64 Apple M1
Memory: 439.56 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.2.0 - /opt/homebrew/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 8.1.2 - /usr/local/bin/npm
Watchman: 2021.12.13.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 29, 30, 32
Build Tools: 28.0.3, 29.0.2, 30.0.0, 30.0.2, 32.0.0
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-32 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7935034
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_292 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.2 => 0.67.2
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
yarn install
android>app
. Change values regarding keystore insidegradlew.properties
android && ./gradlew assembleRelease
Snack, code example, screenshot, or link to a repository
https://github.com/BohdanSol/projectTwo
The text was updated successfully, but these errors were encountered: