Skip to content

Commit

Permalink
[iOS] Fixes onChangeText of TextInput is fired with text longer than …
Browse files Browse the repository at this point in the history
…maxLength
  • Loading branch information
zhongwuzw committed Dec 15, 2023
1 parent 5d1eac0 commit dbfabf4
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,12 @@ - (void)textViewDidChange:(__unused UITextView *)textView
- (void)textViewDidChangeSelection:(__unused UITextView *)textView
{
if (_lastStringStateWasUpdatedWith && ![_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
[self textViewDidChange:_backedTextInputView];
BOOL shouldChangeText = [self textView:_backedTextInputView
shouldChangeTextInRange:NSMakeRange(0, _backedTextInputView.text.length)
replacementText:_backedTextInputView.text];
if (shouldChangeText) {
[self textViewDidChange:_backedTextInputView];
}
_ignoreNextTextInputCall = YES;
}
_lastStringStateWasUpdatedWith = _backedTextInputView.attributedText;
Expand Down

0 comments on commit dbfabf4

Please sign in to comment.