[TIMOB-27449] iOS WebView html property not set before the "load" event is fired
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Richard Lustemberg |
Assignee | Shak Hossain |
Created | 2019-09-05T14:08:32.000+0000 |
Updated | 2019-10-07T22:02:09.000+0000 |
Description
Since the adoption of WKWebView as a replacement for UIWebView, the "load" event no longer is triggered after the html property is set.
This happens as a consequence of
[(TiUIWebViewProxy *)[self proxy] refreshHTMLContent]
executing asynchronously , right before the event is fired.
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
{
[self _cleanupLoadingIndicator];
[(TiUIWebViewProxy *)[self proxy] refreshHTMLContent]; //this might not be ready before the event is fired
if ([[self proxy] _hasListeners:@"load"]) {
[[self proxy] fireEvent:@"load" withObject:@{ @"url" : webView.URL.absoluteString, @"title" : webView.title }];
}
}
My suggestion is to provide a completion handler argument to TiUIWebViewProxy refreshHTMLContent
and fire the event from there. I can provide a PR if needed.
Not having the html property set before the load event breaks the behaviour from TiUIWebView.
[~rlustemberg] Thanks for raising the issue. PR with test case is always appreciated :). Thanks!
I've missed your reply. I'll do that shortly