fix: wrong selection coordinates dispatch on iOS #1156
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 Description
Fixed a problem with unexpected scroll in
KeyboardAwareScrollView
when you edit text in multiline input (which is bigger than screen size) in the beginning of the input.💡 Motivation and Context
This PR enhances logic added in #491 When we deal with multiline inputs we may receive wrong selection coordinates. In #491 we were receiving them when input was growing (increasing its size). In this PR I discovered that we may receive a wrong selection coordinates even when input size remains the same.
Note
This bug is reproducible only on new architecture (I think it's a matter of timing and on new architecture everything is more synchronous comparing to old architecture).
So in this PR I'm enhancing functionality of
canSelectionFitIntoLayout
:true
if it's notmultiline
input;textView.layoutManager.ensureLayout(for: textView.textContainer)
to assure react calculation is correctI also checked and #489 is not reproducible
Closes #1148
📢 Changelog
iOS
true
fromcanSelectionFitIntoLayout
if it's notmultiline
input;ensureLayout
to read correct rect frame.🤔 How Has This Been Tested?
Tested manually on iPhone 16 Pro (iOS 26, XCode 26).
📸 Screenshots (if appropriate):
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-10-11.at.12.50.39.mov
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-10-11.at.12.48.11.mov
📝 Checklist