Browse Source

fix(types): Fixing typing. (#167)

so happy to see there is typing in the newest release.
I added back WebViewIOSLoadRequestEvent which also exist in react-native typing and fix startInLoadingState which should be boolean.
KaFai 6 years ago
parent
commit
65bd97219a
1 changed files with 10 additions and 4 deletions
  1. 10
    4
      typings/index.d.ts

+ 10
- 4
typings/index.d.ts View File

@@ -9,6 +9,12 @@ export interface WebViewNativeEvent {
9 9
   readonly canGoForward: boolean;
10 10
 }
11 11
 
12
+export interface WebViewIOSLoadRequestEvent extends WebViewNativeEvent {
13
+  target: number;
14
+  lockIdentifier: number;
15
+  navigationType: "click" | "formsubmit" | "backforward" | "reload" | "formresubmit" | "other";
16
+}
17
+
12 18
 export interface WebViewProgressEvent extends WebViewNativeEvent {
13 19
   readonly progress: number;
14 20
 }
@@ -190,7 +196,7 @@ export interface IOSWebViewProps {
190 196
    * to stop loading.
191 197
    * @platform ios
192 198
    */
193
-  onShouldStartLoadWithRequest?: (event: WebViewNativeEvent) => any;
199
+  onShouldStartLoadWithRequest?: (event: WebViewIOSLoadRequestEvent) => any;
194 200
 
195 201
   /**
196 202
    * Boolean that determines whether HTML5 videos play inline or use the
@@ -382,7 +388,7 @@ export interface WebViewSharedProps extends ViewProps, IOSWebViewProps, AndroidW
382 388
    * Boolean value that forces the `WebView` to show the loading view
383 389
    * on the first load.
384 390
    */
385
-  startInLoadingState?: string;
391
+  startInLoadingState?: boolean;
386 392
 
387 393
   /**
388 394
    * Set this to provide JavaScript that will be injected into the web page
@@ -429,6 +435,6 @@ export class WebView extends Component<WebViewSharedProps> {
429 435
   public goBack: () => void;
430 436
   public reload: () => void;
431 437
   public stopLoading: () => void;
432
-  public postMessage: (msg: string) => void
433
-  public injectJavaScript: (js: string) => void
438
+  public postMessage: (msg: string) => void;
439
+  public injectJavaScript: (js: string) => void;
434 440
 }