Keyboard not hide (Ionic v5 - Angular v11 - Capacitor v2)

Good evening, I have been trying and trying again for days but I cannot in any way make the keyboard disappear or remove the focus from the ion-serch-bar.

This is my system information

Ionic:

Ionic CLI : 6.16.3 (/Users/gosumania/.nvm/versions/node/v14.11.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.6.3
@angular-devkit/build-angular : 0.1102.14
@angular-devkit/schematics : 11.2.6
@angular/cli : 11.2.6
@ionic/angular-toolkit : 2.3.3

Capacitor:

Capacitor CLI : 2.4.7
@capacitor/android : 2.4.2
@capacitor/core : 2.4.7
@capacitor/ios : 2.4.9

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : not available
Cordova Plugins : not available

Utility:

cordova-res : 0.15.3
native-run (update available: 1.4.0) : 1.3.0

System:

ios-deploy : 1.11.3
ios-sim : 8.0.2
NodeJS : v14.11.0 (/Users/gosumania/.nvm/versions/node/v14.11.0/bin/node)
npm : 7.8.0
OS : macOS Big Sur
Xcode : Xcode 12.5.1 Build version 12E507

This is the code I use:

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

  constructor(private keyboard: Keyboard){}

closeKeyboard() {
  this.keyboard.hide()
}

I try on IOS device and on Android device.

On Xcode i have di warn :

[warn] - Native: tried calling Keyboard.hide, but the Keyboard plugin is not installed.

:zap: [warn] - Install the Keyboard plugin: 'ionic cordova plugin add cordova-plugin-ionic-keyboard’

I cannot upgrade to Capacitor 3.0 because I have too many errors if I try to do so.

cordova-plugin-ionic-keyboard is a known incompatible plugin Capacitor - build cross platform apps with the web

Capacitor includes it’s own Keyboard plugin that you can use to hide the keyboard

1 Like

i have the same problem and with the same scenario… keyboard… hide()… but nothing.

unfortunaly the keyboard have a natural behaviour with input fields, appears immediately

I use :

import { Plugins } from '@capacitor/core';

const { Keyboard } = Plugins;

Keyboard.hide();
1 Like