mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-09 17:30:58 +00:00
Add examples and refactor code
Add examples and refactor code
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user