fix(ios): hide leaving view after nav transition to avoid flicker (#19691)
fixes #19674
This commit is contained in:
parent
e3233000c6
commit
e6e01381eb
|
@ -223,6 +223,19 @@ const setZIndex = (
|
|||
}
|
||||
};
|
||||
|
||||
export const getIonPageElement = (element: HTMLElement) => {
|
||||
if (element.classList.contains('ion-page')) {
|
||||
return element;
|
||||
}
|
||||
|
||||
const ionPage = element.querySelector(':scope > .ion-page, :scope > ion-nav, :scope > ion-tabs');
|
||||
if (ionPage) {
|
||||
return ionPage;
|
||||
}
|
||||
// idk, return the original element so at least something animates and we don't have a null pointer
|
||||
return element;
|
||||
};
|
||||
|
||||
export interface TransitionOptions extends NavOptions {
|
||||
progressCallback?: ((ani: Animation | undefined) => void);
|
||||
baseEl: any;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Animation } from '../../interface';
|
||||
import { createAnimation } from '../animation/animation';
|
||||
import { TransitionOptions } from '../transition';
|
||||
import { TransitionOptions, getIonPageElement } from '../transition';
|
||||
|
||||
const DURATION = 540;
|
||||
const addSafeArea = (val: number, side = 'top'): string => {
|
||||
|
@ -376,6 +376,13 @@ export const iosTransitionAnimation = (navEl: HTMLElement, opts: TransitionOptio
|
|||
.beforeClearStyles([OPACITY])
|
||||
.fromTo('transform', `translateX(${CENTER})`, (isRTL ? 'translateX(-100%)' : 'translateX(100%)'));
|
||||
|
||||
const leavingPage = getIonPageElement(leavingEl) as HTMLElement;
|
||||
rootAnimation.afterAddWrite(() => {
|
||||
if (rootAnimation.getDirection() === 'normal') {
|
||||
leavingPage.style.setProperty('display', 'none');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
// leaving content, forward direction
|
||||
leavingContent
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Animation } from '../../interface';
|
||||
import { createAnimation } from '../animation/animation';
|
||||
import { TransitionOptions } from '../transition';
|
||||
import { TransitionOptions, getIonPageElement } from '../transition';
|
||||
|
||||
export const mdTransitionAnimation = (_: HTMLElement, opts: TransitionOptions): Animation => {
|
||||
const OFF_BOTTOM = '40px';
|
||||
|
@ -59,16 +59,3 @@ export const mdTransitionAnimation = (_: HTMLElement, opts: TransitionOptions):
|
|||
|
||||
return rootTransition;
|
||||
};
|
||||
|
||||
const getIonPageElement = (element: HTMLElement) => {
|
||||
if (element.classList.contains('ion-page')) {
|
||||
return element;
|
||||
}
|
||||
|
||||
const ionPage = element.querySelector(':scope > .ion-page, :scope > ion-nav, :scope > ion-tabs');
|
||||
if (ionPage) {
|
||||
return ionPage;
|
||||
}
|
||||
// idk, return the original element so at least something animates and we don't have a null pointer
|
||||
return element;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue