mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-01 14:15:03 +00:00
PR making the nested svgs parse the references. Originally authored by @tiredBlueWhale. Co-authored-by: Luca Meyer <lmeyer@Lucas-MacBook-Pro.local>
This commit is contained in:
@@ -253,6 +253,9 @@ using namespace facebook::react;
|
||||
- (void)drawToContext:(CGContextRef)context withRect:(CGRect)rect
|
||||
{
|
||||
rendered = true;
|
||||
_clipPaths = nil;
|
||||
_templates = nil;
|
||||
_painters = nil;
|
||||
self.initialCTM = CGContextGetCTM(context);
|
||||
self.invInitialCTM = CGAffineTransformInvert(self.initialCTM);
|
||||
if (self.align) {
|
||||
@@ -264,10 +267,14 @@ using namespace facebook::react;
|
||||
_viewBoxTransform = CGAffineTransformIdentity;
|
||||
_invviewBoxTransform = CGAffineTransformIdentity;
|
||||
}
|
||||
|
||||
for (RNSVGView *node in self.subviews) {
|
||||
if ([node isKindOfClass:[RNSVGNode class]]) {
|
||||
RNSVGNode *svg = (RNSVGNode *)node;
|
||||
if (svg.responsible && !self.responsible) {
|
||||
self.responsible = YES;
|
||||
}
|
||||
|
||||
[svg parseReference];
|
||||
[svg renderTo:context rect:rect];
|
||||
} else {
|
||||
[node drawRect:rect];
|
||||
@@ -281,24 +288,9 @@ using namespace facebook::react;
|
||||
if ([parent isKindOfClass:[RNSVGNode class]]) {
|
||||
return;
|
||||
}
|
||||
rendered = true;
|
||||
_clipPaths = nil;
|
||||
_templates = nil;
|
||||
_painters = nil;
|
||||
_boundingBox = rect;
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
for (RNSVGPlatformView *node in self.subviews) {
|
||||
if ([node isKindOfClass:[RNSVGNode class]]) {
|
||||
RNSVGNode *svg = (RNSVGNode *)node;
|
||||
if (svg.responsible && !self.responsible) {
|
||||
self.responsible = YES;
|
||||
}
|
||||
|
||||
[svg parseReference];
|
||||
}
|
||||
}
|
||||
|
||||
[self drawToContext:context withRect:rect];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user