UNPKG

react-native-svg

Version:
27 lines (22 loc) 703 B
import extractBrush from "./extractBrush"; import extractOpacity from "./extractOpacity"; const fillRules = { evenodd: 0, nonzero: 1, }; const fillProps = ["fill", "fillOpacity", "fillRule"]; const numFillProps = fillProps.length; export default function extractFill(props, styleProperties) { for (let i = 0; i < numFillProps; i++) { const name = fillProps[i]; if (props.hasOwnProperty(name)) { styleProperties.push(name); } } return { // default fill is black fill: extractBrush(props.fill || "#000"), fillOpacity: extractOpacity(props.fillOpacity), fillRule: fillRules[props.fillRule] === 0 ? 0 : 1, }; }