Bladeren bron

fix(iOS): hideKeyboardAccessoryView on iPads (#661)

Dima Paloskin 4 jaren geleden
bovenliggende
commit
09372c9d95
1 gewijzigde bestanden met toevoegingen van 13 en 2 verwijderingen
  1. 13
    2
      ios/RNCWebView.m

+ 13
- 2
ios/RNCWebView.m Bestand weergeven

@@ -20,11 +20,22 @@ static NSDictionary* customCertificatesForHost;
20 20
 
21 21
 // runtime trick to remove WKWebView keyboard default toolbar
22 22
 // see: http://stackoverflow.com/questions/19033292/ios-7-uiwebview-keyboard-issue/19042279#19042279
23
-@interface _SwizzleHelperWK : NSObject @end
23
+@interface _SwizzleHelperWK : UIView
24
+@property (nonatomic, copy) WKWebView *webView;
25
+@end
24 26
 @implementation _SwizzleHelperWK
25 27
 -(id)inputAccessoryView
26 28
 {
27
-  return nil;
29
+    if (_webView == nil) {
30
+        return nil;
31
+    }
32
+
33
+    if ([_webView respondsToSelector:@selector(inputAssistantItem)]) {
34
+        UITextInputAssistantItem *inputAssistantItem = [_webView inputAssistantItem];
35
+        inputAssistantItem.leadingBarButtonGroups = @[];
36
+        inputAssistantItem.trailingBarButtonGroups = @[];
37
+    }
38
+    return nil;
28 39
 }
29 40
 @end
30 41