浏览代码

fix Converting circular structure to JSON issue on some android devices

iou90 5 年前
父节点
当前提交
8505010fce
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1
    1
      autoHeightWebView/index.js
  2. 1
    1
      autoHeightWebView/utils.js

+ 1
- 1
autoHeightWebView/index.js 查看文件

27
     width: getWidth(style)
27
     width: getWidth(style)
28
   }));
28
   }));
29
   const hanldeMessage = event => {
29
   const hanldeMessage = event => {
30
+    onMessage && onMessage(event);
30
     if (!event.nativeEvent) {
31
     if (!event.nativeEvent) {
31
       return;
32
       return;
32
     }
33
     }
45
         height,
46
         height,
46
         width
47
         width
47
       });
48
       });
48
-    onMessage && onMessage(event);
49
   };
49
   };
50
 
50
 
51
   const { currentSource, script } = useMemo(
51
   const { currentSource, script } = useMemo(

+ 1
- 1
autoHeightWebView/utils.js 查看文件

23
     clearInterval(updateSizeInterval)
23
     clearInterval(updateSizeInterval)
24
     height = ${element}.offsetHeight || window.innerHeight;
24
     height = ${element}.offsetHeight || window.innerHeight;
25
     width = ${element}.offsetWidth || window.innerWidth;
25
     width = ${element}.offsetWidth || window.innerWidth;
26
-    window.ReactNativeWebView.postMessage(JSON.stringify({ width: width, height: height, event: event }));
26
+    window.ReactNativeWebView.postMessage(JSON.stringify({ width: width, height: height }));
27
   }
27
   }
28
   `;
28
   `;
29
 
29