From 72dd1cf49478f58b428087734d2f5aafaf2ed4c1 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Fri, 15 Feb 2019 09:49:54 +0800 Subject: [PATCH] [iOS] Fix TextInput maxLength when insert characters at begin --- Libraries/Text/TextInput/RCTBaseTextInputView.m | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index 231680750dcd9a..3b6046af44b44e 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -338,11 +338,7 @@ - (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSStrin NSString *previousText = [_predictedText substringWithRange:range] ?: @""; - if (!_predictedText || backedTextInputView.attributedText.string.length == 0) { - _predictedText = text; - } else { - _predictedText = [_predictedText stringByReplacingCharactersInRange:range withString:text]; - } + _predictedText = [backedTextInputView.attributedText.string stringByReplacingCharactersInRange:range withString:text]; if (_onTextInput) { _onTextInput(@{