-
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
Fix: multiline textinput start "jerking" when trying to move cursor. #32179
Fix: multiline textinput start "jerking" when trying to move cursor. #32179
Conversation
Base commit: 3562364 |
Base commit: 3562364 |
Can we add a comment about why this is needed? |
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.
Can we leave a comment about what this is for
@lunaleaps thank you for the review. |
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.
Great thank you! I might even add a link to the issue in the comments if that's okay with you? #30748
@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@lunaleaps that makes sense, added one more comment for the link, thanks for all the help ❤️ |
@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
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.
great work! thanks for doing this.
// Excluding this for iOS 14 and above. | ||
// This fixes multiline textinput "jerking" when trying to move cursor. | ||
// See https://github.com/facebook/react-native/issues/30748 for more context. | ||
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED < 140000 |
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.
Sorry for the back and forth but chatting internally, we'll update this comment to the following since it seems like setContentOffset animated:NO
was originally a fix for "flaky scrolling" for versions prior to iOS 14
// Turn off scroll animation to fix flaky scrolling.
// This is only necessary for iOS <= 13
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.
No worries at all, this makes more sense and actually reduces the chance of confusion for the next maintainer, thanks for that.
This pull request was successfully merged by @xiankuncheng in 2280187. When will my fix make it into a release? | Upcoming Releases |
Summary
Fixes #30748: on iOS 14, when trying to hold down the space bar and move the cursor on a multi-line TextInput with lots of lines, the cursor could not be scrolled to the desired point. It works as expected on iOS 13 and before.
Figured out that iOS14 acting as expected without
[setContentOffset:animated:]
, so exclude it when iOS version is and above 14.Credit to @efstathiosntonas for the finding and solution provides.
Related issue
Changelog
[iOS] [Fixed] - Fixed the issue when moving cursor in multi-line TextInput.
Test Plan
TextInput
in tabComponents
Multiline
section and focus on the first childTextInput
(simulator without showing keyboard)Video Before:
RPReplay_Final1631248010.MP4
Video After:
RPReplay_Final1631248159.MP4