mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
@ -22,7 +22,9 @@ export class Keyboard {
|
||||
}
|
||||
|
||||
onClose(callback, pollingInternval=KEYBOARD_CLOSE_POLLING) {
|
||||
console.debug('keyboard onClose');
|
||||
const self = this;
|
||||
let checks = 0;
|
||||
|
||||
let promise = null;
|
||||
|
||||
@ -34,7 +36,8 @@ export class Keyboard {
|
||||
self.zone.runOutsideAngular(() => {
|
||||
|
||||
function checkKeyboard() {
|
||||
if (!self.isOpen()) {
|
||||
console.debug('keyboard isOpen', self.isOpen(), checks);
|
||||
if (!self.isOpen() || checks > 100) {
|
||||
rafFrames(30, () => {
|
||||
self.zone.run(() => {
|
||||
console.debug('keyboard closed');
|
||||
@ -45,6 +48,7 @@ export class Keyboard {
|
||||
} else {
|
||||
setTimeout(checkKeyboard, pollingInternval);
|
||||
}
|
||||
checks++;
|
||||
}
|
||||
|
||||
setTimeout(checkKeyboard, pollingInternval);
|
||||
@ -54,6 +58,7 @@ export class Keyboard {
|
||||
}
|
||||
|
||||
close() {
|
||||
console.debug('keyboard close()');
|
||||
raf(() => {
|
||||
if (hasFocusedTextInput()) {
|
||||
// only focus out when a text input has focus
|
||||
|
Reference in New Issue
Block a user