From 15cb51af34f14ab2baf37f981266d1c6850fe9b5 Mon Sep 17 00:00:00 2001 From: stephane padovani Date: Thu, 6 Jul 2023 15:26:24 +0200 Subject: [PATCH] [fix][iOS 17 beta] screen not scrolled when keyboard displayed on IOS 17 beta --- README.md | 5 ++++- src/ios/CDVIonicKeyboard.m | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4674035..1f57bc3 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,13 @@ This plugin has been designed to work seamlessly with `cordova-plugin-ionic-webv - https://github.com/ionic-team/cordova-plugin-ionic-webview - https://ionicframework.com/docs/wkwebview/ +## Purpose of this fork +- Fix screen not scrolled when keyboard displayed on IOS 17 beta + ## Installation ``` -cordova plugin add cordova-plugin-ionic-keyboard --save +cordova plugin add https://github.com/powowbox/cordova-plugin-ionic-keyboard.git --save --noregistery ``` ## Preferences diff --git a/src/ios/CDVIonicKeyboard.m b/src/ios/CDVIonicKeyboard.m index e4615a8..b1bada8 100644 --- a/src/ios/CDVIonicKeyboard.m +++ b/src/ios/CDVIonicKeyboard.m @@ -155,6 +155,10 @@ - (void)onKeyboardWillShow:(NSNotification *)note } CGRect rect = [[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; double height = rect.size.height; + if ( height < 100 ) { + // SPI 07/07/23 fix for ios 17 beta. The callback trigger a first time with height 44 => the page is not scrolled correctly + return; + } if (self.isWK) { double duration = [[note.userInfo valueForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; @@ -172,6 +176,10 @@ - (void)onKeyboardDidShow:(NSNotification *)note { CGRect rect = [[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; double height = rect.size.height; + if ( height < 100 ) { + // SPI 07/07/23 fix for ios 17 beta. The callback trigger a first time with height 44 => the page is not scrolled correctly + return; + } if (self.isWK) { [self resetScrollView];