Apply correct text attributes in TextInput.setTextAndSelection

Summary:
Changelog: [internal]

Make sure correct text attributes are used inside of view command.

Reviewed By: sshic

Differential Revision: D29585943

fbshipit-source-id: 4748c843ff586f1dd42f3a89460afb624f9b371a
This commit is contained in:
Samuel Susla
2021-07-07 07:11:03 -07:00
committed by Facebook GitHub Bot
parent d85d72d0d9
commit b52950bda2
@@ -421,11 +421,9 @@ using namespace facebook::react;
}
_comingFromJS = YES;
if (![value isEqualToString:_backedTextInputView.attributedText.string]) {
NSMutableAttributedString *mutableString =
[[NSMutableAttributedString alloc] initWithAttributedString:_backedTextInputView.attributedText];
[mutableString replaceCharactersInRange:NSMakeRange(0, _backedTextInputView.attributedText.length)
withString:value];
[self _setAttributedString:mutableString];
NSAttributedString *attributedString =
[[NSAttributedString alloc] initWithString:value attributes:_backedTextInputView.defaultTextAttributes];
[self _setAttributedString:attributedString];
[self _updateState];
}