Преглед на файлове

fix(web_ios): Not rendering when the browser back button is pressed.

master
hristoterezov преди 7 години
родител
ревизия
6aae56527f
променени са 1 файла, в които са добавени 19 реда и са изтрити 0 реда
  1. 19
    0
      react/index.web.js

+ 19
- 0
react/index.web.js Целия файл

6
 import { getJitsiMeetTransport } from '../modules/transport';
6
 import { getJitsiMeetTransport } from '../modules/transport';
7
 
7
 
8
 import { App } from './features/app';
8
 import { App } from './features/app';
9
+import { Platform } from './features/base/react';
9
 
10
 
10
 const logger = require('jitsi-meet-logger').getLogger(__filename);
11
 const logger = require('jitsi-meet-logger').getLogger(__filename);
12
+const OS = Platform.OS;
11
 
13
 
12
 /**
14
 /**
13
  * Renders the app when the DOM tree has been loaded.
15
  * Renders the app when the DOM tree has been loaded.
22
     ReactDOM.render(<App />, document.getElementById('react'));
24
     ReactDOM.render(<App />, document.getElementById('react'));
23
 });
25
 });
24
 
26
 
27
+// Workaround for the issue when returning to a page with the back button and
28
+// the page is loaded from the 'back-forward' cache on iOS which causes nothing
29
+// to be rendered.
30
+if (OS === 'ios') {
31
+    window.addEventListener('pageshow', event => {
32
+        // Detect pages loaded from the 'back-forward' cache
33
+        // (https://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/)
34
+        if (event.persisted) {
35
+            // Maybe there is a more graceful approach but in the moment of
36
+            // writing nothing else resolves the issue. I tried to execute our
37
+            // DOMContentLoaded handler but it seems that the 'onpageshow' event
38
+            // is triggered only when 'window.location.reload()' code exists.
39
+            window.location.reload();
40
+        }
41
+    });
42
+}
43
+
25
 /**
44
 /**
26
  * Stops collecting the logs and disposing the API when the user closes the
45
  * Stops collecting the logs and disposing the API when the user closes the
27
  * page.
46
  * page.

Loading…
Отказ
Запис