From ca0670e7c16d64ca2b28a106d43eee75bb603c40 Mon Sep 17 00:00:00 2001 From: clintal Date: Mon, 14 May 2018 16:00:29 +0900 Subject: [PATCH] fix keyboard. From https://github.com/facebook/react-native/pull/18456 (not merged to RN when i created this commit) --- .../Text/TextInput/RCTBaseTextInputShadowView.m | 12 ++++++++++++ Libraries/Text/TextInput/RCTBaseTextInputView.m | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m index d1fdbcd3d25012..cf1155b9aa308a 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m @@ -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 diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index d9c47ff16311d4..ca03ace3849b57 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -311,7 +311,7 @@ - (void)textInputDidChange _nativeEventCount++; - if (_onChange) { + if (_onChange && backedTextInputView.markedTextRange == nil) { _onChange(@{ @"text": self.attributedText.string, @"target": self.reactTag,