简体   繁体   中英

Ionic3 keep keyboard after send message

I have the following html in Ionic3 page to implement a chat:

  <ion-item>
    <ion-textarea placeholder="Write your message" [(ngModel)]="newMessage"></ion-textarea>
    <button ion-button clear item-right icon-only (click)="sendMessage()">
      <ion-icon name="paper-plane"></ion-icon>
    </button>
  </ion-item>

I'd like to keep device keyboard shown untill the user press device "back button" or outside the ion-textarea element. I've tried using ionFocus and ionBlur events.

Any ideas?

you need to put this in you config.xml for IOS Device

<preference name="KeyboardDisplayRequiresUserAction" value="false" />

Or in Android you need to preventDefault like this on function call:

 (mousedown)="$event.preventDefault()"

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