浏览代码

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

Dima Paloskin 5 年前
父节点
当前提交
09372c9d95
共有 1 个文件被更改,包括 13 次插入2 次删除
  1. 13
    2
      ios/RNCWebView.m

+ 13
- 2
ios/RNCWebView.m 查看文件

@@ -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