Ion-input loses focus while using bluetooth keyboard

时间:2017-10-12 09:42:33

标签: ios cordova ionic-framework bluetooth-keyboard

I am working on entering text with Hardware keyboard(Bluetooth connected) connected to iPhone(iOS 9 and iOS 10) in Ionic 3. While entering, The input is losing its focus and even if i try to enter again, It is not taking any input from keyboard. This hardware keyboard is working well in Android phone but not in iOS.

I tried upgrading/re-installing updated keyboard plugin from Cordova. But no luck with that.

The below is my Ionic Info.

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.12.0
ionic (Ionic CLI) : 3.12.0

Global Packages:

cordova (Cordova CLI) : 6.5.0

Local Packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.1.2 browser 4.1.0 ios 4.1.1
Ionic Framework    : ionic-angular 3.6.0

System:

ios-deploy : 1.9.1
ios-sim    : 5.0.13
Node       : v7.4.0
npm        : 5.0.3
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b

Misc:

backend : pro

If any ideas, Please let me know. Thank you.

EDIT

I tried with downgrading Ionic from 3.12 to 2.18. Still no luck. Input field still looses focus within milliseconds.

2 个答案:

答案 0 :(得分:1)

安装Keyboard plugin。 在 app.components.ts 的构造函数中:

platform.ready().then(() => {
   keyboard.hideKeyboardAccessoryBar(false);
});

答案 1 :(得分:0)

这里有一些事情需要验证,你面临的问题是与WebViews特别是iOS相关的问题,所以让我们从键盘开始,尝试安装ionic-plugin-keyboard

cordova plugin add ionic-plugin-keyboard --save

如果您需要更多与您想要触发键盘事件相关的事件,请参阅official doc

我通常使用ionic-wkwebview而不是使用iOS的构建webview来解决大部分问题。您可以按如下方式安装插件:

ionic cordova plugin add cordova-plugin-ionic-webview --save

有关完整安装,请参阅ionic-wkwebview-official doc

即使对于ionic-plugin-keyboardion-input也存在问题,但问题已解决,问题不在于插件,而在于Webview

以下是对已解决的issue的引用。