mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
run overlay animations outside zone
This commit is contained in:
@ -83,6 +83,14 @@ export class IonicApp {
|
||||
this._zone.run(fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {Function} fn TODO
|
||||
*/
|
||||
zoneRunOutside(fn) {
|
||||
this._zone.runOutsideAngular(fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a known component with a key, for easy lookups later.
|
||||
* @param {TODO} key The key to use to register the component
|
||||
|
@ -75,6 +75,8 @@ export class Overlay {
|
||||
|
||||
export class OverlayRef {
|
||||
constructor(app, overlayType, opts, ref, context) {
|
||||
this.app = app;
|
||||
|
||||
let overlayInstance = (ref && ref.instance);
|
||||
if (!overlayInstance) return;
|
||||
|
||||
@ -127,12 +129,21 @@ export class OverlayRef {
|
||||
|
||||
ClickBlock(true, animation.duration() + 200);
|
||||
|
||||
this.app.zoneRunOutside(() => {
|
||||
|
||||
animation.play().then(() => {
|
||||
|
||||
this.app.zoneRun(() => {
|
||||
ClickBlock(false);
|
||||
animation.dispose();
|
||||
instance.viewDidEnter && instance.viewDidEnter();
|
||||
resolve();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
|
Reference in New Issue
Block a user