mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-20 16:04:32 +08:00
Fix textAttributes not applied when typing text (#23585)
Summary: Currently, if we has `defaultValue`, textAttributes like `letterSpacing` can works, but if textinput has not default text, when we typing the text, some attributes not applied. [iOS] [Fixed] - Fix textAttributes not applied when typing text Pull Request resolved: https://github.com/facebook/react-native/pull/23585 Differential Revision: D14206568 Pulled By: cpojer fbshipit-source-id: 7db276d811684bf6e01f8d30287cca80095db87c
This commit is contained in:
committed by
Facebook Github Bot
parent
8d2e8fdca4
commit
7a7eb11965
@@ -11,6 +11,7 @@
|
||||
#import <React/UIView+React.h>
|
||||
|
||||
#import "RCTBackedTextInputDelegateAdapter.h"
|
||||
#import "RCTTextAttributes.h"
|
||||
|
||||
@implementation RCTUITextView
|
||||
{
|
||||
@@ -19,6 +20,8 @@
|
||||
RCTBackedTextViewDelegateAdapter *_textInputDelegateAdapter;
|
||||
}
|
||||
|
||||
@synthesize reactTextAttributes = _reactTextAttributes;
|
||||
|
||||
static UIFont *defaultPlaceholderFont()
|
||||
{
|
||||
return [UIFont systemFontOfSize:17];
|
||||
@@ -88,6 +91,20 @@ static UIColor *defaultPlaceholderColor()
|
||||
_placeholderView.textColor = _placeholderColor ?: defaultPlaceholderColor();
|
||||
}
|
||||
|
||||
- (void)setReactTextAttributes:(RCTTextAttributes *)reactTextAttributes
|
||||
{
|
||||
if ([reactTextAttributes isEqual:_reactTextAttributes]) {
|
||||
return;
|
||||
}
|
||||
self.typingAttributes = reactTextAttributes.effectiveTextAttributes;
|
||||
_reactTextAttributes = reactTextAttributes;
|
||||
}
|
||||
|
||||
- (RCTTextAttributes *)reactTextAttributes
|
||||
{
|
||||
return _reactTextAttributes;
|
||||
}
|
||||
|
||||
- (void)textDidChange
|
||||
{
|
||||
_textWasPasted = NO;
|
||||
|
||||
Reference in New Issue
Block a user