Display custom error view on webview error
This commit is contained in:
parent
5e35086a9c
commit
cb98e1c546
2 changed files with 13 additions and 2 deletions
|
@ -32,7 +32,10 @@ class NetworkErrorComponent extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View style={styles.outer}>
|
<View style={{
|
||||||
|
...styles.outer,
|
||||||
|
backgroundColor: this.colors.background
|
||||||
|
}}>
|
||||||
<View style={styles.inner}>
|
<View style={styles.inner}>
|
||||||
<View style={styles.iconContainer}>
|
<View style={styles.iconContainer}>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
|
@ -62,7 +65,7 @@ class NetworkErrorComponent extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
outer: {
|
outer: {
|
||||||
flex: 1,
|
height: '100%',
|
||||||
},
|
},
|
||||||
inner: {
|
inner: {
|
||||||
marginTop: 'auto',
|
marginTop: 'auto',
|
||||||
|
|
|
@ -5,6 +5,8 @@ import WebView from "react-native-webview";
|
||||||
import {withTheme} from 'react-native-paper';
|
import {withTheme} from 'react-native-paper';
|
||||||
import HeaderButton from "../Custom/HeaderButton";
|
import HeaderButton from "../Custom/HeaderButton";
|
||||||
import BasicLoadingScreen from "../Custom/BasicLoadingScreen";
|
import BasicLoadingScreen from "../Custom/BasicLoadingScreen";
|
||||||
|
import NetworkErrorComponent from "../Custom/NetworkErrorComponent";
|
||||||
|
import i18n from "i18n-js";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
|
@ -104,6 +106,12 @@ class WebViewScreen extends React.PureComponent<Props> {
|
||||||
injectedJavaScript={this.props.data[0]['customJS']}
|
injectedJavaScript={this.props.data[0]['customJS']}
|
||||||
javaScriptEnabled={true}
|
javaScriptEnabled={true}
|
||||||
renderLoading={this.getRenderLoading}
|
renderLoading={this.getRenderLoading}
|
||||||
|
renderError={() => <NetworkErrorComponent
|
||||||
|
{...this.props}
|
||||||
|
onRefresh={this.onRefreshClicked}
|
||||||
|
message={i18n.t("loginScreen.errors.connection")}
|
||||||
|
icon={'access-point-network-off'}
|
||||||
|
/>}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue