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:
zhongwuzw
2019-02-24 23:37:41 -08:00
committed by Facebook Github Bot
parent 8d2e8fdca4
commit 7a7eb11965
10 changed files with 40 additions and 7 deletions
@@ -68,13 +68,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
- (void)enforceTextAttributesIfNeeded
{
id<RCTBackedTextInputViewProtocol> backedTextInputView = self.backedTextInputView;
if (backedTextInputView.attributedText.string.length == 0) {
return;
}
backedTextInputView.font = _textAttributes.effectiveFont;
backedTextInputView.textColor = _textAttributes.effectiveForegroundColor;
backedTextInputView.textAlignment = _textAttributes.alignment;
backedTextInputView.reactTextAttributes = _textAttributes;
}
- (void)setReactPaddingInsets:(UIEdgeInsets)reactPaddingInsets