Skip to content

Commit c4dd378

Browse files
committed
Fix unhandled rejection warnings in keyframe animations.
1 parent b899518 commit c4dd378

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tns-core-modules/ui/animation/keyframe-animation.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,14 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition {
212212
let animationDef = this.animations[index];
213213
(<any>animationDef).target = view;
214214
let animation = new Animation([animationDef]);
215+
// Catch the animation cancel to prevent unhandled promise rejection warnings
215216
animation.play().then(() => {
216217
this.animate(view, index + 1, iterations);
217-
});
218+
}).catch((error: any) => {
219+
if (error.message.indexOf("Animation cancelled") < 0) {
220+
throw error;
221+
}
222+
}); // tslint:disable-line
218223
this._nativeAnimations.push(animation);
219224
}
220225
}

0 commit comments

Comments
 (0)