Skip to content

Commit

Permalink
reduce cursor size for multiline(TextInput) (#36484)
Browse files Browse the repository at this point in the history
Summary:
Currently in multiline input the cursor touches the previous line.
So this reduces its height sets its position so that I does not touch previous line.
This PR will also fix the issue #28012 (Problem with TextInput lineHeight on iOS)
## Changelog

[IOS] [ADDED] - Fixed cursor height on multiline text input
<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

Pull Request resolved: #36484

Test Plan:
UI Before the change
<img width="379" alt="Screenshot 2023-03-15 at 10 16 07 PM" src="https://user-images.githubusercontent.com/46092576/225380938-23b9b8a4-4b8a-45e1-bbf1-4af8ac8d9183.png">

UI After the change
<img width="509" alt="Screenshot 2023-03-14 at 1 57 27 AM" src="https://user-images.githubusercontent.com/46092576/225380930-77ca853c-fae5-4bfa-82cf-03b2e22bf8da.png">

Reviewed By: dmytrorykun

Differential Revision: D44130814

Pulled By: javache

fbshipit-source-id: 09d53ecee6812e9a875dc5364bd91b76cc2bc1f5
  • Loading branch information
soumyajit4419 authored and facebook-github-bot committed Mar 22, 2023
1 parent 7410746 commit e188585
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,11 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position
return CGRectZero;
}

return [super caretRectForPosition:position];
CGRect rect = [super caretRectForPosition:position];
UIFont *font = self.font;
rect.size.height = font.pointSize - font.descender;
rect.origin.y -= font.descender;
return rect;
}

#pragma mark - Utility Methods
Expand Down

0 comments on commit e188585

Please sign in to comment.