diff --git a/src/WebView.android.tsx b/src/WebView.android.tsx index 6e25b44..8419ff3 100644 --- a/src/WebView.android.tsx +++ b/src/WebView.android.tsx @@ -211,13 +211,16 @@ class WebView extends React.Component { onLoadingError = (event: WebViewErrorEvent) => { event.persist(); // persist this event because we need to store it const { onError, onLoadEnd } = this.props; + if (onError) { onError(event); + } else { + console.warn('Encountered an error loading page', event.nativeEvent); } + if (onLoadEnd) { onLoadEnd(event); } - console.warn('Encountered an error loading page', event.nativeEvent); this.setState({ lastErrorEvent: event.nativeEvent, diff --git a/src/WebView.ios.tsx b/src/WebView.ios.tsx index eeb264c..fb8be64 100644 --- a/src/WebView.ios.tsx +++ b/src/WebView.ios.tsx @@ -195,13 +195,16 @@ class WebView extends React.Component { onLoadingError = (event: WebViewErrorEvent) => { event.persist(); // persist this event because we need to store it const { onError, onLoadEnd } = this.props; + if (onLoadEnd) { onLoadEnd(event); } + if (onError) { onError(event); + } else { + console.warn('Encountered an error loading page', event.nativeEvent); } - console.warn('Encountered an error loading page', event.nativeEvent); this.setState({ lastErrorEvent: event.nativeEvent, diff --git a/src/WebView.macos.tsx b/src/WebView.macos.tsx index 436b518..a2ad5b1 100644 --- a/src/WebView.macos.tsx +++ b/src/WebView.macos.tsx @@ -183,13 +183,16 @@ class WebView extends React.Component { onLoadingError = (event: WebViewErrorEvent) => { event.persist(); // persist this event because we need to store it const { onError, onLoadEnd } = this.props; + if (onLoadEnd) { onLoadEnd(event); } + if (onError) { onError(event); + } else { + console.warn('Encountered an error loading page', event.nativeEvent); } - console.warn('Encountered an error loading page', event.nativeEvent); this.setState({ lastErrorEvent: event.nativeEvent,