mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix: make cursor center for different line height (#36586)
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 https://github.com/facebook/react-native/issues/28012 (Problem with TextInput lineHeight on iOS) This RP will fix the issue caused in [PR](https://github.com/facebook/react-native/pull/36484) Changelog: [iOS][Added] - Fixed cursor height on multiline text input Pull Request resolved: https://github.com/facebook/react-native/pull/36586 Test Plan: Tested for different cursor height https://user-images.githubusercontent.com/46092576/227004355-3886a0b5-7cdb-4fdc-a16b-3c4abb729737.mov https://user-images.githubusercontent.com/46092576/227004361-48099f81-9f52-460d-8ae8-d0ddb09dc47d.mov Reviewed By: javache Differential Revision: D44307457 Pulled By: genkikondo fbshipit-source-id: afeea5605ed8557cdeec1e62324c85665ce367d6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a45d346823
commit
987c6fd298
@@ -298,7 +298,12 @@ static UIColor *defaultPlaceholderColor()
|
||||
return CGRectZero;
|
||||
}
|
||||
|
||||
return [super caretRectForPosition:position];
|
||||
CGRect rect = [super caretRectForPosition:position];
|
||||
UIFont *font = self.font;
|
||||
float prevHeight = rect.size.height;
|
||||
rect.size.height = font.pointSize - font.descender;
|
||||
rect.origin.y += (prevHeight - rect.size.height);
|
||||
return rect;
|
||||
}
|
||||
|
||||
#pragma mark - Utility Methods
|
||||
|
||||
Reference in New Issue
Block a user