Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS][TextInput] Fix controlled TextInput for Chinese (and other languages) #18456

Closed
@@ -23,6 +23,7 @@ @implementation RCTBaseTextInputShadowView
NSAttributedString *_Nullable _localAttributedText;
CGSize _previousContentSize;

NSString *_text;
NSTextStorage *_textStorage;
NSTextContainer *_textContainer;
NSLayoutManager *_layoutManager;
@@ -101,6 +102,17 @@ - (void)invalidateContentSize
});
}

- (NSString *)text
{
return _text;
}

- (void)setText:(NSString *)text
{
_text = text;
_previousAttributedText = _localAttributedText;
}

#pragma mark - RCTUIManagerObserver

- (void)uiManagerWillPerformMounting
@@ -321,7 +321,7 @@ - (void)textInputDidChange

_nativeEventCount++;

if (_onChange) {
if (_onChange && backedTextInputView.markedTextRange == nil) {
_onChange(@{
@"text": self.attributedText.string,
@"target": self.reactTag,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.