简体   繁体   中英

How to hide ionic keyboard in Auto focus

I am using Ionic 3 and Angular 5. I have a text-area with Auto focus. problem is, I do not want to show keyboard in auto focus. How can I hide keyboard in Auto focus. Here is my code.

 setTimeout(() => {
  this.myInput.setFocus();
},1000);

This code is for Auto focus.

<ion-textarea style="color:red; opacity: 0;" #input id="myInput" rows="1" maxLength="500"  [(ngModel)]="details" (ionChange)="Scan($event)" ></ion-textarea>

This is HTML code please help me out. Thanks

You can use this code for hiding keyboard

import { Keyboard } from '@ionic-native/keyboard';

constructor(private keyboard: Keyboard) { }

...

this.keyboard.show();

this.keyboard.close();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM