iou90 4 years ago
parent
commit
f986d60926
2 changed files with 66 additions and 4 deletions
  1. 65
    3
      index.d.ts
  2. 1
    1
      index.js

+ 65
- 3
index.d.ts View File

@@ -3,9 +3,11 @@
3 3
 // Definitions by: Naveen Ithappu <https://github.com/naveen-ithappu>
4 4
 // TypeScript Version: ^3.9.7
5 5
 
6
-import WebView, { WebViewProps } from 'react-native-webview';
6
+import {Component} from 'react';
7 7
 
8
-import { StyleProp, ViewStyle } from 'react-native';
8
+import {WebViewProps} from 'react-native-webview';
9
+
10
+import {StyleProp, ViewStyle} from 'react-native';
9 11
 
10 12
 export interface StylesFile {
11 13
   href: string;
@@ -29,4 +31,64 @@ export interface AutoHeightWebViewProps extends WebViewProps {
29 31
   scrollEnabledWithZoomedin: boolean;
30 32
 }
31 33
 
32
-export default class AutoHeightWebView extends WebView<Partial<AutoHeightWebViewProps>> {}
34
+export default class AutoHeightWebView extends Component<
35
+  Partial<AutoHeightWebViewProps>
36
+> {
37
+  /**
38
+   * Go back one page in the webview's history.
39
+   */
40
+  goBack: () => void;
41
+
42
+  /**
43
+   * Go forward one page in the webview's history.
44
+   */
45
+  goForward: () => void;
46
+
47
+  /**
48
+   * Reloads the current page.
49
+   */
50
+  reload: () => void;
51
+
52
+  /**
53
+   * Stop loading the current page.
54
+   */
55
+  stopLoading(): void;
56
+
57
+  /**
58
+   * Extra Native Component Config.
59
+   */
60
+  extraNativeComponentConfig: () => any;
61
+
62
+  /**
63
+   * Executes the JavaScript string.
64
+   */
65
+  injectJavaScript: (script: string) => void;
66
+
67
+  /**
68
+   * Focuses on WebView redered page.
69
+   */
70
+  requestFocus: () => void;
71
+
72
+  /**
73
+   * Posts a message to WebView.
74
+   */
75
+  postMessage: (message: string) => void;
76
+
77
+  /**
78
+   * (Android only)
79
+   * Removes the autocomplete popup from the currently focused form field, if present.
80
+   */
81
+  clearFormData: () => void;
82
+
83
+  /**
84
+   * (Android only)
85
+   * Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used.
86
+   */
87
+  clearCache: (clear: boolean) => void;
88
+
89
+  /**
90
+   * (Android only)
91
+   * Tells this WebView to clear its internal back/forward list.
92
+   */
93
+  clearHistory: () => void;
94
+}

+ 1
- 1
index.js View File

@@ -1,3 +1,3 @@
1 1
 import AutoHeightWebView from './autoHeightWebView/index';
2 2
 
3
-export default AutoHeightWebView;
3
+export default AutoHeightWebView;