mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-25 20:09:12 +00:00
Fix Polygon and Polyline
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
||||
import React, {Component, PropTypes} from 'react';
|
||||
import Path from './Path';
|
||||
import {pathProps} from '../lib/props';
|
||||
import extractPolyPoints from '../lib/extract/extractPolyPoints';
|
||||
|
||||
export default class extends Component{
|
||||
static displayName = 'Polygon';
|
||||
@@ -26,7 +27,7 @@ export default class extends Component{
|
||||
return <Path
|
||||
ref={ele => {this.root = ele;}}
|
||||
{...this.props}
|
||||
d={`M${points.trim().replace(/\s+/g, 'L')}z`}
|
||||
d={`M${extractPolyPoints(points)}z`}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, {Component, PropTypes} from 'react';
|
||||
import Path from './Path';
|
||||
import {pathProps} from '../lib/props';
|
||||
import extractPolyPoints from '../lib/extract/extractPolyPoints';
|
||||
|
||||
export default class extends Component{
|
||||
static displayName = 'Polyline';
|
||||
@@ -26,7 +27,7 @@ export default class extends Component{
|
||||
return <Path
|
||||
ref={ele => {this.root = ele;}}
|
||||
{...this.props}
|
||||
d={`M${points.trim().replace(/\s+/g, 'L')}`}
|
||||
d={`M${extractPolyPoints(points)}`}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
export default function (polyPoints) {
|
||||
return polyPoints.replace(/-/, ' -').split(/(?:\s+|\s*,)\s*/g).join(' ');
|
||||
}
|
||||
Reference in New Issue
Block a user