-
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 is causing app to hang in Samsung devices with Android 13 #35155
Comments
I'm having a similar ANR but with Pixel phones. And it's only happening in Android 13. |
I have the same issue with samsung Android 13 |
Our users are experiencing the same thing. Can you confirm that suggestions are causing the hanging? How did you guys workaround it? |
We set the |
Subscribing |
Currently we are setting |
Looks like it might not just be related to react-native, https://support.google.com/pixelphone/thread/181332682/keyboard-freezing-after-android-13-update?hl=en |
Yes @Saad-Bashar. This is an ugly hack but better to have that than the app freezing every time they are typing. |
I wouldn't say this is related to this issue since there are not enough data to say this is happening to all devices with Android 13 (I have a Google Pixel 4 XL and I have not experienced any issue with the keyboard). |
@JuanAlejandro hi! i downloaded your repo today. but, i cannot reproduce the problem. there are only expected results - "The app works properly when the user types". |
Hi @rudenick0309! Does your Samsung device has Android 13? I just updated the steps to include "Samsung S22 with Android 13" in the 3rd step. You can see how this issue is repro in the video below video-repro-s22-android-13.mp4 |
@JuanAlejandro thank your answer! but, i have device like you. exactly samsung 22, 22+, 22ultra with android 13. i dont know why i cannot reproduce this problem. am i lucky? :) By the way, did you solve it by putting " keyboardType={'visible-password'} " in the TextInput tag? |
@rudenick0309 just one last thing... are you using the default keyboard of Samsung? There are a handful of users that prefer to have the Gboard. I don't know if the issue still persists with a different keyboard, but it might be a possibility. And yes, I solved it by putting the |
@JuanAlejandro thank you for your advice. you are right. i have not received any complaints or ANRs. i will do more consider. thanks to your support, if i meet these case, i will solve more quickly! thank you |
@JuanAlejandro @rudenick0309 Our customers have the same issue with Android 13 on Samsung and Pixel devices (both Samsung Keyboard and Gboard). Just typing a sentence, the application will throw the ANR pop-up and must be forced close. We can't turn off the predictive or spell check due to production requirements. Do you have any suggestions, we have received many complaints about that day by day. |
Unfortunately, our case is the same. One of the key functionality of our apps is writing text in the TextInput. The majority of our android users are using Samsung. We are getting so many crashes every day :( |
Same here! The solution |
Do you mean you still get the crashes for multiline inputs? Because we have multiline inputs. Thanks. |
@Saad-Bashar No I mean the input will be narrowed to one line, so you can't have TextArea-like inputs |
So, in our use case, I was able to identify the issue and it's actually a bug in the android framework (issue only happens on android version 13 for us) You can find more details here: #35350 (comment) |
We used |
@hannojg can we change any lines on the native or android framework to fix this problem? |
@Phong-TH If you don't use rotation anywhere in your react-native code, you can try commenting the rotation lines: |
If the issue is with the usage of an inverted FlatList I recommend manually inverting the FlatList. If you guys are interested I can post an example |
@hannojg by rotation you mean orientation change, right? |
+1 with the above, auto suggestions is a needed feature for any chatting app. |
Agree this suggestion is a non runner. It also disables it for all android devices, right now we can just disable it for Samsung Android 13 by setting the type to visible-password |
Today a new update came out on my S22 Android 13, after installing it and testing out my production app the lag was almost 0. Can anyone else confirm? edit: build number is |
I believe |
https://developer.samsung.com/one-ui-beta
|
@fabriziobertoglio1987 it’s not clear if it is a UI or general bug fixes update: https://doc.samsungmobile.com/SM-S901B/EUX/doc.html |
I'm still seeing the issue after installing the OTA update. |
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. |
Is there any official place where we can follow up on this particular textinput ANR issue? it is getting out of hand and I see it all over the place with nothing official and no actual progress on that issue so I don't even know if it's in google's hands, or samsung, or react native? |
@kelset is the react-native team aware of this issue? Thank you 🙏 |
I think we can be a bit more specific here to avoid affecting users on earlier versions of Android import { Platform, TextInput } from "react-native";
TextInput.defaultProps = {
...TextInput.defaultProps,
autoCorrect: Platform.OS === 'ios' || Platform.Version !== 33,
keyboardType:
Platform.OS === 'android' && Platform.Version === 33 ? 'visible-password' : 'default',
returnKeyType: Platform.OS === 'android' && Platform.Version === 33 ? 'none' : 'default',
spellCheck: Platform.OS === 'ios' || Platform.Version !== 33,
} |
Thank you @swrobel for this suggestion. |
@swrobel Not yet, the only workaround I found was increasing the number of lines property, like numberOfLines={3} |
We've finally solved this issue for our app, the root cause was re-renders locking up the UI. Echoing @Houguiram on this comment #35155 (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. |
@swrobel |
@mglobel - Great.
} |
@gkasireddy202 There was one place where we don't actually have mobx and used another solution. We simply added a variable on the class component instead of using state and updated it directly. Normally we don't do this because we want to use state to take advantage of React's DOM re-rendering. But in this case it seems to be hurting us. So in your constructor function:
And then onChangeText:
And then you can actually remove the |
I still get ANRs and all the other issues on the latest Samsung firmware with react-native based apps when using Google Keyboard Much like the goggles, this does nothing |
I would like to help some people here with chat views that are freezing. There are two issues at play here
The inverted flat list issue has a work around that involves drawing it upside down and then drawing the contents upside down. This issue has a "work around" of switching the text input type to visible password. |
Actually this did come in useful in the end for me as a temporary measure. At least I can keep emojis for my input and I'm just losing autocomplete and autocorrect. So I'm just setting keyboardType: "no-suggestions" for Samsung Android 13 and leaving every other device and OS as normal |
@ruairioliverwv what keyboardType is the "no suggestions" you are talking about? It is beyond me how such a huge issue can remain pending and obscure after all these months... |
@pierroo you'd need to build react-native from source I think and use the changes here to add the no-suggestions keyboard type. Once done though the outcome is nicer than visible-password which is the best we have without this change. At least users can use emojis again with this |
Thank you for your answer; |
Any solution without disabling the no-suggestions keyboard. |
Multiline is fine for me with visible-password and no-suggestions but need to set the returnKeyType to none. So this is the function I'm using to get my extra input props.
|
Closing issue as we're addressing in #35590 (comment) |
Please suggest any accurate solution to resolve this issue. |
Description
Our app is throwing ANRs when users with Samsung devices with Android 13 are typing in input fields. We had a similar issue for Samsung users with Android 12 and we ended up disabling auto-correct for those users to fix this issue. Now it looks like is the suggestions setting that is causing ANRs in Android 13 so we are setting the
keyboardType
asvisible-password
to avoid suggestions.Version
0.69.3
Output of
npx react-native info
Steps to reproduce
1 - Clone the repo https://github.com/JuanAlejandro/keyboard-issue-samsung
2 - Run
yarn install
3 - Test
release
variant in a Samsung S22 with Android 134 - Start typing until you reach 3-4 lines of text.
Expected result:
Actual result:
Snack, code example, screenshot, or link to a repository
GitHub repo: https://github.com/JuanAlejandro/keyboard-issue-samsung
Video:
https://user-images.githubusercontent.com/11820379/199054761-5bd9d015-488f-4528-bf5e-4992f02e41c0.mp4
The text was updated successfully, but these errors were encountered: