mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Compare commits
1 Commits
ionic-modu
...
FW-5331
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8ee3efb76 |
@@ -3,6 +3,7 @@ import { Component, Element, Host, Prop, State, h } from '@stencil/core';
|
|||||||
import { findIonContent, getScrollElement, printIonContentErrorMsg } from '@utils/content';
|
import { findIonContent, getScrollElement, printIonContentErrorMsg } from '@utils/content';
|
||||||
import type { KeyboardController } from '@utils/keyboard/keyboard-controller';
|
import type { KeyboardController } from '@utils/keyboard/keyboard-controller';
|
||||||
import { createKeyboardController } from '@utils/keyboard/keyboard-controller';
|
import { createKeyboardController } from '@utils/keyboard/keyboard-controller';
|
||||||
|
import { Keyboard, KeyboardResize } from '@utils/native/keyboard';
|
||||||
|
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
|
|
||||||
@@ -52,18 +53,28 @@ export class Footer implements ComponentInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async connectedCallback() {
|
async connectedCallback() {
|
||||||
this.keyboardCtrl = await createKeyboardController(async (keyboardOpen, waitForResize) => {
|
const resizeMode = await Keyboard.getResizeMode();
|
||||||
/**
|
|
||||||
* If the keyboard is hiding, then we need to wait
|
|
||||||
* for the webview to resize. Otherwise, the footer
|
|
||||||
* will flicker before the webview resizes.
|
|
||||||
*/
|
|
||||||
if (keyboardOpen === false && waitForResize !== undefined) {
|
|
||||||
await waitForResize;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.keyboardVisible = keyboardOpen; // trigger re-render by updating state
|
/**
|
||||||
});
|
* If the resize mode is set to None then we don't want to
|
||||||
|
* hide the tab bar here since it will never sit on top
|
||||||
|
* of the keyboard. Hiding the tab bar will cause a layout shift
|
||||||
|
* in apps that have resize set to None.
|
||||||
|
*/
|
||||||
|
if (resizeMode === undefined || resizeMode.mode !== KeyboardResize.None) {
|
||||||
|
this.keyboardCtrl = await createKeyboardController(async (keyboardOpen, waitForResize) => {
|
||||||
|
/**
|
||||||
|
* If the keyboard is hiding, then we need to wait
|
||||||
|
* for the webview to resize. Otherwise, the footer
|
||||||
|
* will flicker before the webview resizes.
|
||||||
|
*/
|
||||||
|
if (keyboardOpen === false && waitForResize !== undefined) {
|
||||||
|
await waitForResize;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.keyboardVisible = keyboardOpen; // trigger re-render by updating state
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import type { ComponentInterface, EventEmitter } from '@stencil/core';
|
|||||||
import { Component, Element, Event, Host, Prop, State, Watch, h } from '@stencil/core';
|
import { Component, Element, Event, Host, Prop, State, Watch, h } from '@stencil/core';
|
||||||
import type { KeyboardController } from '@utils/keyboard/keyboard-controller';
|
import type { KeyboardController } from '@utils/keyboard/keyboard-controller';
|
||||||
import { createKeyboardController } from '@utils/keyboard/keyboard-controller';
|
import { createKeyboardController } from '@utils/keyboard/keyboard-controller';
|
||||||
|
import { Keyboard, KeyboardResize } from '@utils/native/keyboard';
|
||||||
import { createColorClasses } from '@utils/theme';
|
import { createColorClasses } from '@utils/theme';
|
||||||
|
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
@@ -70,18 +71,28 @@ export class TabBar implements ComponentInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async connectedCallback() {
|
async connectedCallback() {
|
||||||
this.keyboardCtrl = await createKeyboardController(async (keyboardOpen, waitForResize) => {
|
const resizeMode = await Keyboard.getResizeMode();
|
||||||
/**
|
|
||||||
* If the keyboard is hiding, then we need to wait
|
|
||||||
* for the webview to resize. Otherwise, the tab bar
|
|
||||||
* will flicker before the webview resizes.
|
|
||||||
*/
|
|
||||||
if (keyboardOpen === false && waitForResize !== undefined) {
|
|
||||||
await waitForResize;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.keyboardVisible = keyboardOpen; // trigger re-render by updating state
|
/**
|
||||||
});
|
* If the resize mode is set to None then we don't want to
|
||||||
|
* hide the tab bar here since it will never sit on top
|
||||||
|
* of the keyboard. Hiding the tab bar will cause a layout shift
|
||||||
|
* in apps that have resize set to None.
|
||||||
|
*/
|
||||||
|
if (resizeMode === undefined || resizeMode.mode !== KeyboardResize.None) {
|
||||||
|
this.keyboardCtrl = await createKeyboardController(async (keyboardOpen, waitForResize) => {
|
||||||
|
/**
|
||||||
|
* If the keyboard is hiding, then we need to wait
|
||||||
|
* for the webview to resize. Otherwise, the tab bar
|
||||||
|
* will flicker before the webview resizes.
|
||||||
|
*/
|
||||||
|
if (keyboardOpen === false && waitForResize !== undefined) {
|
||||||
|
await waitForResize;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.keyboardVisible = keyboardOpen; // trigger re-render by updating state
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { doc, win } from '@utils/browser';
|
import { doc, win } from '@utils/browser';
|
||||||
|
import { Keyboard, KeyboardResize } from '@utils/native/keyboard';
|
||||||
import { Keyboard, KeyboardResize } from '../native/keyboard';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The element that resizes when the keyboard opens
|
* The element that resizes when the keyboard opens
|
||||||
|
|||||||
Reference in New Issue
Block a user