fixed types
This commit is contained in:
parent
e2fe1db4d1
commit
e4360cf298
|
@ -0,0 +1 @@
|
|||
lib/
|
|
@ -1,7 +1,8 @@
|
|||
import WebViewIOS from './lib/WebView.ios';
|
||||
import WebViewAndroid from './lib/WebView.android';
|
||||
import { ComponentType } from 'react';
|
||||
// eslint-disable-next-line
|
||||
import { IOSWebViewProps, AndroidWebViewProps } from './lib/WebViewTypes';
|
||||
|
||||
declare const WebView: WebViewIOS | WebViewAndroid;
|
||||
declare const WebView: ComponentType<IOSWebViewProps & AndroidWebViewProps>;
|
||||
|
||||
export { WebView };
|
||||
export default WebView;
|
||||
|
|
|
@ -273,7 +273,8 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
|||
|
||||
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
||||
this.onShouldStartLoadWithRequestCallback,
|
||||
originWhitelist,
|
||||
// casting cause it's in the default props
|
||||
originWhitelist as ReadonlyArray<string>,
|
||||
onShouldStartLoadWithRequestProp,
|
||||
);
|
||||
|
||||
|
@ -305,4 +306,4 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = WebView;
|
||||
export default WebView;
|
||||
|
|
|
@ -382,7 +382,8 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
|||
|
||||
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
||||
this.onShouldStartLoadWithRequestCallback,
|
||||
originWhitelist,
|
||||
// casting cause it's in the default props
|
||||
originWhitelist as ReadonlyArray<string>,
|
||||
onShouldStartLoadWithRequestProp,
|
||||
);
|
||||
|
||||
|
@ -426,4 +427,4 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = WebView;
|
||||
export default WebView;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
/* eslint-disable react/no-multi-comp */
|
||||
|
||||
import { ReactNode, ReactElement, Component } from 'react';
|
||||
import { ReactElement, Component } from 'react';
|
||||
import {
|
||||
NativeSyntheticEvent,
|
||||
ViewStyle,
|
||||
|
@ -512,7 +512,7 @@ export interface WebViewSharedProps extends ViewProps {
|
|||
/**
|
||||
* Function that returns a view to show if there's an error.
|
||||
*/
|
||||
renderError: (
|
||||
renderError?: (
|
||||
errorDomain: string | undefined,
|
||||
errorCode: number,
|
||||
errorDesc: string,
|
||||
|
@ -521,27 +521,27 @@ export interface WebViewSharedProps extends ViewProps {
|
|||
/**
|
||||
* Function that returns a loading indicator.
|
||||
*/
|
||||
renderLoading: () => ReactElement;
|
||||
renderLoading?: () => ReactElement;
|
||||
|
||||
/**
|
||||
* Function that is invoked when the `WebView` has finished loading.
|
||||
*/
|
||||
onLoad: (event: WebViewNavigationEvent) => void;
|
||||
onLoad?: (event: WebViewNavigationEvent) => void;
|
||||
|
||||
/**
|
||||
* Function that is invoked when the `WebView` load succeeds or fails.
|
||||
*/
|
||||
onLoadEnd: (event: WebViewNavigationEvent | WebViewErrorEvent) => void;
|
||||
onLoadEnd?: (event: WebViewNavigationEvent | WebViewErrorEvent) => void;
|
||||
|
||||
/**
|
||||
* Function that is invoked when the `WebView` starts loading.
|
||||
*/
|
||||
onLoadStart: (event: WebViewNavigationEvent) => void;
|
||||
onLoadStart?: (event: WebViewNavigationEvent) => void;
|
||||
|
||||
/**
|
||||
* Function that is invoked when the `WebView` load fails.
|
||||
*/
|
||||
onError: (event: WebViewErrorEvent) => void;
|
||||
onError?: (event: WebViewErrorEvent) => void;
|
||||
|
||||
/**
|
||||
* Function that is invoked when the `WebView` loading starts or ends.
|
||||
|
@ -608,7 +608,7 @@ export interface WebViewSharedProps extends ViewProps {
|
|||
* this whitelist, we will open the URL in Safari.
|
||||
* The default whitelisted origins are "http://*" and "https://*".
|
||||
*/
|
||||
originWhitelist: ReadonlyArray<string>;
|
||||
originWhitelist?: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
* Function that allows custom handling of any web view requests. Return
|
||||
|
@ -629,5 +629,4 @@ export interface WebViewSharedProps extends ViewProps {
|
|||
cacheEnabled?: boolean;
|
||||
|
||||
style?: StyleProp<ViewStyle>;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue