diff --git a/ui/animation/animation.android.ts b/ui/animation/animation.android.ts index af86e20eb..f569e5441 100644 --- a/ui/animation/animation.android.ts +++ b/ui/animation/animation.android.ts @@ -32,9 +32,9 @@ export class Animation extends common.Animation implements definition.Animation private _propertyUpdateCallbacks: Array; private _propertyResetCallbacks: Array; private _valueSource: number; - + public play(): definition.AnimationPromise { - var animationFinishedPromise = super.play(); + let animationFinishedPromise = super.play(); let i: number; let length: number; @@ -58,11 +58,13 @@ export class Animation extends common.Animation implements definition.Animation this._animatorSet = new android.animation.AnimatorSet(); this._animatorSet.addListener(this._animatorListener); - if (this._playSequentially) { - this._animatorSet.playSequentially(this._nativeAnimatorsArray); - } - else { - this._animatorSet.playTogether(this._nativeAnimatorsArray); + if (length > 0) { + if (this._playSequentially) { + this._animatorSet.playSequentially(this._nativeAnimatorsArray); + } + else { + this._animatorSet.playTogether(this._nativeAnimatorsArray); + } } trace.write("Starting " + this._nativeAnimatorsArray.length + " animations " + (this._playSequentially ? "sequentially." : "together."), trace.categories.Animation); @@ -127,6 +129,11 @@ export class Animation extends common.Animation implements definition.Animation } private _createAnimators(propertyAnimation: common.PropertyAnimation): void { + + if (!propertyAnimation.target._nativeView) { + return; + } + trace.write("Creating ObjectAnimator(s) for animation: " + common.Animation._getAnimationInfo(propertyAnimation) + "...", trace.categories.Animation); if (types.isNullOrUndefined(propertyAnimation.target)) { diff --git a/ui/styling/css-selector.ts b/ui/styling/css-selector.ts index 43eb4f516..b30bdd5db 100644 --- a/ui/styling/css-selector.ts +++ b/ui/styling/css-selector.ts @@ -88,7 +88,7 @@ export class CssSelector { } } }); - if (this.animations && view.isLoaded) { + if (this.animations && view.isLoaded && view._nativeView !== undefined) { for (let animationInfo of this.animations) { let animation = keyframeAnimation.KeyframeAnimation.keyframeAnimationFromInfo(animationInfo, modifier); if (animation) {