Ashik Basheer
Ashik Basheer

Reputation: 1601

Ionic2 hide keyboard but keep the input focused

I have and android device that can scan QR codes using a laser at the bottom of the device. I have the Ionic2 app running in the device. I am able to get the scanned result string into the input box but the keyboard is now open as the input is focused.

I don't want the keyboard to show up when the input is focused because keyboard will never be used here.

Any idea how to achieve this? I have used the Ionic native keyboard plugin

this.keyboard.hide();

But the above code also causes a blur on the field due to which the input box cannot catch the result of the scan.

I am using this for scanning QR codes

https://ionicframework.com/docs/native/barcode-scanner/

Actually the plugin works fine using the camera. Here is the laser scanner demo

https://www.youtube.com/watch?v=aREIcL7Af64

The laser scanner scans the QR code (Faster than device camera) and sends it an input field (input box or textarea or any editable field). So I want to hide the keyboard but keep the editable area focused!

Upvotes: 3

Views: 445

Answers (0)

Related Questions