diff --git a/iOS/Pod/Classes/Shader/DoricViewNode.m b/iOS/Pod/Classes/Shader/DoricViewNode.m index 381b52ba..b78cb759 100644 --- a/iOS/Pod/Classes/Shader/DoricViewNode.m +++ b/iOS/Pod/Classes/Shader/DoricViewNode.m @@ -66,6 +66,17 @@ CGPathRef DoricCreateRoundedRectPath(CGRect bounds, return path; } +@interface AnimationCallback : NSObject +@property(nonatomic, strong) void (^endBlock)(); +@end + +@implementation AnimationCallback +- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag { + if (self.endBlock) { + self.endBlock(); + } +} +@end @interface DoricViewNode () @property(nonatomic, strong) NSMutableDictionary *callbackIds; @@ -314,6 +325,12 @@ - (void)doAnimation:(id)params withPromise:(DoricPromise *)promise { CAAnimation *animation = [self parseAnimation:params]; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeForwards; + AnimationCallback *animationCallback = [[AnimationCallback new] also:^(AnimationCallback *it) { + it.endBlock = ^{ + [promise resolve:nil]; + }; + }]; + animation.delegate = animationCallback; [self.view.layer addAnimation:animation forKey:nil]; }