PhoneGap 3.3 iOS KeyboardShrinksView
Asked Answered
L

2

7

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.

Lightner answered 12/2, 2014 at 20:55 Comment(0)
L
4

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

Lightner answered 14/2, 2014 at 1:0 Comment(1)
I had a problem, that when after the keyboard has shown. The view got bigger than the screen so I had horizontal scroll.. This solved it thanks :-)Tallman
D
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

Dvandva answered 12/3, 2014 at 14:4 Comment(7)
While I gave you an upvote, I cannot accept as the answer. It does help, but the question was to achieve this result in the new manner. Thanks for the links though!! :DLightner
the Keyboard.shrinkView(false); and Keyboard.hideFormAccessoryBar(false); seem to have no effect at all on iOS 8.1 with latest cordova... Is there any specific setting to make it work ?Colligate
Just noticed the same. Was going to look for enableViewPortScale.Vitreous
shrinkView has no effect on iOS 7 or greater, as it disregards the shrinkView with a if(!IsAtLeastiOSVersion(@"7.0")) in the code. As for the hideFormAccessoryBar(true) works fine for me. But note that you wrote false in your comment.Capapie
Did anyone find a solution for iOS >= 7? height=device-height doesn't work for me.Hagiology
I am also looking for a fix for iOS >= 7Incombustible
Same here... I also need a fix for >=7Louvain

© 2022 - 2024 — McMap. All rights reserved.