Skip to content

Commit c382682

Browse files
author
Vladimir Amiorkov
authored
fix(animations): resolve issue with "query animations" on iOS 13 (#2022)
* fix(animations): resolve issue with "query animations" on iOS 13 * chore: add note for exsisting issue * chore: refator fix
1 parent 176b987 commit c382682

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: nativescript-angular/animations/animation-player.ts

+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { AnimationPlayer } from "@angular/animations";
22
import { KeyframeAnimation }
33
from "tns-core-modules/ui/animation/keyframe-animation";
4+
import { View, EventData } from "tns-core-modules/ui/core/view";
45

56
import { Keyframe, createKeyframeAnimation } from "./utils";
67
import { NgView } from "../element-registry";
@@ -55,6 +56,21 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
5556
this._startSubscriptions = [];
5657
}
5758

59+
// When this issue https://github.com/NativeScript/NativeScript/issues/7984 is fixes in @nativescript/core
60+
// we can change this fix and apply the one that is recommended in that issue.
61+
if (this.target.isLoaded) {
62+
this.playAnimation();
63+
} else {
64+
this.target.on(View.loadedEvent, this.onTargetLoaded.bind(this));
65+
}
66+
}
67+
68+
private onTargetLoaded(args: EventData) {
69+
this.target.off(View.loadedEvent, this.onTargetLoaded);
70+
this.playAnimation();
71+
}
72+
73+
private playAnimation() {
5874
this.animation.play(this.target)
5975
.then(() => this.onFinish())
6076
.catch((_e) => {});

0 commit comments

Comments
 (0)