mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-19 21:45:10 +00:00
apply common stroke processor to elements
apply common stroke processor to elements
This commit is contained in:
@@ -1,4 +1,17 @@
|
||||
import rgba from './rgba';
|
||||
|
||||
let separator = /\s*,\s*/;
|
||||
export default function (props) {
|
||||
return rgba(props.stroke, props.strokeOpacity);
|
||||
let strokeDasharray = props.strokeDash || props.strokeDasharray;
|
||||
|
||||
if (typeof strokeDasharray === 'string') {
|
||||
strokeDasharray = strokeDasharray.split(separator).map(dash => +dash);
|
||||
}
|
||||
|
||||
return {
|
||||
stroke: rgba(props.stroke, props.strokeOpacity),
|
||||
strokeCap:props.strokeLinecap || props.strokeCap || 'square',
|
||||
strokeJoin:props.strokeLinejoin || props.strokeJoin || 'miter',
|
||||
strokeDash:strokeDasharray
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user