diff --git a/ios/sdk/module/animation2/HippyNextAnimationModule.m b/ios/sdk/module/animation2/HippyNextAnimationModule.m index fa0fec3ca36..f3239b207d1 100644 --- a/ios/sdk/module/animation2/HippyNextAnimationModule.m +++ b/ios/sdk/module/animation2/HippyNextAnimationModule.m @@ -464,14 +464,25 @@ - (void)animatorDidAnimate:(HPOPAnimator *)animator inCustomQueue:(dispatch_queu NSMutableArray *pendingAnims = [strongSelf.pendingStartGroupAnimations objectForKey:queueKey]; [strongSelf.groupAnimSyncLock unlock]; + NSMutableArray *resultAnims = nil; NSMutableArray *targetObjects = [NSMutableArray arrayWithCapacity:pendingAnims.count]; CFTimeInterval now = CACurrentMediaTime(); for (HippyNextAnimation *anim in pendingAnims) { + id target = anim.targetObject; + if (!target) { + if (!resultAnims) { + // only copy when needed + resultAnims = [pendingAnims mutableCopy]; + } + [resultAnims removeObject:anim]; + continue; + } anim.beginTime = now + anim.delayTime; - [targetObjects addObject:anim.targetObject]; + [targetObjects addObject:target]; } - [[HPOPAnimator sharedAnimator] addAnimations:pendingAnims forObjects:targetObjects andKeys:nil]; + [[HPOPAnimator sharedAnimator] addAnimations:resultAnims ?: pendingAnims + forObjects:targetObjects andKeys:nil]; [pendingAnims removeAllObjects]; }); }