TextInput: Simplified `selectTextOnFocus` logic
Summary: Previous implementation was not quite correct (because it was framed by hacky event handling) and caused some issues with new ScrollView improvements (autoscroll to focused TextInput). Reviewed By: javache Differential Revision: D5414439 fbshipit-source-id: 72d1f23170340c453b939dca8b72422822acc1d7
This commit is contained in:
parent
1d22f8fb27
commit
7da5ef372c
|
@ -95,12 +95,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|||
|
||||
- (BOOL)textInputShouldBeginEditing
|
||||
{
|
||||
if (_selectTextOnFocus) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.backedTextInputView selectAll:nil];
|
||||
});
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -110,6 +104,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|||
self.backedTextInputView.text = @"";
|
||||
}
|
||||
|
||||
if (_selectTextOnFocus) {
|
||||
[self.backedTextInputView selectAll:nil];
|
||||
}
|
||||
|
||||
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeFocus
|
||||
reactTag:self.reactTag
|
||||
text:self.backedTextInputView.text
|
||||
|
|
Loading…
Reference in New Issue