mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix unhandled rejection warnings in keyframe animations.
This commit is contained in:
committed by
Hristo Deshev
parent
b89951845b
commit
c4dd3782d5
@@ -212,9 +212,14 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition {
|
||||
let animationDef = this.animations[index];
|
||||
(<any>animationDef).target = view;
|
||||
let animation = new Animation([animationDef]);
|
||||
// Catch the animation cancel to prevent unhandled promise rejection warnings
|
||||
animation.play().then(() => {
|
||||
this.animate(view, index + 1, iterations);
|
||||
});
|
||||
}).catch((error: any) => {
|
||||
if (error.message.indexOf("Animation cancelled") < 0) {
|
||||
throw error;
|
||||
}
|
||||
}); // tslint:disable-line
|
||||
this._nativeAnimations.push(animation);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user