diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java b/iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java index 3e40899cf..779c1c93c 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java @@ -22,7 +22,6 @@ import android.view.OrientationEventListener; import android.view.View; import android.view.ViewGroup; -import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; import android.view.animation.Animation; @@ -168,14 +167,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c webView.setId(R.id.webView); webView.createWithHtml(this, htmlString); - webView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override - public boolean onPreDraw() { - runResizeScript(); - return true; - } - }); - if (orientationListener == null) { orientationListener = new OrientationEventListener(getContext(), SensorManager.SENSOR_DELAY_NORMAL) { // Resize the webView on device rotation diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableWebViewClient.java b/iterableapi/src/main/java/com/iterable/iterableapi/IterableWebViewClient.java index c8a63c27c..203426fd5 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableWebViewClient.java +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableWebViewClient.java @@ -19,6 +19,6 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { @Override public void onPageFinished(WebView view, String url) { inAppHTMLNotification.setLoaded(true); - inAppHTMLNotification.runResizeScript(); + view.postDelayed(inAppHTMLNotification::runResizeScript, 100); } } \ No newline at end of file