Skip to content

Commit 0c11d8d

Browse files
JoshuaGrossfacebook-github-bot
authored andcommitted
Back out "[react-native][PR] [iOS] Fixes selection of single line text input"
Summary: Original commit changeset: f149721d6b4d (D15238379) This commit was causing the following crash: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fb3453eda00 of class RCTUITextField was deallocated while key value observers were still registered with it. FB: See also P64445585 T44107377 T44169319 Reviewed By: mmmulani Differential Revision: D15323255 fbshipit-source-id: 037c34ae387d912c5ea03eaa364b8c60367df357
1 parent 2cdf969 commit 0c11d8d

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m

-12
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,15 @@ - (instancetype)initWithTextField:(UITextField<RCTBackedTextInputViewProtocol> *
2828

2929
[_backedTextInputView addTarget:self action:@selector(textFieldDidChange) forControlEvents:UIControlEventEditingChanged];
3030
[_backedTextInputView addTarget:self action:@selector(textFieldDidEndEditingOnExit) forControlEvents:UIControlEventEditingDidEndOnExit];
31-
[_backedTextInputView addObserver:self forKeyPath:@"selectedTextRange" options:NSKeyValueObservingOptionNew context:NULL];
3231
}
3332

3433
return self;
3534
}
3635

37-
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
38-
{
39-
// UITextField doesn't have a delegate like UITextView to get notified on selection. Use KVO to observe changes.
40-
if ([keyPath isEqualToString:@"selectedTextRange"]) {
41-
[self textFieldProbablyDidChangeSelection];
42-
} else {
43-
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
44-
}
45-
}
46-
4736
- (void)dealloc
4837
{
4938
[_backedTextInputView removeTarget:self action:nil forControlEvents:UIControlEventEditingChanged];
5039
[_backedTextInputView removeTarget:self action:nil forControlEvents:UIControlEventEditingDidEndOnExit];
51-
[_backedTextInputView removeObserver:self forKeyPath:@"selectedTextRange"];
5240
}
5341

5442
#pragma mark - UITextFieldDelegate

0 commit comments

Comments
 (0)