Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova iOS cannot disable Keyboard Shrinks View

Tags:

ios

cordova

With latest Cordova on iOS 8.1, it seems I cannot prevent the keyboard to shrink the view height.

I've tried the following settings:

  • in my config.xml:

    <preference name="KeyboardShrinksView" value="false" />
    
  • in the index.html viewport tag:

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

    or

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

    or

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

None of these disabling the shrink behavior.

How could I prevent the keyboard from shrinking the view on iOS?

like image 852
Żabojad Avatar asked Nov 09 '22 20:11

Żabojad


1 Answers

I'm experiencing a very different problem. I can't get cordova to resize the webview like it used to anymore ^^.

with regards to <preference name="KeyboardShrinksView" value="false" /> This is disregarded on ios7 and higher in the org.apache.cordova.labs.keyboard plugin.

The code states:

// No-op on iOS7.  It already resizes webview by default, and this plugin
// is causing layout issues
// with fixed position elements.  We possibly should attempt to implement 
// shrinkview = false on iOS7.
if (!IsAtLeastiOSVersion(@"7.0")) { ... }

I suspect the culprit/savior is in the meta tag. That's where I'm going to look.

Currently mine looks like this:

'<meta name="viewport" content="width=' + viewPortWidth + ', user-scalable=no, initial-scale=1, maximum-scale=1' + extra + '"/>'

where viewPortWidth is dependent on the device, in case of an iphone it's 320, and extra is target-densityDpi=device-dpi in case it's android

Hope it can help you a bit

like image 167
AskeG Avatar answered Nov 14 '22 22:11

AskeG