How to resize webview when keyboard appears on iOS (Cordova)

In Phonegap 3.7.0, when the keyboard appears on an iPhone or iPad, the webview does not change and the keyboard ends above the footer. I would like the web view to be compressed so that the footer remains visible. Is there a way to fix this?

I've seen a lot of questions here to actually achieve the opposite, but this was with previous versions of Cordova / Phonegap.

FYI, I tried the following, resize the body when the keyboard appears (I use the Ionic keyboard plugin to find out when it is displayed and its height) and change the value of bottom

my footer. This works on iPhone 6.1.3, but not iPhone / iPad 8. *. Even if the body is smaller, the body still scrolls as if it were still 100%. I tried to delete the content of the meta tag with width=device-width

, but it didn't change anything.

+3


source to share


1 answer


One option is to use a plugin to compress your own WebView. Add a cordova-plugin-keyboard

project to you:

phonegap plugin add cordova-plugin-keyboard

      

then in your config.xml file add



<preference name="KeyboardShrinksView" value="true" /> 

      

or call this method in your javascript

Keyboard.shrinkView(true);

      

+6


source







All Articles