Commit 55cca5c 1 parent 1ea6e3a commit 55cca5c Copy full SHA for 55cca5c
File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,8 @@ @interface RCTBackedTextViewDelegateAdapter () <UITextViewDelegate>
168
168
169
169
@implementation RCTBackedTextViewDelegateAdapter {
170
170
__weak UITextView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
171
+ NSAttributedString *_lastStringStateWasUpdatedWith;
172
+ BOOL _ignoreNextTextInputCall;
171
173
BOOL _textDidChangeIsComing;
172
174
UITextRange *_previousSelectedTextRange;
173
175
}
@@ -254,12 +256,21 @@ - (BOOL)textView:(__unused UITextView *)textView shouldChangeTextInRange:(NSRang
254
256
255
257
- (void )textViewDidChange : (__unused UITextView *)textView
256
258
{
259
+ if (_ignoreNextTextInputCall && [_lastStringStateWasUpdatedWith isEqual: _backedTextInputView.attributedText]) {
260
+ _ignoreNextTextInputCall = NO ;
261
+ return ;
262
+ }
263
+ _lastStringStateWasUpdatedWith = _backedTextInputView.attributedText ;
257
264
_textDidChangeIsComing = NO ;
258
265
[_backedTextInputView.textInputDelegate textInputDidChange ];
259
266
}
260
267
261
268
- (void )textViewDidChangeSelection : (__unused UITextView *)textView
262
269
{
270
+ if (![_lastStringStateWasUpdatedWith isEqual: _backedTextInputView.attributedText]) {
271
+ [self textViewDidChange: _backedTextInputView];
272
+ _ignoreNextTextInputCall = YES ;
273
+ }
263
274
[self textViewProbablyDidChangeSelection ];
264
275
}
265
276
You can’t perform that action at this time.
0 commit comments