Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Libraries/Text/TextInput/Multiline/RCTUITextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,15 @@ - (void)setTextAlignment:(NSTextAlignment)textAlignment

- (void)setAttributedText:(NSAttributedString *)attributedText
{
// Using `setAttributedString:` while user is typing breaks some internal mechanics
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
// Using `setAttributedString:` while user is typing breaks some internal mechanics
// when entering complex input languages such as Chinese, Korean or Japanese.
// see: https://github.com/facebook/react-native/issues/19339

// We try to avoid calling this method as much as we can.
// If the text has changed, there is nothing we can do.
if (![super.attributedText.string isEqualToString:attributedText.string]) {
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
[super setAttributedText:attributedText];
#else // [TODO(macOS ISS#2323203)
[self.textStorage setAttributedString:attributedText];
#endif // ]TODO(macOS ISS#2323203)
} else {
// But if the text is preserved, we just copying the attributes from the source string.
if (![super.attributedText isEqualToAttributedString:attributedText]) {
Expand All @@ -210,6 +207,9 @@ - (void)setAttributedText:(NSAttributedString *)attributedText
}

[self textDidChange];
#else // [TODO(macOS ISS#2323203)
[self.textStorage setAttributedString:attributedText];
#endif // ]TODO(macOS ISS#2323203)
}

#pragma mark - Overrides
Expand Down
Loading