Skip to content

Commit

Permalink
Fix multiline TextInput crash when inserting/removing lots of text
Browse files Browse the repository at this point in the history
It seems that the returned string that we use to set `previousText` can
be mutated while it is waiting to be processed by RCTBridge.
  • Loading branch information
tido64 committed Jul 8, 2020
1 parent d7e8504 commit e01ab66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Text/TextInput/RCTBaseTextInputView.m
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ - (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSStrin
}
}

NSString *previousText = backedTextInputView.attributedText.string ?: @"";
NSString *previousText = [backedTextInputView.attributedText.string copy] ?: @""; // TODO(OSS Candidate ISS#2710739)

if (range.location + range.length > backedTextInputView.attributedText.string.length) {
_predictedText = backedTextInputView.attributedText.string;
Expand Down

0 comments on commit e01ab66

Please sign in to comment.