Skip to content

Commit

Permalink
fix: "onKeyPress" prop of TextInput
Browse files Browse the repository at this point in the history
The replacement text in "shouldChangeTextInRange:replacementText:" may be a mutable string, so we need to copy it to prevent changes to the "_predictedText" internal property.
  • Loading branch information
aleclarson committed Feb 16, 2019
1 parent 58c992b commit d09a4d9
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 @@ -279,7 +279,7 @@ - (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSStrin
if (_predictedText) {
_predictedText = [_predictedText stringByReplacingCharactersInRange:range withString:text];
} else {
_predictedText = text;
_predictedText = [text copy];
}

if (_onTextInput) {
Expand Down

0 comments on commit d09a4d9

Please sign in to comment.