PhoneGap 3.3 iOS KeyboardShrinksView

2019-02-09 21:24发布

问题:

In PhoneGap/Cordova 3.3 (and 3.2) the preference KeyboardShrinksView for iOS is gone and has been replaced with enableViewPortScale.

Can anyone explain to me how to achieve the same result I would get with KeyboardShrinksView but by using enableViewPortScale and the viewport Metatag?

When in iOS, if the user opens the keyboard I need the entire view to shrink.

回答1:

Here is what I ended up doing:

<meta name="viewport" content="initial-scale=1, minimum-scale=1, 
maximum-scale=1, user-scalable=0, height=device-height"/>

Thanks to @daniel-miller, the answer above came from him here:

Keyboard hides iOS input fields in PhoneGap Build 3.1 with an iFrame/object and JQTouch

Other Help: https://groups.google.com/forum/#!topic/phonegap/87K3lYr6f40



回答2:

The commit that removes these (see https://issues.apache.org/jira/browse/CB-4978) states:

The Keyboard preferences have been removed from core and put into its own plugin in cordova-labs plugins branch.

I've tracked this down to https://github.com/apache/cordova-plugins/tree/master/keyboard and this fork (?): https://github.com/etiennea/phonegap-keyboard

This should then allow you to use

Keyboard.shrinkView(true)

in your JS to minic the old functionality of KeyboardShrinksView