Add examples and refactor code

Add examples and refactor code
This commit is contained in:
Horcrux
2016-01-21 23:44:38 +08:00
parent 89b52fd4a2
commit a482948b83
61 changed files with 3143 additions and 105 deletions

View File

@@ -0,0 +1,83 @@
import React, {
Component
} from 'react-native';
import Svg, {
Polygon,
Group
} from 'react-native-art-svg';
class PolygonExample extends Component{
static title = 'The following example creates a polygon with three sides';
render() {
return <Svg
height="100"
width="100"
>
<Polygon
points="40,5 70,80 25,95"
fill="lime"
stroke="purple"
strokeWidth="1"
/>
</Svg>;
}
}
class FourSidePolygon extends Component{
static title = 'The following example creates a polygon with four sides';
render() {
return <Svg
height="100"
width="100"
>
<Polygon
points="70,5 90,75 45,90 25,80"
fill="lime"
stroke="purple"
strokeWidth="1"
/>
</Svg>;
}
}
class StrarPolygon extends Component{
static title = 'Use the <Polygon /> element to create a star';
render() {
return <Svg
height="105"
width="105"
>
<Group scale="0.5">
<Polygon
points="100,10 40,198 190,78 10,78 160,198"
fill="lime"
stroke="purple"
strokeWidth="5"
/>
</Group>
</Svg>;
}
}
const icon = <Svg
height="20"
width="20"
>
<Group scale="0.1">
<Polygon
points="100,10 40,198 190,78 10,78 160,198"
fill="lime"
stroke="purple"
strokeWidth="10"
/>
</Group>
</Svg>;
const samples = [PolygonExample, FourSidePolygon, StrarPolygon];
export {
icon,
samples
}