From 148347f37fa6740adf255b61fb9c47defc4dec6f Mon Sep 17 00:00:00 2001 From: VladimirAmiorkov Date: Mon, 21 Oct 2019 11:10:28 +0300 Subject: [PATCH 1/3] fix(animations): resolve issue with "query animations" on iOS 13 --- .../animations/animation-player.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nativescript-angular/animations/animation-player.ts b/nativescript-angular/animations/animation-player.ts index fa38f6782..f8bd2e8b8 100644 --- a/nativescript-angular/animations/animation-player.ts +++ b/nativescript-angular/animations/animation-player.ts @@ -1,6 +1,7 @@ import { AnimationPlayer } from "@angular/animations"; import { KeyframeAnimation } from "tns-core-modules/ui/animation/keyframe-animation"; +import { View, EventData } from "tns-core-modules/ui/core/view"; import { Keyframe, createKeyframeAnimation } from "./utils"; import { NgView } from "../element-registry"; @@ -55,6 +56,19 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer { this._startSubscriptions = []; } + if (this.target.nativeViewProtected) { + this.playAnimation(); + } else { + this.target.on(View.loadedEvent, this.onTargetLoaded.bind(this)); + } + } + + private onTargetLoaded(args: EventData) { + this.target.off(View.loadedEvent, this.onTargetLoaded); + this.playAnimation(); + } + + private playAnimation() { this.animation.play(this.target) .then(() => this.onFinish()) .catch((_e) => {}); From 5a74edcdfd43461ab20ef39efc60a024de077065 Mon Sep 17 00:00:00 2001 From: VladimirAmiorkov Date: Mon, 21 Oct 2019 11:21:03 +0300 Subject: [PATCH 2/3] chore: add note for exsisting issue --- nativescript-angular/animations/animation-player.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nativescript-angular/animations/animation-player.ts b/nativescript-angular/animations/animation-player.ts index f8bd2e8b8..c4474251b 100644 --- a/nativescript-angular/animations/animation-player.ts +++ b/nativescript-angular/animations/animation-player.ts @@ -56,6 +56,8 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer { this._startSubscriptions = []; } + // When this issue https://github.com/NativeScript/NativeScript/issues/7984 is fixes in @nativescript/core + // we can change this fix and apply the one that is recommended in that issue. if (this.target.nativeViewProtected) { this.playAnimation(); } else { From 1c0238410f92e957c8d945d488ccc92c74fdf287 Mon Sep 17 00:00:00 2001 From: VladimirAmiorkov Date: Mon, 21 Oct 2019 11:28:45 +0300 Subject: [PATCH 3/3] chore: refator fix --- nativescript-angular/animations/animation-player.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nativescript-angular/animations/animation-player.ts b/nativescript-angular/animations/animation-player.ts index c4474251b..d63ef066e 100644 --- a/nativescript-angular/animations/animation-player.ts +++ b/nativescript-angular/animations/animation-player.ts @@ -58,7 +58,7 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer { // When this issue https://github.com/NativeScript/NativeScript/issues/7984 is fixes in @nativescript/core // we can change this fix and apply the one that is recommended in that issue. - if (this.target.nativeViewProtected) { + if (this.target.isLoaded) { this.playAnimation(); } else { this.target.on(View.loadedEvent, this.onTargetLoaded.bind(this));