Implement caretHidden in multiline text input

Summary:
Changelog: [internal]

Add missing implementation of caretHidden to multiline text input. This will work for both React Native Classic and New React Native Renderer.

Reviewed By: shergin

Differential Revision: D26818087

fbshipit-source-id: 3597604a6bd414a4a3b292d809d63a18efa8acb3
This commit is contained in:
Samuel Susla
2021-03-04 10:53:35 -08:00
committed by Facebook GitHub Bot
parent da8ed6b625
commit 7e81c1d483
2 changed files with 11 additions and 4 deletions
@@ -33,8 +33,6 @@ NS_ASSUME_NONNULL_BEGIN
// it's declared here only to conform to the interface.
@property (nonatomic, assign) UITextFieldViewMode clearButtonMode;
// The `caretHidden` property actually is not supported yet;
// it's declared here only to conform to the interface.
@property (nonatomic, assign) BOOL caretHidden;
@property (nonatomic, strong, nullable) NSString *inputAccessoryViewID;
@@ -165,8 +165,6 @@ static UIColor *defaultPlaceholderColor()
[self textDidChange];
}
#pragma mark - Overrides
- (void)setSelectedTextRange:(UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate
{
if (!notifyDelegate) {
@@ -298,6 +296,17 @@ static UIColor *defaultPlaceholderColor()
return textAttributes;
}
#pragma mark - Caret Manipulation
- (CGRect)caretRectForPosition:(UITextPosition *)position
{
if (_caretHidden) {
return CGRectZero;
}
return [super caretRectForPosition:position];
}
#pragma mark - Utility Methods
- (void)copyTextAttributesFrom:(NSAttributedString *)sourceString