-
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
Cap selection indices when text changes #26680
Cap selection indices when text changes #26680
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request was successfully merged by @MarcoPolo in 6ebd3b0. When will my fix make it into a release? | Upcoming Releases |
hey @cpojer! |
I'm also facing same issue.. |
Summary: This PR facebook#22723 cached selections, so if you had a cached selection indicies, but updated the text to be an empty string, then this would crash. As reported in facebook#25265 and other issues of `setSpan(4 ... 4) ends beyond length` ## Changelog [Android] [fixed] - Crash in TextInput Pull Request resolved: facebook#26680 Test Plan: ``` input.setNativeProps({ text: "xxx", selection: {"begin": 0, "end": 3}}); input.setNativeProps({ text: ""}); ``` Differential Revision: D18189703 Pulled By: cpojer fbshipit-source-id: 67d9615a863fd22598be8d6d4553dec5ac8837ed
Summary
This PR #22723 cached selections, so if you had a cached selection indicies, but updated the text to be an empty string, then this would crash.
As reported in #25265 and other issues of
setSpan(4 ... 4) ends beyond length
Changelog
[Android] [fixed] - Crash in TextInput
Test Plan