oracle / cordova-plugin-wkwebview-file-xhr

Cordova Plugin for WebView File XHR
Universal Permissive License v1.0
139 stars 118 forks source link

Screen change orientation bug #17

Closed vortice3D closed 6 years ago

vortice3D commented 6 years ago

Hi there:

When a change the orientation of my device (iPad Mini running iOS 11.2.6) wkwebview doesn't cover the entire height of screen.

That is, when the WKWebView is used, rotating the screen doesn't trigger a resize of the HTML, but it works correctly with UIWebView.

It's possible to "hack" this behavior firing a temporized window.dispatchEvent(new Event('resize'), but I find it clumsy as it involves a Race Condition.

Maybe it has to be with this code in Xcode?:

CGRect screenBounds = [[UIScreen mainScreen] bounds]; self.window = [[UIWindow alloc] initWithFrame:screenBounds]; self.window.autoresizesSubviews = YES;

Any help on this?

vortice3D commented 6 years ago

About this issue, searching more in deep over the web, I see different related posts:

So well this seems to be a problem related with the iOS autoresizingMask. Anyway I see it is set OK in my CDVViewController.m file:

(void)createGapView { CGRect webViewBounds = self.view.bounds; webViewBounds.origin = self.view.bounds.origin; UIView* view = [self newCordovaViewWithFrame:webViewBounds]; view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); [self.view addSubview:view]; [self.view sendSubviewToBack:view]; }

So in my case I think that UIViewAutoresizingFlexibleHeight flag is not working properly.

hirbod commented 6 years ago

You are in the wrong repo my friend. This one here is only for fixing XHR issues, you should send your message to the webview maintainers.

https://github.com/apache/cordova-plugin-wkwebview-engine https://github.com/ionic-team/cordova-plugin-ionic-webview

vortice3D commented 6 years ago

Ok man, I'll do so.

I came to this plugin looking for an xhr solution so I didn't notice at all there was a cordoba-plugin-wkwebview dependency.

Best regards.

hirbod commented 6 years ago

Fyi, you have to post your issues here: https://issues.apache.org/jira/browse/CB-12074?jql=project%20%3D%20CB%20AND%20status%20%3D%20Open%20AND%20labels%20%3D%20wkwebview-known-issues