Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/ios/CDVKeyboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ - (void)setShrinkView:(BOOL)shrinkView
// They removed this behavior is iOS 10, but for 8 and 9 we need to prevent the webview from listening on keyboard events
// Even if you later set shrinkView to false, the observers will not be added back
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
if ([self.webView isKindOfClass:NSClassFromString(@"WKWebView")]
&& ![[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = 10, .minorVersion = 0, .patchVersion = 0 }]) {
if ([self.webView isKindOfClass:NSClassFromString(@"WKWebView")]) {
[nc removeObserver:self.webView name:UIKeyboardWillHideNotification object:nil];
[nc removeObserver:self.webView name:UIKeyboardWillShowNotification object:nil];
[nc removeObserver:self.webView name:UIKeyboardWillChangeFrameNotification object:nil];
Expand Down Expand Up @@ -200,6 +199,12 @@ - (void)shrinkViewKeyboardWillChangeFrame:(NSNotification*)notif
self.webView.scrollView.scrollEnabled = !self.disableScrollingInShrinkView;
}

// Check if the webview is offset due to the blue navigation status bar.
CGRect webviewFrame = [self.webView convertRect:[self.webView bounds] fromView:self.webView.superview];
float yOffset = webviewFrame.origin.y;
screen.origin.y -= yOffset;
screen.size.height += yOffset;

// A view's frame is in its superview's coordinate system so we need to convert again
self.webView.frame = [self.webView.superview convertRect:screen fromView:self.webView];
}
Expand Down