Просмотр исходного кода

fix Converting circular structure to JSON issue on some android devices

iou90 4 лет назад
Родитель
Сommit
8505010fce
2 измененных файлов: 2 добавлений и 2 удалений
  1. 1
    1
      autoHeightWebView/index.js
  2. 1
    1
      autoHeightWebView/utils.js

+ 1
- 1
autoHeightWebView/index.js Просмотреть файл

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

+ 1
- 1
autoHeightWebView/utils.js Просмотреть файл

@@ -23,7 +23,7 @@ const updateSizeWithMessage = element =>
23 23
     clearInterval(updateSizeInterval)
24 24
     height = ${element}.offsetHeight || window.innerHeight;
25 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