Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Svg = exports.Svg = require('expo') ? require('expo').Svg : require('react-native-svg').default
function Graphic({ children, source, scale = 1, ...restProps }) {
const internalProps = {}
const childrenToRender = Children.toArray(source.children.map(renderChildren))
if (scale === 'auto') {
internalProps.preserveAspectRatio = 'xMinYMin meet'
internalProps.shapeRendering = 'crispEdges'
} else {
internalProps.width = source.width * scale
internalProps.height = source.height * scale
}
return createElement(
Svg.default,
{
viewBox: `0 0 ${source.width} ${source.height}`,
...source.props,
...internalProps,
...restProps,
},
typeof children === 'function'
? children(childrenToRender)
: childrenToRender,
)
}