iou90 4 years ago
parent
commit
6a2defdf53
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      autoHeightWebView/utils.js

+ 3
- 3
autoHeightWebView/utils.js View File

@@ -21,8 +21,8 @@ const updateSizeWithMessage = element =>
21 21
       return;
22 22
     }
23 23
     clearInterval(updateSizeInterval)
24
-    height = ${element}.offsetHeight || window.innerHeight;
25
-    width = ${element}.offsetWidth || window.innerWidth;
24
+    height = ${element}.offsetHeight || document.documentElement.offsetHeight;
25
+    width = ${element}.offsetWidth || document.documentElement.offsetWidth;
26 26
     window.ReactNativeWebView.postMessage(JSON.stringify({ width: width, height: height }));
27 27
   }
28 28
   `;
@@ -52,7 +52,7 @@ const getBaseScript = ({ style, zoomable }) =>
52 52
   window.addEventListener('load', updateSize);
53 53
   window.addEventListener('resize', updateSize);
54 54
   ${domMutationObserveScript}
55
-  ${Platform.OS === 'ios' ? makeScalePageToFit(zoomable) : ''}
55
+  ${makeScalePageToFit(zoomable)}
56 56
   updateSize();
57 57
   `;
58 58