Changed RCTTextView to check for failed focus

Reviewed By: nicklockwood

Differential Revision: D3378236

fbshipit-source-id: b4a33f7808ffe116b51631cde35f5cd0042caee9
This commit is contained in:
Nathan Azaria 2016-06-03 16:08:34 -07:00 committed by Facebook Github Bot 4
parent 03512fb721
commit 724134746b
2 changed files with 11 additions and 2 deletions

View File

@ -48,6 +48,14 @@
_jsRequestingFirstResponder = NO;
}
- (void)didMoveToWindow
{
if (_jsRequestingFirstResponder) {
[self becomeFirstResponder];
[self reactDidMakeFirstResponder];
}
}
@end
@implementation RCTTextView

View File

@ -1032,8 +1032,9 @@ RCT_EXPORT_METHOD(focus:(nonnull NSNumber *)reactTag)
[self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
UIView *newResponder = viewRegistry[reactTag];
[newResponder reactWillMakeFirstResponder];
[newResponder becomeFirstResponder];
[newResponder reactDidMakeFirstResponder];
if ([newResponder becomeFirstResponder]) {
[newResponder reactDidMakeFirstResponder];
}
}];
}