mirror of
https://github.com/status-im/react-native-webview.git
synced 2025-02-22 16:58:34 +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 = {|
|
type State = {|
|
||||||
viewState: WebViewState,
|
viewState: WebViewState,
|
||||||
lastErrorEvent: ?WebViewError,
|
lastErrorEvent: ?WebViewError,
|
||||||
startInLoadingState: boolean,
|
|
||||||
|};
|
|};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,19 +70,12 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
viewState: WebViewState.IDLE,
|
viewState: this.props.startInLoadingState ? WebViewState.LOADING : WebViewState.IDLE,
|
||||||
lastErrorEvent: null,
|
lastErrorEvent: null,
|
||||||
startInLoadingState: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
webViewRef = React.createRef();
|
webViewRef = React.createRef();
|
||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
|
||||||
if (this.props.startInLoadingState) {
|
|
||||||
this.setState({ viewState: WebViewState.LOADING });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let otherView = null;
|
let otherView = null;
|
||||||
|
|
||||||
|
@ -76,7 +76,6 @@ const JSNavigationScheme = 'react-js-navigation';
|
|||||||
type State = {|
|
type State = {|
|
||||||
viewState: WebViewState,
|
viewState: WebViewState,
|
||||||
lastErrorEvent: ?WebViewError,
|
lastErrorEvent: ?WebViewError,
|
||||||
startInLoadingState: boolean,
|
|
||||||
|};
|
|};
|
||||||
|
|
||||||
const DataDetectorTypes = [
|
const DataDetectorTypes = [
|
||||||
@ -137,18 +136,13 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
viewState: WebViewState.IDLE,
|
viewState: this.props.startInLoadingState ? WebViewState.LOADING : WebViewState.IDLE,
|
||||||
lastErrorEvent: null,
|
lastErrorEvent: null,
|
||||||
startInLoadingState: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
webViewRef = React.createRef();
|
webViewRef = React.createRef();
|
||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
if (this.props.startInLoadingState) {
|
|
||||||
this.setState({ viewState: WebViewState.LOADING });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.props.useWebKit === true &&
|
this.props.useWebKit === true &&
|
||||||
this.props.scalesPageToFit !== undefined
|
this.props.scalesPageToFit !== undefined
|
||||||
|
Loading…
x
Reference in New Issue
Block a user