Hey ionic forum,
I recently needed to hide the ion-tabs when the keyboard shows and solved it with a directive:
.directive('hideTabsOnKeyboardOpen', ["AppWindow", function(AppWindow) {
return function(scope, element, attrs) {
reg = function(){
AppWindow.onKeyboardShow(function(){
$(element).addClass('tabs-item-hide');
$(element).find('ion-content').removeClass('has-tabs');
AppWindow.onKeyboardHide(function(){
$(element).removeClass('tabs-item-hide');
$(element).find('ion-content').addClass('has-tabs');
reg();
});
});
}
reg();
};
}])
AppWindow has these two functions:
onKeyboardHide: function(cb){
var callbackAndRemoveListener = function (){
cb();
window.removeEventListener('native.keyboardhide',callbackAndRemoveListener);
};
window.addEventListener('native.keyboardhide', callbackAndRemoveListener);
},
onKeyboardShow: function(cb){
var callbackAndRemoveListener = function (){
cb();
window.removeEventListener('native.keyboardshow',callbackAndRemoveListener);
};
window.addEventListener('native.keyboardshow', callbackAndRemoveListener);
}
This works but seems a bit patchy , is there any other more standard way to do so?
Thanks 