mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 18:54:11 +08:00
fix(animation): enable backwards compatibility for overlay animations (#19160)
* fix backwards compat for overlays * fix overlay * Address navigation edge case
This commit is contained in:
@ -4,7 +4,7 @@ import { Animator } from './animator';
|
|||||||
|
|
||||||
export const create = (animationBuilder?: AnimationBuilder, baseEl?: any, opts?: any): Promise<Animation> => {
|
export const create = (animationBuilder?: AnimationBuilder, baseEl?: any, opts?: any): Promise<Animation> => {
|
||||||
if (animationBuilder) {
|
if (animationBuilder) {
|
||||||
return animationBuilder(baseEl, opts);
|
return animationBuilder(Animator as any, baseEl, opts);
|
||||||
}
|
}
|
||||||
return Promise.resolve(new Animator() as any);
|
return Promise.resolve(new Animator() as any);
|
||||||
};
|
};
|
||||||
|
@ -190,11 +190,15 @@ const overlayAnimation = async (
|
|||||||
/**
|
/**
|
||||||
* TODO: Remove AnimationBuilder
|
* TODO: Remove AnimationBuilder
|
||||||
*/
|
*/
|
||||||
const animation = await import('./animation/old-animation').then(mod => mod.create(animationBuilder as AnimationBuilder, aniRoot, opts));
|
let animation;
|
||||||
const isAnimationBuilder = (animation as any).fill === undefined;
|
let isAnimationBuilder = true;
|
||||||
|
try {
|
||||||
if (!isAnimationBuilder) {
|
const mod = await import('./animation/old-animation');
|
||||||
(animation as any).fill('both');
|
animation = await mod.create(animationBuilder as AnimationBuilder, aniRoot, opts);
|
||||||
|
} catch (err) {
|
||||||
|
animation = (animationBuilder as IonicAnimationInterface)(aniRoot, opts);
|
||||||
|
animation.fill('both');
|
||||||
|
isAnimationBuilder = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay.animation = animation;
|
overlay.animation = animation;
|
||||||
|
@ -85,7 +85,8 @@ const animation = async (animationBuilder: IonicAnimationInterface | AnimationBu
|
|||||||
let trans: Animation | IonicAnimation;
|
let trans: Animation | IonicAnimation;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
trans = await import('../animation/old-animation').then(mod => mod.create(animationBuilder as AnimationBuilder, opts.baseEl, opts));
|
const mod = await import('../animation/old-animation');
|
||||||
|
trans = await mod.create(animationBuilder as AnimationBuilder, opts.baseEl, opts);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
trans = (animationBuilder as IonicAnimationInterface)(opts.baseEl, opts);
|
trans = (animationBuilder as IonicAnimationInterface)(opts.baseEl, opts);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user