Please help me with native.keyboardhide
never fire.
document.addEventListener("deviceready", function(){
window.addEventListener('native.keyboardhide', function () {
StatusBar.hide()
console.log("as")
}); ///This event never fire, please help
cordova.plugins.Keyboard.show();///work
}, false);
ionic-plugin-keyboard
with event native.keyboardhide
never fire. Please help.
maybe you should try like this:
window.addEventListener('native.keyboardhide', keyboardHideHandler);
function keyboardHideHandler() {
//your code here
}
I’ve tried, it still not work.
did you add ionic keyboard plugin?
of course yes i added it
$ cordova plugin --list
cordova-admob-sdklibs 2.1.4 "Google Mobile Ads SDK for Cordova"
cordova-plugin-admob-simple 3.2.1 "Cordova-Phonegap AdMob Plugin"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-apprate 1.3.0 "AppRate"
cordova-plugin-base64-joewsh 1.0.0 "Base64"
cordova-plugin-clipboard-x 1.0.1 "Clipboard"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-dialogs 1.3.3 "Notification"
cordova-plugin-file 4.3.1 "File"
cordova-plugin-file-transfer 1.6.1 "File Transfer"
cordova-plugin-firebase 0.1.24 "Google Firebase Plugin"
cordova-plugin-globalization 1.0.7 "Globalization"
cordova-plugin-inappbrowser 1.6.1 "InAppBrowser"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-splashscreen 4.0.1 "Splashscreen"
cordova-plugin-statusbar 2.2.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
cordova-plugin-x-toast 2.6.0 "Toast"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
strange behaviour I can’t replicate it. maybe something wrong with your device or your app… where did you deploying/testing it??
something wrong with your device or your app… where did you deploying/testing it??
Yes, i built it and run with 2 different devices, the event never fire when the keyboard hide.
I’m trying to run with --livereload in real device, still not work.
sujit77
September 26, 2017, 10:15am
8
drquochoai:
native.keyboardhide
Could you look at this documentation to see if you can use onKeyboardHide()
?
1 Like
Hi @sujit77 ,
I’m using ionic 1 so i can not use ionic 2 function.
sujit77
September 26, 2017, 11:19am
10
Judging by the code provided, I think you have followed this ionic-plugins-keyboard .
But I see some difference native.keyboardhide
vs native.hidekeyboard
.
Can you try adding the native.keyboardhide
event listener out of deviceready
? Something like -
window.addEventListener('native.keyboardhide', function () {
StatusBar.hide()
console.log("as")
});
If above doen’t work. Then lets solve this one with normal JavaScript.
The device keyboard only opens after some input field gets focus(programetically or by touch event).
Then just add onblur
event listener to that particular input field(if possible).
document.getElementById('targetInputField').addEventListener('onblur', myHandlerFunction);
1 Like
Thank @sujit77 , I’ll try the second solution.