mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
Fix CSS animations for elements that have not been loaded yet.
- Always apply animations even if it happens before the loaded event. - Add an extra check for Android LinearInterpolator to get rid of a curve resolution crash.
This commit is contained in:

committed by
Hristo Deshev

parent
b902aeae10
commit
b89951845b
@ -35,7 +35,7 @@ propertyKeys[Properties.rotate] = Symbol(keyPrefix + Properties.rotate);
|
|||||||
propertyKeys[Properties.scale] = Symbol(keyPrefix + Properties.scale);
|
propertyKeys[Properties.scale] = Symbol(keyPrefix + Properties.scale);
|
||||||
propertyKeys[Properties.translate] = Symbol(keyPrefix + Properties.translate);
|
propertyKeys[Properties.translate] = Symbol(keyPrefix + Properties.translate);
|
||||||
|
|
||||||
export function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve | android.view.animation.Interpolator): android.view.animation.Interpolator {
|
export function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve | android.view.animation.Interpolator | android.view.animation.LinearInterpolator): android.view.animation.Interpolator {
|
||||||
switch (curve) {
|
switch (curve) {
|
||||||
case "easeIn":
|
case "easeIn":
|
||||||
if (traceEnabled()) {
|
if (traceEnabled()) {
|
||||||
@ -70,11 +70,11 @@ export function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve
|
|||||||
}
|
}
|
||||||
if (curve instanceof CubicBezierAnimationCurve) {
|
if (curve instanceof CubicBezierAnimationCurve) {
|
||||||
return (<any>android).support.v4.view.animation.PathInterpolatorCompat.create(curve.x1, curve.y1, curve.x2, curve.y2);
|
return (<any>android).support.v4.view.animation.PathInterpolatorCompat.create(curve.x1, curve.y1, curve.x2, curve.y2);
|
||||||
}
|
} else if (curve instanceof android.view.animation.Interpolator) {
|
||||||
else if (curve instanceof android.view.animation.Interpolator) {
|
|
||||||
return curve;
|
return curve;
|
||||||
}
|
} else if ((<any>curve) instanceof android.view.animation.LinearInterpolator) {
|
||||||
else {
|
return <android.view.animation.Interpolator><any>curve;
|
||||||
|
} else {
|
||||||
throw new Error(`Invalid animation curve: ${curve}`);
|
throw new Error(`Invalid animation curve: ${curve}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ export class CssState {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let ruleAnimations: kam.KeyframeAnimationInfo[] = ruleset[animationsSymbol];
|
let ruleAnimations: kam.KeyframeAnimationInfo[] = ruleset[animationsSymbol];
|
||||||
if (ruleAnimations && view.isLoaded && view.nativeView !== undefined) {
|
if (ruleAnimations) {
|
||||||
ensureKeyframeAnimationModule();
|
ensureKeyframeAnimationModule();
|
||||||
for (let animationInfo of ruleAnimations) {
|
for (let animationInfo of ruleAnimations) {
|
||||||
let animation = keyframeAnimationModule.KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
let animation = keyframeAnimationModule.KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
||||||
|
Reference in New Issue
Block a user