Skip to content

Commit e188585

Browse files
soumyajit4419facebook-github-bot
authored andcommitted
reduce cursor size for multiline(TextInput) (#36484)
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
1 parent 7410746 commit e188585

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,11 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position
298298
return CGRectZero;
299299
}
300300

301-
return [super caretRectForPosition:position];
301+
CGRect rect = [super caretRectForPosition:position];
302+
UIFont *font = self.font;
303+
rect.size.height = font.pointSize - font.descender;
304+
rect.origin.y -= font.descender;
305+
return rect;
302306
}
303307

304308
#pragma mark - Utility Methods

0 commit comments

Comments
 (0)