iou90 / react-native-autoheight-webview

An auto height webview for React Native
ISC License
492 stars 162 forks source link

Destroy is not a function #237

Closed Alyka3000 closed 2 years ago

Alyka3000 commented 2 years ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-native-autoheight-webview@1.6.3 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-autoheight-webview/autoHeightWebView/index.js b/node_modules/react-native-autoheight-webview/autoHeightWebView/index.js
index 23e5dea..48a59a2 100644
--- a/node_modules/react-native-autoheight-webview/autoHeightWebView/index.js
+++ b/node_modules/react-native-autoheight-webview/autoHeightWebView/index.js
@@ -65,13 +65,12 @@ const AutoHeightWebView = React.memo(
     const {currentSource, script} = reduceData(props);

     const {width, height} = size;
-    useEffect(
-      () =>
+    useEffect(() => {
         onSizeUpdated &&
         onSizeUpdated({
           height,
           width,
-        }),
+        })},
       [width, height, onSizeUpdated],
     );

This issue body was partially generated by patch-package.

iou90 commented 2 years ago

It should be fixed on v1.6.4. (https://github.com/iou90/react-native-autoheight-webview/releases/tag/v1.6.4)