mirror of
https://github.com/status-im/react-native-webview.git
synced 2025-02-22 08:48:39 +00:00
Removed useless state and cleaned componentWillMount
This commit is contained in:
parent
71cc1042f8
commit
aca9c2e31f
@ -54,7 +54,6 @@ const defaultRenderLoading = () => (
|
||||
type State = {|
|
||||
viewState: WebViewState,
|
||||
lastErrorEvent: ?WebViewError,
|
||||
startInLoadingState: boolean,
|
||||
|};
|
||||
|
||||
/**
|
||||
@ -71,19 +70,12 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
||||
};
|
||||
|
||||
state = {
|
||||
viewState: WebViewState.IDLE,
|
||||
viewState: this.props.startInLoadingState ? WebViewState.LOADING : WebViewState.IDLE,
|
||||
lastErrorEvent: null,
|
||||
startInLoadingState: true,
|
||||
};
|
||||
|
||||
webViewRef = React.createRef();
|
||||
|
||||
UNSAFE_componentWillMount() {
|
||||
if (this.props.startInLoadingState) {
|
||||
this.setState({ viewState: WebViewState.LOADING });
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let otherView = null;
|
||||
|
||||
|
@ -76,7 +76,6 @@ const JSNavigationScheme = 'react-js-navigation';
|
||||
type State = {|
|
||||
viewState: WebViewState,
|
||||
lastErrorEvent: ?WebViewError,
|
||||
startInLoadingState: boolean,
|
||||
|};
|
||||
|
||||
const DataDetectorTypes = [
|
||||
@ -137,18 +136,13 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
||||
};
|
||||
|
||||
state = {
|
||||
viewState: WebViewState.IDLE,
|
||||
viewState: this.props.startInLoadingState ? WebViewState.LOADING : WebViewState.IDLE,
|
||||
lastErrorEvent: null,
|
||||
startInLoadingState: true,
|
||||
};
|
||||
|
||||
webViewRef = React.createRef();
|
||||
|
||||
UNSAFE_componentWillMount() {
|
||||
if (this.props.startInLoadingState) {
|
||||
this.setState({ viewState: WebViewState.LOADING });
|
||||
}
|
||||
|
||||
if (
|
||||
this.props.useWebKit === true &&
|
||||
this.props.scalesPageToFit !== undefined
|
||||
|
Loading…
x
Reference in New Issue
Block a user