Removed useless state and cleaned componentWillMount

This commit is contained in:
Thibault Malbranche 2018-09-19 01:33:57 +02:00
parent 71cc1042f8
commit aca9c2e31f
2 changed files with 2 additions and 16 deletions

View File

@ -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;

View File

@ -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