diff --git a/Example/examples/Ellipse.js b/Example/examples/Ellipse.js
index 315f3647..9391d57e 100644
--- a/Example/examples/Ellipse.js
+++ b/Example/examples/Ellipse.js
@@ -11,13 +11,13 @@ class EllipseExample extends Component{
render() {
return ;
-const samples = [SvgExample, SvgOpacity, SvgViewbox];
+const samples = [SvgExample, SvgOpacity, SvgViewbox, SvgLayout];
export {
icon,
diff --git a/elements/Svg.js b/elements/Svg.js
index 58abee1b..45d2943c 100644
--- a/elements/Svg.js
+++ b/elements/Svg.js
@@ -42,25 +42,29 @@ class Svg extends Component{
};
measureInWindow = (...args) => {
- this.refs.root.measureInWindow(...args);
+ this.root.measureInWindow(...args);
};
measure = (...args) => {
- this.refs.root.measure(...args);
+ this.root.measure(...args);
};
measureLayout = (...args) => {
- this.refs.root.measureLayout(...args);
+ this.root.measureLayout(...args);
};
setNativeProps = (...args) => {
- this.refs.root.setNativeProps(...args);
+ this.root.setNativeProps(...args);
};
render() {
let {props} = this;
let opacity = +props.opacity;
- let content = props.viewbox ? : this.getChildren();
- let width = +props.width || 0;
- let height = +props.height || 0;
-
return (
this.root = ele}
style={[
props.style,
!isNaN(opacity) && {
opacity
},
- {width, height}
+ !flexLayout && {
+ width,
+ height
+ }
]}
>
{content}
diff --git a/ios/RNSVGShape.m b/ios/RNSVGShape.m
index 4c66ad89..38702d32 100644
--- a/ios/RNSVGShape.m
+++ b/ios/RNSVGShape.m
@@ -52,7 +52,7 @@
// draw ellipse
CGFloat cx = [self getActualProp:@"cx" relative:width];
CGFloat cy = [self getActualProp:@"cy" relative:height];
- CGFloat rx = [self getActualProp:@"rx" relative:height];
+ CGFloat rx = [self getActualProp:@"rx" relative:width];
CGFloat ry = [self getActualProp:@"ry" relative:height];
CGPathAddEllipseInRect(path, nil, CGRectMake(cx - rx, cy - ry, rx * 2, ry * 2));
break;
@@ -60,9 +60,9 @@
case 2:
{
// draw line
- CGFloat x1 = [self getActualProp:@"x1" relative:height];
+ CGFloat x1 = [self getActualProp:@"x1" relative:width];
CGFloat y1 = [self getActualProp:@"y1" relative:height];
- CGFloat x2 = [self getActualProp:@"x2" relative:height];
+ CGFloat x2 = [self getActualProp:@"x2" relative:width];
CGFloat y2 = [self getActualProp:@"y2" relative:height];
CGPathMoveToPoint(path, nil, x1, y1);
CGPathAddLineToPoint(path, nil, x2, y2);
diff --git a/ios/RNSVGSvgView.h b/ios/RNSVGSvgView.h
index b33f7287..bbf6460c 100644
--- a/ios/RNSVGSvgView.h
+++ b/ios/RNSVGSvgView.h
@@ -11,5 +11,4 @@
#import "RNSVGContainer.h"
@interface RNSVGSvgView : UIView
-
@end
diff --git a/ios/RNSVGSvgView.m b/ios/RNSVGSvgView.m
index 053b84c9..b5bbbe6e 100644
--- a/ios/RNSVGSvgView.m
+++ b/ios/RNSVGSvgView.m
@@ -15,20 +15,20 @@
- (void)invalidate
{
- [self setNeedsDisplay];
+ [self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect
{
- CGContextRef context = UIGraphicsGetCurrentContext();
- for (RNSVGNode *node in self.subviews) {
- [node renderTo:context];
- }
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ for (RNSVGNode *node in self.subviews) {
+ [node renderTo:context];
+ }
}
- (void)reactSetInheritedBackgroundColor:(UIColor *)inheritedBackgroundColor
{
- self.backgroundColor = inheritedBackgroundColor;
+ self.backgroundColor = inheritedBackgroundColor;
}
@end
diff --git a/ios/ViewManagers/RNSVGSvgViewManager.m b/ios/ViewManagers/RNSVGSvgViewManager.m
index 0b6a59f3..668ae5e8 100644
--- a/ios/ViewManagers/RNSVGSvgViewManager.m
+++ b/ios/ViewManagers/RNSVGSvgViewManager.m
@@ -16,7 +16,7 @@ RCT_EXPORT_MODULE()
- (UIView *)view
{
- return [RNSVGSvgView new];
+ return [RNSVGSvgView new];
}
@end