Skip to content

Commit

Permalink
Merge pull request #3 from CHANOMA/feature/fix_textinput_bugs
Browse files Browse the repository at this point in the history
Apply facebook#18456 Fix controlled TextInput for Chinese (and other languages)
  • Loading branch information
yuya-fujimoto committed Mar 23, 2018
2 parents d53747f + 169a025 commit 57819bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Libraries/Text/TextInput/RCTBaseTextInputShadowView.m
Expand Up @@ -25,6 +25,7 @@ @implementation RCTBaseTextInputShadowView
NSAttributedString *_Nullable _localAttributedText;
CGSize _previousContentSize;

NSString *_text;
NSTextStorage *_textStorage;
NSTextContainer *_textContainer;
NSLayoutManager *_layoutManager;
Expand Down Expand Up @@ -97,6 +98,17 @@ - (void)invalidateContentSize
});
}

- (NSString *)text
{
return _text;
}

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

#pragma mark - RCTUIManagerObserver

- (void)uiManagerWillPerformMounting
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Text/TextInput/RCTBaseTextInputView.m
Expand Up @@ -311,7 +311,7 @@ - (void)textInputDidChange

_nativeEventCount++;

if (_onChange) {
if (_onChange && backedTextInputView.markedTextRange == nil) {
_onChange(@{
@"text": self.attributedText.string,
@"target": self.reactTag,
Expand Down

0 comments on commit 57819bb

Please sign in to comment.