diff --git a/apple/RNSVGNode.mm b/apple/RNSVGNode.mm index 444f54179..6dfa3a125 100644 --- a/apple/RNSVGNode.mm +++ b/apple/RNSVGNode.mm @@ -248,6 +248,16 @@ - (void)setMatrix:(CGAffineTransform)matrix } } +- (void)setTransforms:(CGAffineTransform)transforms +{ + if (CGAffineTransformEqualToTransform(transforms, _transforms)) { + return; + } + + _transforms = transforms; + [self invalidate]; +} + - (void)setClientRect:(CGRect)clientRect { if (CGRectEqualToRect(_clientRect, clientRect)) { diff --git a/apple/Utils/RNSVGFabricConversions.h b/apple/Utils/RNSVGFabricConversions.h index cf625ac40..ffdb06997 100644 --- a/apple/Utils/RNSVGFabricConversions.h +++ b/apple/Utils/RNSVGFabricConversions.h @@ -55,6 +55,8 @@ static id RNSVGConvertFollyDynamicToId(const folly::dynamic &dyn) } } +static const facebook::react::LayoutMetrics MinimalLayoutMetrics = {{{0, 0}, {1, 1}}}; + template void setCommonNodeProps(const T &nodeProps, RNSVGNode *node) { @@ -69,7 +71,8 @@ void setCommonNodeProps(const T &nodeProps, RNSVGNode *node) nodeProps.matrix.at(4), nodeProps.matrix.at(5)); } - CATransform3D transform3d = RCTCATransform3DFromTransformMatrix(nodeProps.transform); + auto newTransform = nodeProps.resolveTransform(MinimalLayoutMetrics); + CATransform3D transform3d = RCTCATransform3DFromTransformMatrix(newTransform); CGAffineTransform transform = CATransform3DGetAffineTransform(transform3d); node.invTransform = CGAffineTransformInvert(transform); node.transforms = transform; diff --git a/apple/ViewManagers/RNSVGNodeManager.mm b/apple/ViewManagers/RNSVGNodeManager.mm index 0535eebce..7a483687c 100644 --- a/apple/ViewManagers/RNSVGNodeManager.mm +++ b/apple/ViewManagers/RNSVGNodeManager.mm @@ -34,7 +34,6 @@ - (RNSVGPlatformView *)view CGAffineTransform transform = CATransform3DGetAffineTransform(transform3d); view.invTransform = CGAffineTransformInvert(transform); view.transforms = transform; - [view invalidate]; } RCT_EXPORT_VIEW_PROPERTY(mask, NSString) RCT_EXPORT_VIEW_PROPERTY(markerStart, NSString)