HTML select “Done” label not showing on Ionic for iOS

后端 未结 3 1886
礼貌的吻别
礼貌的吻别 2021-01-05 00:18

I am building an iOS-app using the Ionic-framework. When I use select-elements, I do not get the header with the label \"Done\" when selecting items in the menu on iOS-nativ

3条回答
  •  臣服心动
    2021-01-05 00:42

    Regarding @emccracken's comment, according to the Ionic Team the reason for hideKeyboardAccessoryBar is "because native apps seldom have an accessary bar. It's a dead give away that an app is built with web tech and isn't native."

    You can show and hide the accessory bar on demand which is explained a bit here. Taking the $timeouts out of the directive worked better for me. 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);
            }
          });
        }
      };
    })
    

提交回复
热议问题