mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 01:43:14 +08:00
fix(android): RootLayout shade cover blinking animation (#10750)
This commit is contained in:

committed by
GitHub

parent
a11ccd8753
commit
242c3ae03f
@ -76,10 +76,10 @@ export class RootLayout extends RootLayoutBase {
|
||||
return this._playAnimation(this._getAnimationSet(view, exitState), exitState?.duration);
|
||||
}
|
||||
|
||||
private _getAnimationSet(view: View, shadeCoverAnimation: TransitionAnimation, backgroundColor: string = defaultShadeCoverOptions.color): Array<android.animation.Animator> {
|
||||
private _getAnimationSet(view: View, shadeCoverAnimation: TransitionAnimation, backgroundColor?: string): Array<android.animation.Animator> {
|
||||
const isBackgroundGradient = backgroundColor && backgroundColor.startsWith('linear-gradient');
|
||||
|
||||
const animationSet = Array.create(android.animation.Animator, isBackgroundGradient ? 6 : 7);
|
||||
const animationSet = Array.create(android.animation.Animator, !backgroundColor || isBackgroundGradient ? 6 : 7);
|
||||
animationSet[0] = android.animation.ObjectAnimator.ofFloat(view.nativeViewProtected, 'translationX', [shadeCoverAnimation.translateX]);
|
||||
animationSet[1] = android.animation.ObjectAnimator.ofFloat(view.nativeViewProtected, 'translationY', [shadeCoverAnimation.translateY]);
|
||||
animationSet[2] = android.animation.ObjectAnimator.ofFloat(view.nativeViewProtected, 'scaleX', [shadeCoverAnimation.scaleX]);
|
||||
@ -97,7 +97,10 @@ export class RootLayout extends RootLayoutBase {
|
||||
if (view.backgroundImage) {
|
||||
view.backgroundImage = undefined;
|
||||
}
|
||||
animationSet[6] = this._getBackgroundColorAnimator(view, backgroundColor);
|
||||
|
||||
if (backgroundColor) {
|
||||
animationSet[6] = this._getBackgroundColorAnimator(view, backgroundColor);
|
||||
}
|
||||
}
|
||||
return animationSet;
|
||||
}
|
||||
|
Reference in New Issue
Block a user