Skip to content

Commit e6a3e31

Browse files
Fix iOS BrowserComponent onLoad which is invoked too early (#4243)
1 parent 3327c42 commit e6a3e31

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Ports/iOSPort/nativeSources/UIWebViewEventDelegate.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigat
100100
// SUCKS!! WKWebView is out of process so we can't access Javascript context directly anymore.
101101
// So we have to do browser navigation callbacks the old fashioned way.
102102
#endif
103-
com_codename1_impl_ios_IOSImplementation_fireWebViewDidFinishLoad___com_codename1_ui_BrowserComponent_java_lang_String(CN1_THREAD_GET_STATE_PASS_ARG c, xmlvm_create_java_string(CN1_THREAD_GET_STATE_PASS_ARG webView.URL.absoluteString.UTF8String));
103+
[webView evaluateJavaScript:@"document.body.offsetHeight" completionHandler:^(id result, NSError *error) {
104+
com_codename1_impl_ios_IOSImplementation_fireWebViewDidFinishLoad___com_codename1_ui_BrowserComponent_java_lang_String(CN1_THREAD_GET_STATE_PASS_ARG c, xmlvm_create_java_string(CN1_THREAD_GET_STATE_PASS_ARG webView.URL.absoluteString.UTF8String));
105+
}];
104106
}
105107

106108

0 commit comments

Comments
 (0)