Closed kamhawy4 closed 4 years ago
See https://github.com/apache/cordova-ios/issues/417.
This was a bug in iOS between iOS 12.0 and iOS 13.4 when using WKWebView. https://www.npmjs.com/package/cordova-plugin-wkkeyboardfix is available as a unofficial/unsupported workaround.
Add some code in CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
// re-create WKWebView, since we need to update configuration
WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration];
// add begin
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if (@available(iOS 11.0, *)) {
[wkWebView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
#endif
// add end
wkWebView.UIDelegate = self.uiDelegate;
@lovelyelfpop We have said many times, we will not set UIScrollViewContentInsetAdjustmentNever
because it removes control from the app author. Every app should define their content inset behaviour with the viewport-fit
meta tag.
We've already set viewport-fit=cover
, but there is still white space at the first launch, after resume from background, the white space disappears. Or turn to landscape and back, the white space disappears, too.
If use viewport-fit=cover
and body {height:100%}
, the height of html body still can not reach the bottom, but the background-color of body can cover the fullscreen(so it's a body backgroundColor space rather than a white space).
Change height: 100%
to height: 100vh
fix the problem, but is has other side effects.
Maybe add a new <preference>
to control it?
Agree with @lovelyelfpop ,
I can confirm viewport-fit=cover
not resolving this problem.
At first launch there is a white space below to notch on iPhone X and iPhone XR and it goes when we switch App in background/foreground
I also tried height: 100vh in body/html tag. It giving me result like this-
While i expected this-
Add a new preference would shut us up
I write a plugin for cordova-ios@6+ to solve this issue https://github.com/lovelyelfpop/cordova-plugin-wkwebview-inset-adjustment-never
appeared me white space after update cordova 6.0.0
\\\\
and after close keyboard. appearing in large more
\\\\