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

Loading…
Cancel
Save