mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
fix(ios): animation layer resilience (#10060)
This commit is contained in:
@ -439,30 +439,30 @@ export class Animation extends AnimationBase {
|
|||||||
|
|
||||||
private static _createNativeAnimation(propertyAnimations: Array<PropertyAnimation>, index: number, playSequentially: boolean, args: AnimationInfo, animation: PropertyAnimation, valueSource: 'animation' | 'keyframe', finishedCallback: (cancelled?: boolean) => void) {
|
private static _createNativeAnimation(propertyAnimations: Array<PropertyAnimation>, index: number, playSequentially: boolean, args: AnimationInfo, animation: PropertyAnimation, valueSource: 'animation' | 'keyframe', finishedCallback: (cancelled?: boolean) => void) {
|
||||||
const nativeView = <UIView>animation.target.nativeViewProtected;
|
const nativeView = <UIView>animation.target.nativeViewProtected;
|
||||||
|
|
||||||
|
let nativeAnimation;
|
||||||
|
|
||||||
|
if (args.subPropertiesToAnimate) {
|
||||||
|
nativeAnimation = this._createGroupAnimation(args, animation);
|
||||||
|
} else {
|
||||||
|
nativeAnimation = this._createBasicAnimation(args, animation);
|
||||||
|
}
|
||||||
|
|
||||||
|
const animationDelegate = AnimationDelegateImpl.initWithFinishedCallback(finishedCallback, animation, valueSource);
|
||||||
|
nativeAnimation.setValueForKey(animationDelegate, 'delegate');
|
||||||
if (nativeView?.layer) {
|
if (nativeView?.layer) {
|
||||||
let nativeAnimation;
|
|
||||||
|
|
||||||
if (args.subPropertiesToAnimate) {
|
|
||||||
nativeAnimation = this._createGroupAnimation(args, animation);
|
|
||||||
} else {
|
|
||||||
nativeAnimation = this._createBasicAnimation(args, animation);
|
|
||||||
}
|
|
||||||
|
|
||||||
const animationDelegate = AnimationDelegateImpl.initWithFinishedCallback(finishedCallback, animation, valueSource);
|
|
||||||
nativeAnimation.setValueForKey(animationDelegate, 'delegate');
|
|
||||||
|
|
||||||
nativeView.layer.addAnimationForKey(nativeAnimation, args.propertyNameToAnimate);
|
nativeView.layer.addAnimationForKey(nativeAnimation, args.propertyNameToAnimate);
|
||||||
|
}
|
||||||
let callback = undefined;
|
let callback = undefined;
|
||||||
if (index + 1 < propertyAnimations.length) {
|
if (index + 1 < propertyAnimations.length) {
|
||||||
callback = Animation._createiOSAnimationFunction(propertyAnimations, index + 1, playSequentially, valueSource, finishedCallback);
|
callback = Animation._createiOSAnimationFunction(propertyAnimations, index + 1, playSequentially, valueSource, finishedCallback);
|
||||||
if (!playSequentially) {
|
if (!playSequentially) {
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
animationDelegate.nextAnimation = callback;
|
animationDelegate.nextAnimation = callback;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _createGroupAnimation(args: AnimationInfo, animation: PropertyAnimation) {
|
private static _createGroupAnimation(args: AnimationInfo, animation: PropertyAnimation) {
|
||||||
|
Reference in New Issue
Block a user