mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 23:54:53 +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:
@@ -7,9 +7,7 @@ const pack = require('../package.json');
|
|||||||
|
|
||||||
const root = path.resolve(__dirname, '..');
|
const root = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
const modules = [
|
const modules = [...Object.keys(pack.peerDependencies)];
|
||||||
...Object.keys(pack.peerDependencies),
|
|
||||||
];
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
projectRoot: __dirname,
|
projectRoot: __dirname,
|
||||||
@@ -20,8 +18,7 @@ module.exports = {
|
|||||||
resolver: {
|
resolver: {
|
||||||
blacklistRE: exclusionList(
|
blacklistRE: exclusionList(
|
||||||
modules.map(
|
modules.map(
|
||||||
(m) =>
|
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
|
||||||
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -39,4 +36,4 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -253,6 +253,9 @@ using namespace facebook::react;
|
|||||||
- (void)drawToContext:(CGContextRef)context withRect:(CGRect)rect
|
- (void)drawToContext:(CGContextRef)context withRect:(CGRect)rect
|
||||||
{
|
{
|
||||||
rendered = true;
|
rendered = true;
|
||||||
|
_clipPaths = nil;
|
||||||
|
_templates = nil;
|
||||||
|
_painters = nil;
|
||||||
self.initialCTM = CGContextGetCTM(context);
|
self.initialCTM = CGContextGetCTM(context);
|
||||||
self.invInitialCTM = CGAffineTransformInvert(self.initialCTM);
|
self.invInitialCTM = CGAffineTransformInvert(self.initialCTM);
|
||||||
if (self.align) {
|
if (self.align) {
|
||||||
@@ -264,10 +267,14 @@ using namespace facebook::react;
|
|||||||
_viewBoxTransform = CGAffineTransformIdentity;
|
_viewBoxTransform = CGAffineTransformIdentity;
|
||||||
_invviewBoxTransform = CGAffineTransformIdentity;
|
_invviewBoxTransform = CGAffineTransformIdentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RNSVGView *node in self.subviews) {
|
for (RNSVGView *node in self.subviews) {
|
||||||
if ([node isKindOfClass:[RNSVGNode class]]) {
|
if ([node isKindOfClass:[RNSVGNode class]]) {
|
||||||
RNSVGNode *svg = (RNSVGNode *)node;
|
RNSVGNode *svg = (RNSVGNode *)node;
|
||||||
|
if (svg.responsible && !self.responsible) {
|
||||||
|
self.responsible = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
[svg parseReference];
|
||||||
[svg renderTo:context rect:rect];
|
[svg renderTo:context rect:rect];
|
||||||
} else {
|
} else {
|
||||||
[node drawRect:rect];
|
[node drawRect:rect];
|
||||||
@@ -281,24 +288,9 @@ using namespace facebook::react;
|
|||||||
if ([parent isKindOfClass:[RNSVGNode class]]) {
|
if ([parent isKindOfClass:[RNSVGNode class]]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rendered = true;
|
|
||||||
_clipPaths = nil;
|
|
||||||
_templates = nil;
|
|
||||||
_painters = nil;
|
|
||||||
_boundingBox = rect;
|
_boundingBox = rect;
|
||||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
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];
|
[self drawToContext:context withRect:rect];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user