mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 22:05:14 +00:00
refactor all components and isolated from ART dependency
This commit is contained in:
28
lib/extractProps.js
Normal file
28
lib/extractProps.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import extractFill from './extractFill';
|
||||
import extractStroke from './extractStroke';
|
||||
import extractTransform from './extractTransform';
|
||||
|
||||
export default function(props, options = {stroke: true, join: true, transform: true, fill: true}) {
|
||||
if (props.visible === false) {
|
||||
return {
|
||||
opacity: 0
|
||||
}
|
||||
}
|
||||
let extractedProps = {
|
||||
opacity: +props.opacity || 1
|
||||
};
|
||||
|
||||
if (options.stroke) {
|
||||
Object.assign(extractedProps, extractStroke(props));
|
||||
}
|
||||
|
||||
if (options.fill) {
|
||||
extractedProps.fill = extractFill.call(this, props);
|
||||
}
|
||||
|
||||
if (options.transform) {
|
||||
extractedProps.transform = extractTransform(props);
|
||||
}
|
||||
|
||||
return extractedProps;
|
||||
}
|
||||
Reference in New Issue
Block a user