From c38186f10f35261e4b8234d530efb2a27a10deea Mon Sep 17 00:00:00 2001 From: Chet Corcos Date: Fri, 14 Jul 2017 15:19:15 -0700 Subject: [PATCH 1/2] Account for blue status bar height when shrinking keyboard --- src/ios/CDVKeyboard.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ios/CDVKeyboard.m b/src/ios/CDVKeyboard.m index 3041f57..9e40179 100644 --- a/src/ios/CDVKeyboard.m +++ b/src/ios/CDVKeyboard.m @@ -200,6 +200,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]; } From cf6d21c782ea2aa04e13883b35ea6c44132531e2 Mon Sep 17 00:00:00 2001 From: Chet Corcos Date: Tue, 25 Jul 2017 16:06:21 -0700 Subject: [PATCH 2/2] Fix scroller resizing bug https://github.com/cjpearson/cordova-plugin-keyboard/issues/55 --- src/ios/CDVKeyboard.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ios/CDVKeyboard.m b/src/ios/CDVKeyboard.m index 9e40179..01246ce 100644 --- a/src/ios/CDVKeyboard.m +++ b/src/ios/CDVKeyboard.m @@ -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];