Skip to content
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

Android: textinput is really slow in Android 13 #464

Closed
RyanTG opened this issue Oct 30, 2022 · 10 comments
Closed

Android: textinput is really slow in Android 13 #464

RyanTG opened this issue Oct 30, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@RyanTG
Copy link
Collaborator

RyanTG commented Oct 30, 2022

Android 13 was just released. We got a user report that the app bogs down bigtime while typing machine comments.

And I saw another report (on an Expo chat) where someone experienced this. So, it might be a known issue. I do not know the solution yet.

Also, I have a feeling that my Android testing phone might be too old to get Android 13. So I might have trouble testing this. But I'll check.

@RyanTG RyanTG added bug Something isn't working 5.2.12 labels Oct 30, 2022
@RyanTG
Copy link
Collaborator Author

RyanTG commented Nov 9, 2022

Notes: Hoping that SDK 47 (with upgrades React and React Native) fixes this. I can't test Android 13 on my phone. We also seem to experiencing other issues with Android 13, but again SDK 47 may help here, and we've also added Sentry support for better debugging.

@RyanTG
Copy link
Collaborator Author

RyanTG commented Nov 13, 2022

Note from Expo discord:

You could look into how you are using the TextInput. Maybe your already doing this but putting your state text into defaultValue instead of value performs better. That’s if you require no validation or extra work on the state as the user types.

On machine comments, we have:

onChangeText={conditionText => this.setState({ conditionText })}
value={this.state.conditionText}

which is using value and not defaultValue, and we use onChangeText (is that working as each letter is typed?).

More: https://dev.to/kevinkh89/how-to-solve-input-delay-lagging-in-react-j2o
uncontrolled vs controlled inputs.

old issue that still affects people facebook/react-native#20119

@bpoore
Copy link
Collaborator

bpoore commented Nov 19, 2022

Yes, onChangeText is updating the component state as each letter is typed. If we want to continue to enforce something is typed prior to being able to submit a condition, we will need to keep tracking via state. It looks like we can swap the value prop for the defaultValue prop. If that does enough to fix our issue, AMAZING, but I would also be surprised if it did. We can give it a shot though. Branch

@RyanTG RyanTG added 5.2.13 and removed 5.2.12 labels Nov 22, 2022
@RyanTG
Copy link
Collaborator Author

RyanTG commented Nov 22, 2022

Note: we now have Android 13 in an emulator, and one more tester (with another to come soon). The emulator and the 2nd tester are not experiencing this issue.

Still unknown if the 1st tester is still experiencing this with the defaultValue change.

@Phong-TH
Copy link

@RyanTG do you have any ideas for this? I have the same issue.

@RyanTG
Copy link
Collaborator Author

RyanTG commented Nov 24, 2022

@Phong-TH You’re experiencing it with our app or your own? If our app, did you upgrade to the version we released yesterday?

If your app, changing the textinput to use defaultValue seems to have fixed it.
Our commit with what seems to be the fix 0d199f9

@Phong-TH
Copy link

@RyanTG I have changed the value prop to defaultValue prop, it works fine on the Pixel devices but not on Samsung devices running on Android 13. Our clients are experiencing this issue with our apps.

@RyanTG
Copy link
Collaborator Author

RyanTG commented Nov 25, 2022

Shoot. We haven’t thoroughly tested too many devices, but will check and see if we’re still experiencing this with Samsungs. I know Beth here had an idea about using ref (but she was throwing out ideas and we didn’t try it yet). To quote our private chat:

let’s try this first approach of removing value and if it’s still not good, I will try to figure out how to target the underlying element containing the text in the text input with a ref

@Phong-TH
Copy link

@RyanTG We will try this solution: set the value to a ref in onChangeText event instead of using useState, but we can't test in Samsung devices running on Android 13 right now. Hope it can fix the issue.

@gkasireddy202
Copy link

@Phong-TH - Any example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants