How to use the react-native-svg.default function in react-native-svg

To help you get started, we’ve selected a few react-native-svg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jayeszee / rn-draw / src / config.js View on Github external
const Svg = exports.Svg = require('expo') ? require('expo').Svg : require('react-native-svg').default
github souporserious / unicon / packages / unicon-react / src / react-native.js View on Github external
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,
  )
}