Skip to content

Commit ffa9aff

Browse files
committed
Look up the bounds animation before touching the mask path
1 parent cbf5bce commit ffa9aff

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

‎packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,10 +1561,8 @@ - (CAShapeLayer *)createMaskLayer:(CGRect)bounds cornerInsets:(RCTCornerInsets)c
15611561
// so the mask does not snap to the final size while the layer is still animating (e.g. during rotation).
15621562
- (void)setMaskLayer:(CAShapeLayer *)maskLayer path:(CGPathRef)path followingBoundsAnimationOfLayer:(CALayer *)layer
15631563
{
1564-
CGPathRef previousPath = maskLayer.path != NULL ? CGPathRetain(maskLayer.path) : NULL;
1565-
maskLayer.path = path;
1566-
15671564
CAAnimation *boundsAnimation = [layer animationForKey:@"bounds.size"];
1565+
CGPathRef previousPath = maskLayer.path;
15681566
if (previousPath != NULL && [boundsAnimation respondsToSelector:@selector(setFromValue:)] &&
15691567
!CGPathEqualToPath(previousPath, path)) {
15701568
CABasicAnimation *pathAnimation = [(CABasicAnimation *)boundsAnimation copy];
@@ -1574,10 +1572,7 @@ - (void)setMaskLayer:(CAShapeLayer *)maskLayer path:(CGPathRef)path followingBou
15741572
pathAnimation.additive = NO;
15751573
[maskLayer addAnimation:pathAnimation forKey:@"path"];
15761574
}
1577-
1578-
if (previousPath != NULL) {
1579-
CGPathRelease(previousPath);
1580-
}
1575+
maskLayer.path = path;
15811576
}
15821577
15831578
- (void)clearExistingBackgroundImageLayers

0 commit comments

Comments
 (0)