Skip to content

Commit

Permalink
[iOS] Fix TextInput maxLength when insert characters at begin
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwuzw committed Feb 15, 2019
1 parent 50fc666 commit 72dd1cf
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Libraries/Text/TextInput/RCTBaseTextInputView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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(@{
Expand Down

0 comments on commit 72dd1cf

Please sign in to comment.