Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"ok" button missing in iOS7 with Cordova on "select prompt"

Tags:

html

ios7

cordova

I got a Cordova IOS7 APP where I have a default HTML "select" -

When the select prompt shows there is NO "ok" or "done" button to close it again, in iOS6 it works fine, and the same with the buildin Safari browser.

So, can anyone tell me what the problem is?

Cordova APP Cordova APP

Safari browser Safari browser

like image 334
pkdkk Avatar asked Jul 28 '14 11:07

pkdkk


2 Answers

Finally i got it.

Simple answer -

Set this to "false"

cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);

http://forum.ionicframework.com/t/select-dropdown-issue-on-ios/5573/3

like image 67
pkdkk Avatar answered Sep 23 '22 05:09

pkdkk


You can show and hide the accessory bar on demand which is explained better here (but it worked better for me by taking out the $timeouts in the directive). Here's what mine looks like.

.directive('select', function() {
  return {
    restrict: 'E',
    link: function(scope, element, attrs) {
      element.bind('focus', function(e) {
        if (window.cordova && window.cordova.plugins.Keyboard) {
          // console.log("show bar (hide = false)");
          cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
        }
      });
      element.bind('blur', function(e) {
        if (window.cordova && window.cordova.plugins.Keyboard) {
          // console.log("hide bar (hide = true)");
          cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        }
      });
    }
  };
})
like image 28
whatsthatitspat Avatar answered Sep 22 '22 05:09

whatsthatitspat