|
@@ -20,15 +20,17 @@ const updateSizeWithMessage = (element, scalesPageToFit) =>
|
20
|
20
|
var maxHeightTheSameTimes = 5;
|
21
|
21
|
var forceRefreshDelay = 1000;
|
22
|
22
|
var forceRefreshTimeout;
|
|
23
|
+ var checkPostMessageTimeout;
|
23
|
24
|
|
24
|
25
|
function updateSize(event) {
|
25
|
26
|
if (
|
26
|
27
|
!window.hasOwnProperty('ReactNativeWebView') ||
|
27
|
28
|
!window.ReactNativeWebView.hasOwnProperty('postMessage')
|
28
|
29
|
) {
|
29
|
|
- setTimeout(updateSize, 200);
|
|
30
|
+ checkPostMessageTimeout = setTimeout(updateSize, 200);
|
30
|
31
|
return;
|
31
|
32
|
}
|
|
33
|
+ clearTimeout(checkPostMessageTimeout);
|
32
|
34
|
height = ${element}.offsetHeight || document.documentElement.offsetHeight;
|
33
|
35
|
width = ${element}.offsetWidth || document.documentElement.offsetWidth;
|
34
|
36
|
var needScale = width > screen.width;
|
|
@@ -121,7 +123,7 @@ const getInjectedSource = ({ html, script }) => `
|
121
|
123
|
${html}
|
122
|
124
|
<script>
|
123
|
125
|
// prevents code colissions with global scope
|
124
|
|
-(() => {
|
|
126
|
+(function() {
|
125
|
127
|
${script}
|
126
|
128
|
})();
|
127
|
129
|
</script>
|