Skip to content

Commit

Permalink
fix controlled textinput for languages and allows clearing to work: f…
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnojima committed Jun 22, 2018
1 parent 21d0eed commit c53f542
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ @implementation RCTBaseTextInputShadowView
NSAttributedString *_Nullable _localAttributedText;
CGSize _previousContentSize;

NSString * _text;
NSTextStorage *_textStorage;
NSTextContainer *_textContainer;
NSLayoutManager *_layoutManager;
Expand Down Expand Up @@ -101,6 +102,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
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,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 c53f542

Please sign in to comment.