소스 검색

fix clearInterval not works on react issue for index.android.js; fix package path issue for android

iou90 6 년 전
부모
커밋
365b36eed5

android/src/main/java/com/dscj/autoheightwebview/AutoHeightWebViewManager.java → android/src/main/java/com/iou90/autoheightwebview/AutoHeightWebViewManager.java 파일 보기


android/src/main/java/com/dscj/autoheightwebview/AutoHeightWebViewPackage.java → android/src/main/java/com/iou90/autoheightwebview/AutoHeightWebViewPackage.java 파일 보기


android/src/main/java/com/dscj/autoheightwebview/JavascriptBridge.java → android/src/main/java/com/iou90/autoheightwebview/JavascriptBridge.java 파일 보기


+ 8
- 6
autoHeightWebView/index.android.js 파일 보기

@@ -201,16 +201,18 @@ export default class AutoHeightWebView extends PureComponent {
201 201
       return;
202 202
     }
203 203
     this.finishInterval = false;
204
-    this.interval = setInterval(() => {
205
-      if (!this.finishInterval) {
206
-        isBelowKitKat ? this.sendToWebView('getBodyHeight') : this.postMessage('getBodyHeight');
207
-      }
208
-    }, 205);
204
+    this.setState({
205
+      interval: setInterval(() => {
206
+        if (!this.finishInterval) {
207
+          isBelowKitKat ? this.sendToWebView('getBodyHeight') : this.postMessage('getBodyHeight');
208
+        }
209
+      }, 205)
210
+    });
209 211
   }
210 212
 
211 213
   stopInterval() {
212 214
     this.finishInterval = true;
213
-    clearInterval(this.interval);
215
+    clearInterval(this.state.interval);
214 216
   }
215 217
 
216 218
   onMessage = e => {