Skip to content

Commit

Permalink
Resubmit #24714 and fixes kvo crash (#24840)
Browse files Browse the repository at this point in the history
Summary:
Resubmit #24714.
From the #24714 (comment), seems it would crash sometimes. JoshuaGross Hi :) I added a method to let `UITextField` call the cleanup explicitly. Please check again, thanks!

## Changelog

[iOS] [Fixed] - Fixes selection of single line text input
Pull Request resolved: #24840

Differential Revision: D15415793

Pulled By: JoshuaGross

fbshipit-source-id: 2bb32aa8a1fd8fad116177aac760509649c4a423
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed May 21, 2019
1 parent 34d88bc commit c38f167
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Libraries/Text/TextInput/Singleline/RCTUITextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ - (CGRect)editingRectForBounds:(CGRect)bounds

#pragma mark - Overrides

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
// Overrides selectedTextRange setter to get notify when selectedTextRange changed.
- (void)setSelectedTextRange:(UITextRange *)selectedTextRange
{
[super setSelectedTextRange:selectedTextRange];
[_textInputDelegateAdapter selectedTextRangeWasSet];
}
#pragma clang diagnostic pop

- (void)setSelectedTextRange:(UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate
{
if (!notifyDelegate) {
Expand Down

0 comments on commit c38f167

Please sign in to comment.