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
+37
View File
@@ -0,0 +1,37 @@
import React, {
ART,
Component,
PropTypes
} from 'react-native';
let {
Shape
} = ART;
import fillFilter from '../lib/fillFilter';
import strokeFilter from '../lib/strokeFilter';
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
class Path extends Component{
static displayName = 'Path';
static propTypes = {
d: PropTypes.string,
x: propType,
y: propType,
strokeLinecap: PropTypes.oneOf(['butt', 'square', 'round']),
strokeCap: PropTypes.oneOf(['butt', 'square', 'round']),
strokeLinejoin: PropTypes.oneOf(['miter', 'bevel', 'round']),
strokeJoin: PropTypes.oneOf(['miter', 'bevel', 'round'])
};
render() {
let {props} = this;
return <Shape
{...props}
strokeCap={props.strokeLinecap || props.strokeCap || 'square'}
strokeJoin={props.strokeLinejoin || props.strokeJoin || 'miter'}
fill={fillFilter(props)}
stroke={strokeFilter(props)}
/>;
}
}
export default Path;