diff --git a/js/utils/keyboard.js b/js/utils/keyboard.js index 43c629a66b..c1a4e74bf4 100644 --- a/js/utils/keyboard.js +++ b/js/utils/keyboard.js @@ -23,12 +23,15 @@ ionic.keyboard = { function keyboardInit() { if( keyboardHasPlugin() ) { window.addEventListener('native.showkeyboard', keyboardNativeShow); + window.addEventListener('native.hidekeyboard', keyboardFocusOut); + } + else { + document.body.addEventListener('focusout', keyboardFocusOut); } document.body.addEventListener('ionic.focusin', keyboardBrowserFocusIn); document.body.addEventListener('focusin', keyboardBrowserFocusIn); - document.body.addEventListener('focusout', keyboardFocusOut); document.body.addEventListener('orientationchange', keyboardOrientationChange); document.removeEventListener('touchstart', keyboardInit); @@ -86,6 +89,8 @@ function keyboardShow(element, elementTop, elementBottom, viewportHeight, keyboa keyboardHeight: keyboardHeight }; + details.hasPlugin = keyboardHasPlugin(); + details.contentHeight = viewportHeight - keyboardHeight; console.debug('keyboardShow', keyboardHeight, details.contentHeight); diff --git a/js/views/scrollView.js b/js/views/scrollView.js index ae3caa0a40..8e31a917e7 100644 --- a/js/views/scrollView.js +++ b/js/views/scrollView.js @@ -640,6 +640,15 @@ ionic.views.Scroll = ionic.views.View.inherit({ //If the element is positioned under the keyboard... if( e.detail.isElementUnderKeyboard ) { + var delay; + // Wait on android for scroll view to resize + if ( !ionic.Platform.isFullScreen && e.detail.hasPlugin ) { + delay = 350; + } + else { + delay = 80; + } + //Put element in middle of visible screen //Wait for resize() to reset scroll position ionic.scroll.isScrolling = true; @@ -651,7 +660,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ ionic.tap.cloneFocusedInput(container, self); self.scrollBy(0, scrollTop, true); self.onScroll(); - }, 80 ); + }, delay); } //Only the first scrollView parent of the element that broadcasted this event