mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
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
|
- (BOOL)textInputShouldBeginEditing
|
||||||
{
|
{
|
||||||
if (_selectTextOnFocus) {
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
[self.backedTextInputView selectAll:nil];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,6 +104,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
|||||||
self.backedTextInputView.text = @"";
|
self.backedTextInputView.text = @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_selectTextOnFocus) {
|
||||||
|
[self.backedTextInputView selectAll:nil];
|
||||||
|
}
|
||||||
|
|
||||||
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeFocus
|
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeFocus
|
||||||
reactTag:self.reactTag
|
reactTag:self.reactTag
|
||||||
text:self.backedTextInputView.text
|
text:self.backedTextInputView.text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user