Fix the bug where key shortcuts are invoked in TextInputs in iOS
Summary: This is a followup for "Add Shortcut "Double R" to Reload JS in iOS". Please see the previous two revisions:[[ D3371536 | D3371536 ]], [[ D3343907 | D3343907 ]] In previous revisions, we only tested with the iOS UIExplorer app, without testing in the iOS Catalyst app, where the key shortcuts we added are always invoked in TextInput components. It's due to a bug with the `UIApplicationDelegate`. Just fix this bug in this revision and successfully tested in the Catalyst app. Reviewed By: mkonicek Differential Revision: D3391045 fbshipit-source-id: 8b76fbfe7592218b02dd22502d25eebbc59f3cbc
This commit is contained in:
parent
5b4b027477
commit
61046c3195
|
@ -113,15 +113,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||
* For example, double-pressing a key should type two characters into the text view,
|
||||
* not invoke a predefined keyboard shortcut.
|
||||
*/
|
||||
NSString *name = NSStringFromClass(self.class);
|
||||
if ([name isEqualToString : @"AppDelegate"]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
UIResponder *firstResponder = [UIResponder RCT_getFirstResponder: self];
|
||||
if ([firstResponder isKindOfClass:[UITextView class]] ||
|
||||
[firstResponder isKindOfClass:[UITextField class]] ||
|
||||
[firstResponder conformsToProtocol:@protocol(UITextViewDelegate)]) {
|
||||
[firstResponder conformsToProtocol:@protocol(UITextViewDelegate)] ||
|
||||
[self conformsToProtocol:@protocol(UIApplicationDelegate)]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue