BUG - No done button for select tag in IOS

2020-06-10 01:07发布

I'm using the latest ionic and have a simple select tag.

<select class="assertive bold" ng-change="changeQuantity({cartItem: part})" ng-model="part.quantity" ng-options="n for n in [] | range:1:101"></select>

When I run the code with ionic emulate ios

Why is there no done button for the select? Shouldn't that be default? How do I fix this to display a done button?

5条回答
小情绪 Triste *
2楼-- · 2020-06-10 01:34

I have fought this issue for over four hours. The recommended answer, hideKeyboardAccessoryBar(false) failed repeatedly, with every possible combination of cordova.Keyboard, windows.Keyboard, $window.cordova.Keyboard, yes, inside deviceready, etc. etc. Resolved all conflicts between this and the older plugin.

No joy.

Solution: REMOVE THIS PLUGIN. Guess what. You get your Done button back. Run the following command:

ionic cordova plugin remove cordova-plugin-ionic-keyboard

查看更多
成全新的幸福
3楼-- · 2020-06-10 01:39

Solution: Remove this plugin!

sudo cordova plugin remove ionic-plugin-keyboard.

查看更多
疯言疯语
4楼-- · 2020-06-10 01:48

This is what worked for me since I needed the accessory bar only in one instance, the accepted answer is old, and I am using cordova-plugin-keyboard instead. I used it with an onOpen handler.

if (window.Keyboard) {
  window.Keyboard.hideFormAccessoryBar(false);
}
查看更多
家丑人穷心不美
5楼-- · 2020-06-10 01:53

What worked for me is doing:

if (Keyboard) {
  Keyboard.hideFormAccessoryBar(false);
  Keyboard.hideKeyboardAccessoryBar(false);
}

The new plugin was exposed as global Keyboard, rather than cordova.plugins.Keyboard, and then the hideFormAccessoryBar is for form elements, rather than just for keyboard typing.

查看更多
该账号已被封号
6楼-- · 2020-06-10 01:54

Although this is a late answer, I'm sure more people will end up here while searching for a solution to this issue.

By default in your app.js in .run() the hideKeyboardAccessoryBar is set to true, so just find

if (window.cordova && window.cordova.plugins.Keyboard) {
  window.cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}

and change it to

if (window.cordova && window.cordova.plugins.Keyboard) {
  window.cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
}
查看更多
登录 后发表回答