File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -608,13 +608,19 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
608608 }
609609
610610 public initNativeView ( ) : void {
611- //
611+ // No initNativeView(this)?
612+ if ( this . _cssState ) {
613+ this . _cssState . playPendingKeyframeAnimations ( ) ;
614+ }
612615 }
613616
614617 public resetNativeView ( ) : void {
615618 if ( this . nativeView && this . recycleNativeView && isAndroid ) {
616619 resetNativeView ( this ) ;
617620 }
621+ if ( this . _cssState ) {
622+ this . _cancelAllAnimations ( ) ;
623+ }
618624 }
619625
620626 public _setupUI ( context : android . content . Context , atIndex ?: number , parentIsLoaded ?: boolean ) {
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ if (application.hasLaunched()) {
8686}
8787
8888export class CssState {
89+ private _pendingKeyframeAnimations : SelectorCore [ ] ;
90+
8991 constructor ( private view : ViewBase , private match : SelectorsMatch < ViewBase > ) {
9092 }
9193
@@ -103,7 +105,15 @@ export class CssState {
103105 }
104106
105107 matchingSelectors . forEach ( s => this . applyDescriptors ( s . ruleset ) ) ;
106- matchingSelectors . forEach ( s => this . playKeyframeAnimations ( s . ruleset ) ) ;
108+ this . _pendingKeyframeAnimations = matchingSelectors ;
109+ this . playPendingKeyframeAnimations ( ) ;
110+ }
111+
112+ public playPendingKeyframeAnimations ( ) {
113+ if ( this . _pendingKeyframeAnimations && this . view . nativeView ) {
114+ this . _pendingKeyframeAnimations . forEach ( s => this . playKeyframeAnimationsFromRuleSet ( s . ruleset ) ) ;
115+ this . _pendingKeyframeAnimations = null ;
116+ }
107117 }
108118
109119 private applyDescriptors ( ruleset : RuleSet ) : void {
@@ -123,7 +133,7 @@ export class CssState {
123133 } ) ;
124134 }
125135
126- private playKeyframeAnimations ( ruleset : RuleSet ) : void {
136+ private playKeyframeAnimationsFromRuleSet ( ruleset : RuleSet ) : void {
127137 let ruleAnimations : kam . KeyframeAnimationInfo [ ] = ruleset [ animationsSymbol ] ;
128138 if ( ruleAnimations ) {
129139 ensureKeyframeAnimationModule ( ) ;
You can’t perform that action at this time.
0 commit comments