@@ -1600,7 +1600,6 @@ - (void)animateLayoutTransition:(id<ASContextTransitioning>)context
16001600 NSAssert (node.isNodeLoaded == YES , @" Invalid node state" );
16011601
16021602 NSArray <ASDisplayNode *> *removedSubnodes = [context removedSubnodes ];
1603- NSMutableArray <UIView *> *removedViews = [NSMutableArray array ];
16041603 NSMutableArray <ASDisplayNode *> *insertedSubnodes = [[context insertedSubnodes ] mutableCopy ];
16051604 NSMutableArray <ASDisplayNode *> *movedSubnodes = [NSMutableArray array ];
16061605
@@ -1613,15 +1612,6 @@ - (void)animateLayoutTransition:(id<ASContextTransitioning>)context
16131612 CGRect fromFrame = [context initialFrameForNode: subnode];
16141613 CGRect toFrame = [context finalFrameForNode: subnode];
16151614 if (CGSizeEqualToSize (fromFrame.size , toFrame.size ) == NO ) {
1616- // To crossfade resized subnodes, show a snapshot of it on top.
1617- // The node itself can then be treated as a newly-inserted one.
1618- UIView *snapshotView = [subnode.view snapshotViewAfterScreenUpdates: YES ];
1619- snapshotView.frame = [context initialFrameForNode: subnode];
1620- snapshotView.alpha = 1 ;
1621-
1622- [node.view insertSubview: snapshotView aboveSubview: subnode.view];
1623- [removedViews addObject: snapshotView];
1624-
16251615 [insertedSubnodes addObject: subnode];
16261616 }
16271617 if (CGPointEqualToPoint (fromFrame.origin , toFrame.origin ) == NO ) {
@@ -1643,15 +1633,16 @@ - (void)animateLayoutTransition:(id<ASContextTransitioning>)context
16431633 insertedSubnode.frame = [context finalFrameForNode: insertedSubnode];
16441634 insertedSubnode.alpha = 0 ;
16451635 }
1636+
1637+ // Adjust groupOpacity for animation
1638+ BOOL originAllowsGroupOpacity = node.allowsGroupOpacity ;
1639+ node.allowsGroupOpacity = YES ;
16461640
16471641 [UIView animateWithDuration: self .defaultLayoutTransitionDuration delay: self .defaultLayoutTransitionDelay options: self .defaultLayoutTransitionOptions animations: ^{
16481642 // Fade removed subnodes and views out
16491643 for (ASDisplayNode *removedSubnode in removedSubnodes) {
16501644 removedSubnode.alpha = 0 ;
16511645 }
1652- for (UIView *removedView in removedViews) {
1653- removedView.alpha = 0 ;
1654- }
16551646
16561647 // Fade inserted subnodes in
16571648 for (_ASAnimatedTransitionContext *insertedSubnodeContext in insertedSubnodeContexts) {
@@ -1674,9 +1665,10 @@ - (void)animateLayoutTransition:(id<ASContextTransitioning>)context
16741665 for (_ASAnimatedTransitionContext *removedSubnodeContext in removedSubnodeContexts) {
16751666 removedSubnodeContext.node .alpha = removedSubnodeContext.alpha ;
16761667 }
1677- for (UIView *removedView in removedViews) {
1678- [removedView removeFromSuperview ];
1679- }
1668+
1669+ // Restore group opacity
1670+ node.allowsGroupOpacity = originAllowsGroupOpacity;
1671+
16801672 // Subnode removals are automatically performed
16811673 [context completeTransition: finished];
16821674 }];
0 commit comments