iOS: fix when doAnimation cause flush

This commit is contained in:
pengfei.zhou 2022-07-21 16:53:32 +08:00 committed by osborn
parent 7684eaa896
commit 7bfa542479

View File

@ -566,6 +566,7 @@ - (void)doAnimation:(id)params withPromise:(DoricPromise *)promise {
originDelegate.endBlock(callback); originDelegate.endBlock(callback);
} }
[self transformProperties]; [self transformProperties];
[self.view.layer removeAnimationForKey:params[@"id"]];
[promise resolve:self.transformation]; [promise resolve:self.transformation];
}; };
it.cancelBlock = ^{ it.cancelBlock = ^{
@ -582,7 +583,7 @@ - (void)doAnimation:(id)params withPromise:(DoricPromise *)promise {
if (params[@"delay"]) { if (params[@"delay"]) {
animation.beginTime = CACurrentMediaTime() + [params[@"delay"] floatValue] / 1000; animation.beginTime = CACurrentMediaTime() + [params[@"delay"] floatValue] / 1000;
} }
animation.removedOnCompletion = YES; animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards; animation.fillMode = kCAFillModeForwards;
if (animation.duration == 0) { if (animation.duration == 0) {
animation.duration = FLT_MIN; animation.duration = FLT_MIN;