mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-22 15:15:12 +00:00
finish gradients refactor
This commit is contained in:
@@ -1,33 +1,15 @@
|
||||
import rgba from '../rgba';
|
||||
import extractBrush from './extractBrush';
|
||||
import patterns from './patterns';
|
||||
import extractOpacity from './extractOpacity';
|
||||
|
||||
const fillRules = {
|
||||
evenodd: 0,
|
||||
nonzero: 1
|
||||
};
|
||||
|
||||
function fillFilter(props) {
|
||||
let {fill} = props;
|
||||
let fillOpacity = +props.fillOpacity;
|
||||
|
||||
if (fill === 'none') {
|
||||
return null;
|
||||
} else if (fill) {
|
||||
return patterns(fill, fillOpacity);
|
||||
} else if (props.fill === undefined) {
|
||||
return rgba('#000', isNaN(fillOpacity) ? 1 : fillOpacity).rgbaString();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export default function(props) {
|
||||
let fill = extractBrush(fillFilter(props), props);
|
||||
let fillRule = fillRules[props.fillRule] === 0 ? 0 : 1;
|
||||
|
||||
return {
|
||||
fill,
|
||||
fillRule
|
||||
fill: extractBrush(props.fill),
|
||||
fillOpacity: extractOpacity(props.fillOpacity),
|
||||
fillRule: fillRules[props.fillRule] === 0 ? 0 : 1
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user