Browse Source

Fixed webview crash on refresh after screen rotation

keplyx 4 years ago
parent
commit
c048032781
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      components/WebViewScreen.js

+ 7
- 3
components/WebViewScreen.js View File

@@ -62,19 +62,22 @@ export default class WebViewScreen extends React.Component<Props> {
62 62
 
63 63
     refreshWebview() {
64 64
         for (let view of this.webviewArray) {
65
-            view.reload();
65
+            if (view !== null)
66
+                view.reload();
66 67
         }
67 68
     }
68 69
 
69 70
     goBackWebview() {
70 71
         for (let view of this.webviewArray) {
71
-            view.goBack();
72
+            if (view !== null)
73
+                view.goBack();
72 74
         }
73 75
     }
74 76
 
75 77
     goForwardWebview() {
76 78
         for (let view of this.webviewArray) {
77
-            view.goForward();
79
+            if (view !== null)
80
+                view.goForward();
78 81
         }
79 82
     }
80 83
 
@@ -132,6 +135,7 @@ export default class WebViewScreen extends React.Component<Props> {
132 135
 
133 136
     render() {
134 137
         const nav = this.props.navigation;
138
+        this.webviewArray = [];
135 139
         return (
136 140
             <BaseContainer
137 141
                 navigation={nav}

Loading…
Cancel
Save