|
@@ -14,7 +14,6 @@ const domMutationObserveScript = `
|
14
|
14
|
|
15
|
15
|
const updateSizeWithMessage = (element, scalesPageToFit) =>
|
16
|
16
|
`
|
17
|
|
- var scale = ${scalesPageToFit ? 'screen.width / window.innerWidth' : '1'};
|
18
|
17
|
var lastHeight = 0;
|
19
|
18
|
var heightTheSameTimes = 0;
|
20
|
19
|
var maxHeightTheSameTimes = 5;
|
|
@@ -33,8 +32,8 @@ const updateSizeWithMessage = (element, scalesPageToFit) =>
|
33
|
32
|
clearTimeout(checkPostMessageTimeout);
|
34
|
33
|
height = ${element}.offsetHeight || document.documentElement.offsetHeight;
|
35
|
34
|
width = ${element}.offsetWidth || document.documentElement.offsetWidth;
|
36
|
|
- var needScale = width > screen.width;
|
37
|
|
- window.ReactNativeWebView.postMessage(JSON.stringify({ width: needScale ? width * scale : width, height: needScale ? height * scale : height }));
|
|
35
|
+ var scale = ${scalesPageToFit ? 'screen.width / window.innerWidth' : '1'};
|
|
36
|
+ window.ReactNativeWebView.postMessage(JSON.stringify({ width: Math.min(width, screen.width), height: height * scale }));
|
38
|
37
|
|
39
|
38
|
// Make additional height checks (required to fix issues wit twitter embeds)
|
40
|
39
|
clearTimeout(forceRefreshTimeout);
|