-
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
TextInput hangs with Samsung keyboard's Grammarly integration #35590
Comments
For those of us that use mentions, this has been a disaster. If you use children on the TextInput that updates based on state, it will crash after 4 lines of typing: "Hey who you". Doesn't even need to be getting up to a lot of content, crashes very quickly. Tested on Galaxy S20, Android 13. Happening for all my android 13 users |
@ruairioliverwv Same here, we’re using mentions and it ANR after a few sentences. This has been disastrous for us, we got tons of support emails from complaining users. |
Thanks a lot for writing up this issue - this is affecting us and its incredibly bad. Really frustrating to see months with no moment on it anywhere! |
We are also seeing the issue and are receiving a lot of complaints from Samsung users who have upgraded to version 13. As more users adopt the latest version, this is going to become a major headache for support and our users. |
This is my analysis of this issue based on the ANR log. The bug reproduces on Samsung devices while using the Samsung Keyboard Grammarly integration. The Grammarly keyboard uses the OnKeyboardActionListener (more info) to listen to the key pressed and display Grammarly suggestions. The Samsung Grammarly integration is available starting from One UI 4.0.
I tested the snack with Samsung device OS One UI 4.1, but the Grammarly integration is unavailable on Galaxy A12. I could not reproduce #35590 using the Grammarly keyboard.
io.sentry.android.core.ApplicationNotResponding: Application Not Responding for at least 5000 ms. private <T> int getSpansRec(int queryStart, int queryEnd, Class<T> kind,
int i, T[] ret, int[] priority, int[] insertionOrder, int count, boolean sort) {
if ((i & 1) != 0) {
// some logic
if (spanEnd >= queryStart &&
(spanStart == spanEnd || queryStart == queryEnd ||
(spanStart != queryEnd && spanEnd != queryStart)) &&
(Object.class == kind || kind.isInstance(mSpans[i]))) { This are reports for the same ANR triggered by
|
Thank you for posting this! I have been trying to find out why this is happening and suspected it was Grammarly. Four/Five years ago I tried to use it on my PC integrated with Chrome and Edge and it did the same thing as this. After a few weeks, I had to get rid of it. I started using it again and now it doesn't so I'm hopeful that we'll have a permanent solution soon. I have a 22+ and it started after the 13 update. Thanks again. |
…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
We also have significant issues with this. Disabling auto-complete isn't a long-term option for app with users who might have English as a second language. |
https://developer.samsung.com/one-ui-beta
|
Is this an option? Like would it fix the crash even though it is not optimal? |
Same here, setting |
@cortinico @kelset How can we get the attention of some RN team members? This seems really urgent and as far as I can see no one is assigned to this issue. |
it's been raised already a few times and a couple of Meta engineers are trying to look more into it AFAIK. But can't make any promises or official statements, sorry; I'm frustrated as you are that this has not been fully addressed yet 😰 |
We've escalated this in our team and someone is actively investigating root cause for a clear next step. Thanks everyone for bringing this to our attention and for all the debugging and context. We will keep you updated here. |
@lunaleaps thank you. If there’s a solution found, please patch older rn versions too for those who can’t update yet to 0.69-0.70+. We’ve must have had at least 100 one star review due to this issue. 🫤 |
@lunaleaps at the bottom of this comment there are all the related issues until now, just bringing them to your attention if you want to cross mention and close: #35590 (comment) |
I could not reproduce this issue on Galaxy s21 (Android 13) with or without Grammarly on, but some of our users are reporting it. This is one of the screen records from our moderators. UPDATE: 321529296_6008028922561982_7436291000411312678_n.mp4 |
@fortmarek last time the RN team was very considerate to push the patch on 0.68.6. As a large number of us are on this version, please consider again to push the patch to 0.68. Thank you so much! 🙏 |
Btw I just realized that a 0.69.9 already existed and only contains ios specific update, how will you then push that fix for 0.69.x version then @fortmarek ? (I have never seen a 0.xx.xx version so far) |
Please consider pushing the patch on 0.68.2. My team also looking for 0.68 version fix. |
Here are the 10 (9+1) PRs that make up the fix (still being tested): reactwg/react-native-releases#63 (comment) Thank you Nick for your excellent work, and apologies for the pings 🙏 |
Hi all, I've been investigating for quite a few days a crash that many of my users seems to experience and that my play console displays as:
Considering it makes up for 50% of my crashes it's worth looking into. Those crashes above happen on all kind of devices (not samsung only) And since users seems to be facing these crashes only in chat (where textinput is used), I really don't mean to add noise here, but if in anyway it may be related I thought I might as well mention it. if that matters, this happens with react-native-reanimated v2.13.0 up to 2.14.4 (haven't tested previous ones) @NickGerleman as mentioned I hope it's unrelated, but perhaps at a quick glance you may be able to know whether or not it could be connected; if not I will remove it to avoid extra noises. |
This does not seem related as far as I can tell. |
Hey everyone - a quick update on this: we've just released:
Both contain @NickGerleman's multi-commit fix to address this problem - early signs in 0.72 RC1 suggested that they indeed address the problem, so we hope that by upgrading to these new versions you'll see improvements! Upgrade to those and let us know! We are planning to also backport these fixes back to 68 and 69 - but the harsh reality is that the further back we go in the codebase, the more complicated this process of backporting gets (I literally attempted to bring back these fixes to 69 three separate times without much success 😭). We'll keep working on this and make it land in those older versions, but it will probably take a bit longer. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-native](https://togithub.com/facebook/react-native) ([changelog](https://togithub.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md)) | [`0.71.6` -> `0.71.7`](https://renovatebot.com/diffs/npm/react-native/0.71.6/0.71.7) | [![age](https://badges.renovateapi.com/packages/npm/react-native/0.71.7/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/react-native/0.71.7/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/react-native/0.71.7/compatibility-slim/0.71.6)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/react-native/0.71.7/confidence-slim/0.71.6)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>facebook/react-native</summary> ### [`v0.71.7`](https://togithub.com/facebook/react-native/releases/tag/v0.71.7): 0.71.7 [Compare Source](https://togithub.com/facebook/react-native/compare/v0.71.6...v0.71.7) This release is primarily aimed at addressing issues with ANRs using multiline TextInput on Samsung devices ([https://github.com/facebook/react-native/issues/35936](https://togithub.com/facebook/react-native/issues/35936), [https://github.com/facebook/react-native/issues/35590](https://togithub.com/facebook/react-native/issues/35590)). ##### Fixed ##### iOS specific - Address Hermes performance regression ([9be2959](https://togithub.com/facebook/react-native/commit/9be29593c8bac64178d441e46c6f7b31e591360e) by [@​dmytrorykun](https://togithub.com/dmytrorykun)) ##### Android specific - Resolved bug with Text components in new arch losing text alignment state. ([31a8e92cad](https://togithub.com/facebook/react-native/commit/31a8e92caddcdbef9fe74de53e7f412a7e998591) by [@​javache](https://togithub.com/javache)) - Mimimize EditText Spans 9/9: Remove `addSpansForMeasurement()` ([92b8981499](https://togithub.com/facebook/react-native/commit/92b898149956a301a44f99019f5c7500335c5553) by [@​NickGerleman](https://togithub.com/NickGerleman)) - Minimize EditText Spans 8/N: CustomStyleSpan ([b384bb613b](https://togithub.com/facebook/react-native/commit/b384bb613bf533aebf3271ba335c61946fcd3303) by [@​NickGerleman](https://togithub.com/NickGerleman)) - Minimize EditText Spans 6/N: letterSpacing ([5791cf1f7b](https://togithub.com/facebook/react-native/commit/5791cf1f7b43aed1d98cad7bcc272d97ab659111) by [@​NickGerleman](https://togithub.com/NickGerleman)) - Minimize Spans 5/N: Strikethrough and Underline ([0869ea29db](https://togithub.com/facebook/react-native/commit/0869ea29db6a4ca20b9043d592a2233ae1a0e7a2) by [@​NickGerleman](https://togithub.com/NickGerleman)) - Minimize Spans 4/N: ReactForegroundColorSpan ([8c9c8ba5ad](https://togithub.com/facebook/react-native/commit/8c9c8ba5adb59f7f891a5307a0bce7200dd3ac7d) by [@​NickGerleman](https://togithub.com/NickGerleman)) - Minimize Spans 3/N: ReactBackgroundColorSpan ([cc0ba57ea4](https://togithub.com/facebook/react-native/commit/cc0ba57ea42d876155b2fd7d9ee78604ff8aa57a) by [@​NickGerleman](https://togithub.com/NickGerleman)) - Minimize Spans 1/N: Fix precedence ([1743dd7ab4](https://togithub.com/facebook/react-native/commit/1743dd7ab40998c4d3491e3b2c56c531daf5dc47) by [@​NickGerleman](https://togithub.com/NickGerleman)) - Fix measurement of uncontrolled TextInput after edit ([8a0fe30591](https://togithub.com/facebook/react-native/commit/8a0fe30591e21b90a3481c1ef3eeadd4b592f3ed) by [@​NickGerleman](https://togithub.com/NickGerleman)) *** You can participate in the conversation on the status of this release in this [discussion](https://togithub.com/reactwg/react-native-releases/discussions/65). *** To help you upgrade to this version, you can use the [upgrade helper](https://react-native-community.github.io/upgrade-helper/) ⚛️ *** You can find the whole changelog history in the [changelog.md file](https://togithub.com/facebook/react-native/blob/main/CHANGELOG.md). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/dooboolab-community/dooboo-ui). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41Ny4wIiwidXBkYXRlZEluVmVyIjoiMzUuNTcuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Hey everyone - a quick update on this: the 0.69.10 release is out, bringing the fixes back to the last minor in the release window: https://github.com/facebook/react-native/releases/tag/v0.69.10 We're also backporting it to 68, will start working on that asap. |
Hey everyone - as promised, we've backported the fixes to 0.68 too: https://github.com/facebook/react-native/releases/tag/v0.68.7 Please bear in mind that this 0.68 patch release was done as an exceptional measure to help address this very impactful problem. We do not expect to do more patches for this minor, as it is out of the release support window. Please upgrade to newer versions asap. Given the general silence since this new round of patches, we are assuming that it means that the problem is indeed addressed - massive props to @NickGerleman for his work in working on this! We'll leave the issue open a few more days to see how things evolve just in case, after which we'll close. |
@kelset - Below fix is applicable to v0.68.2 or upgrade to new versions? https://github.com/facebook/react-native/releases/tag/v0.68.7 |
@gkasireddy202 you need to upgrade from 0.68.2 to 0.68.7 ➡️ https://react-native-community.github.io/upgrade-helper/?from=0.68.2&to=0.68.7 |
If you upgrade to 0.68.7 version, the results will be the same. |
@kelset - Could you please let me know if there is a solution available for version 0.59, or if it's also possible to backport the fixes? |
sorry, we won't be backporting to 0.59. It's a very old version and our recommendation is to upgrade to newer ones. I am not aware of any workarounds that would work for that version. |
This issue occurs even if you update to 0.68.7 version. I have this problem when I use TextInput and FlatList together and FlatList has inverted properties. We've solved the issue with a different solution. |
@JihooDev sharing gow yo solve it may help others, would you be so kind to share your solution? |
I can confirm that app hangs/typing is slowed down even after upgrading RN 0.71. We are using Flatlist with inverted property. we solved it by removing inverted property and applying styles for inverting the list. export const platformComponentStyle = {transform: [{rotate: '180deg'}]}; |
I don't think it's a good solution, but it's a problem that the user keeps experiencing discomfort, so I had to solve it somehow.
If there is a better solution, I will try to replace it with that method. If there is a better way or if you couldn't solve it by the above method, please comment |
It really sounds like the problem stems from this Flatlist inverted problem - which has been reported multiple times. I'm currently trying to de-duplicate all the existing reports into one issue, so that we can use that as the main issue to discuss said problem. (I'll update this one here once there's some clarity) I'm going to close this as no new reports specific about the TextInput issue combo that we wanted to address (TextInput, Grammarly, Samsung) have been produced - so we can consider it addressed. If you can create a new repro that does not involve an inverted FlatList, please open a new issue. |
It is working after upgrade to 0.68.7? |
We are using RN |
Sumsung Galaxy A71 , Sumsung Galaxy A32, Sumsung Galaxy A53 phone the following crash occurs , hope to give me solution,thanks React Native Version Output of npx react-native info Steps to reproduce Snack, screenshot, or link to a repository |
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 |
UPDATE: we have now released patch releases containing fixes for:
Description
There is an issue with React Native's
TextInput
component when using Samsung's keyboard with the Grammarly integration enabled. When typing a text that is longer than a few lines, the app often hangs and becomes unresponsive, leading to a high rate of ANRs and crashes.This issue has already been documented here and here but I'm worried that the lack of a reliable reproducer as well as the noise due to other random freeze and crashes in Android (esp. with the new Android 13 update) is preventing those issues from gaining traction and becoming a high priority.
I am therefore creating this new issue focused solely on the impact of the Samsung keyboard's Grammarly integration on the
TextInput
component, with a reliable reproducer, as I believe that something can be done at theTextInput
level to address it.Here is everything we know so far:
TextInput
seem to be impacted.value
prop. Switching to uncontrolled inputs decreased the amount of occurences of the issue in the field for us, but it's still happening a lot. More info here.android.text.SpannableStringBuilder
android.text.DynamicLayout.reflow
when reproducing the issue, as well as a higher number of calls toandroid.text.SpannableStringBuilder.countSpans
.You'll find an example ANR stacktrace, recorded callstacks on different keyboards, and details of the callstacks in the toggles below.
ANR stacktrace
Profiling with callstacks
Samsung keyboard with controlled input
https://drive.google.com/file/d/1vecylVsRx5Hh-XRI4LfACXwO9DtOcO_h/view?usp=share_link
Gboard with controlled input
https://drive.google.com/file/d/1avWBkD_NgDodccr3CW2flFX-AWpcfN3z/view?usp=share_link
Version
Latest version (0.70.6) but earlier ones as well
Output of
npx react-native info
Steps to reproduce
minimal-text-input-repro
repo to get the app running on a Samsung deviceFor convenience, here is a wall of text you can copy to reproduce the issue. Try pasting it multiple times if pasting it once doesn't trigger the issue straight away.
Wall of text
Snack, code example, screenshot, or link to a repository
Snack: https://snack.expo.dev/@marin-birdie/minimal-text-input-repro
Repo: https://github.com/Houguiram/minimal-text-input-repro
The text was updated successfully, but these errors were encountered: