瀏覽代碼

fix(types): Add missing type definitions of the methods (#442)

Also made the exported component a class (to add methods) and made him extend Component instead of ComponentType.
Sergei Butko 5 年之前
父節點
當前提交
54268ff469
共有 1 個檔案被更改,包括 33 行新增3 行删除
  1. 33
    3
      index.d.ts

+ 33
- 3
index.d.ts 查看文件

@@ -1,8 +1,38 @@
1
-import { ComponentType } from 'react';
1
+import { Component } from 'react';
2 2
 // eslint-disable-next-line
3 3
 import { IOSWebViewProps, AndroidWebViewProps } from './lib/WebViewTypes';
4 4
 
5
-declare const WebView: ComponentType<IOSWebViewProps & AndroidWebViewProps>;
5
+class WebView extends Component<IOSWebViewProps & AndroidWebViewProps> {
6
+    /**
7
+     * Go back one page in the webview's history.
8
+     */
9
+    goBack: () => void;
6 10
 
7
-export { WebView };
11
+    /**
12
+     * Go forward one page in the webview's history.
13
+     */
14
+    goForward: () => void;
15
+
16
+    /**
17
+     * Reloads the current page.
18
+     */
19
+    reload: () => void;
20
+
21
+    /**
22
+     * Stop loading the current page.
23
+     */
24
+    stopLoading(): void;
25
+
26
+    /**
27
+     * Extra Native Component Config.
28
+     */
29
+    extraNativeComponentConfig: () => any;
30
+
31
+    /**
32
+     * Executes the JavaScript string.
33
+     */
34
+    injectJavaScript: (script: string) => void;
35
+};
36
+
37
+export {WebView};
8 38
 export default WebView;