File tree 1 file changed +16
-0
lines changed
nativescript-angular/animations
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { AnimationPlayer } from "@angular/animations" ;
2
2
import { KeyframeAnimation }
3
3
from "tns-core-modules/ui/animation/keyframe-animation" ;
4
+ import { View , EventData } from "tns-core-modules/ui/core/view" ;
4
5
5
6
import { Keyframe , createKeyframeAnimation } from "./utils" ;
6
7
import { NgView } from "../element-registry" ;
@@ -55,6 +56,21 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
55
56
this . _startSubscriptions = [ ] ;
56
57
}
57
58
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 ( ) {
58
74
this . animation . play ( this . target )
59
75
. then ( ( ) => this . onFinish ( ) )
60
76
. catch ( ( _e ) => { } ) ;
You can’t perform that action at this time.
0 commit comments