Skip to content

Commit 4d5dbbc

Browse files
committed
refactor(ios): additional info about _recentInputString 'if' branches
1 parent 21b7319 commit 4d5dbbc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

ios/EnrichedTextInputView.mm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,12 +1722,15 @@ - (void)anyTextMayHaveBeenModified {
17221722
}
17231723

17241724
if (![textView.textStorage.string isEqualToString:_recentInputString]) {
1725-
1726-
// emit onChangeText event
17271725
auto emitter = [self getEventEmitter];
17281726
if (emitter != nullptr) {
1727+
// set the recent input string only if the emitter is defined
1728+
// to properly emit the initial onChangeText event
1729+
// as anyTextMayHaveBeenModified also runs before the emitter's
1730+
// initialization
17291731
_recentInputString = [textView.textStorage.string copy];
17301732

1733+
// emit onChangeText event
17311734
if (_emitTextChange) {
17321735
// emit string without zero width spaces
17331736
NSString *stringToBeEmitted = [[textView.textStorage.string

0 commit comments

Comments
 (0)