Skip to content

uqmessias/react-native-svg-renderer

 
 

Repository files navigation

react-native-svg-renderer

Render SVG images in React Native from an URL or a static file (fork of react-native-uri).

This was tested with [email protected] and [email protected] (depends on this library) react-native-svg (on NPM)

Not all the svgs can be rendered, if you find problems fill an issue or a PR in order to contemplate all the cases

Install library from npm or yarn

yarn add react-native-svg react-native-svg-renderer

or

npm install react-native-svg react-native-svg-renderer --save

Link library react-native-svg

react-native link react-native-svg # NOT react-native-svg-renderer !!!

Props

Prop Type Default Note
source ImageURISource Same kind of source prop that <Image /> component has
svgXmlData String You can pass the SVG as String directly
fill Color Overrides all fill attributes of the svg file
fillAll Boolean Adds the fill color to the entire svg object

Known Bugs

  • [ANDROID] There is a problem with static SVG file on Android, Works OK in debug mode but fails to load the file in release mode. At the moment the only workaround is to pass the svg content in the svgXmlData prop.

Usage

Here's a simple example:

import SvgRenderer from 'react-native-svg-renderer';

const TestSvgRenderer = () => (
  <View style={styles.container}>
    <SvgRenderer
      width="200"
      height="200"
      source={{uri:'http://thenewcode.com/assets/images/thumbnails/homer-simpson.svg'}}
    />
  </View>
);

or a SVG string

import SvgRenderer from 'react-native-svg-renderer';

const svgCircle = '<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" x="0" y="0" version="1.1" viewBox="0 0 500 500" xml:space="preserve"><path fill="#010101" d="M199.8 107.6c.1 4.9 2.9 15.4 5 20 1.5.4 2-1 3-.7-2.8-4-4.3-14.4-4.3-22.2-.8 1-3.7 2.3-3.7 2.9zm278.3 206c0 29-10.2 53.2-20.3 75-1 1-3 .6-5 .6-2.6 29.5-5 68.7-28 77.1-8.3 3.1-15.7-.8-20.3-6.3-10.2-12-13.3-34.6-17.5-52.5-1.6-1.3-5-.6-7-1.4-6.2-9.9-14.5-34.6.7-40-5.8-7 6.5-14.3 6.3-24.5-17.2 14.1-33.5 35.2-56.8 45.5-4.3 27-10.5 48.8-21 68.7-9.7 18.5-26.6 37.4-51.2 37.9-41.2.8-63-29.3-70.8-64.5-2.1-9.6-6-21.3 2.1-25.2-16.9-11.4-37.5-29.7-39.9-56.8-.9-10-.2-20.4 5.6-25.2 7-1.4 15.1-.4 21.7.7-1.1-9.1-2.7-17.9-3.5-27.4-3.7.8-7.7 4.5-11.9 4.2-4.7-.3-7.6-6-11.2-7-2.7-.6-5.6.6-8.4.7-36.3 1.5-74.5-21.1-84.8-50.4-10.4-5.1-21.1-13.5-18.2-29.5-14.8 7.3-23.3-8.4-14-16.8 5-4.6 14.7-3.1 21 0 3.8-5.8 8.7-10.4 18.9-9.8 0-8.2-5.7-14.2-2.8-23.1C79.2 154 84.3 178.8 87 193c10.9 2.4 18.5 10.5 14.7 25.2 8 3.8 17.4 6 28.8 6.3.3-18.1 20.5-16.3 37.8-17.5 2.7-25.6-5.7-45.8-21-57.4-11.8 4.6-24-6.6-19-19-3.5-3.4-14.1-3.4-20.3-2 2.3 7.5 11.6 8 14.8 14.7-6.8-4-14.2-7.3-16.9-15.5 2.3-3 8.9-1.9 14-2-21.7-15.2-50.3-23.5-58.1-52.6C53.2 68.5 38 48.9 48.5 36c1.2-1.4 3.8-2.6 6.3-3.5C53 16 66.7 6.2 81.4 13c17.1-16.5 55.2-9 69.4 5 4.5-3.6 13-3.4 14.7 2.7C184 12.2 201.7 25 202 43.7c4.3 1.7 7.3 4.8 9 9.1 6.4-2.6 5-10.4 12.7-10.5 14.1 0 12.4 26 3.5 33 3.9 7 1 15.9-8.4 15.4-1 3-1.8 6.2-3.5 8.4-2.8.8-5.2 1.9-9.1 1.4-2 9.5-.4 21.4 4.2 26.6 4-.2 7-.2 9 2.1 1.8 3.4-1.7 6.2 0 9.1 7.8-5 21.7-2.3 15.5 9.2 3-2.3 6.3-4.5 9.1-7 8.1 4 14.3 10 22.4 14 .5 3.7-2 4.4-2.8 7 8.1-6.9 19.7-10.3 33-12a92 92 0 0 1 11.9 10.6c15.2-5.7 34.6-16.6 44.1-33 3-5.2 8-13.5 7-18.2-1.4-7.3-12.3-4.9-17.5-9.8-5.2-13 13.9-14.5 21-9.1 3.4-.9 4.3-4.1 7-5.6-1.5-6-5.2-9.7-4.2-18.2 6.5-12.9 22.1-4.3 23.9 7 15.2-10 23.6 11 9 17.5 3 11.5 19.1 8.4 30.2 8.4 9.8 11.5-5.5 21.1-16.8 22.4-12 15.6-17 35.6-26.6 52.6-9.7 17-21.8 30.4-35.8 42.7 9.8 7 19.3 14.4 27.4 23.2 57.4-12 100.8 20.3 100.9 73.6zm-14 56c6.7-20.3 13-40.3 11.2-64.5-3.1-40.5-37-69.8-82.7-65.8-28 2.4-48.9 18.5-63.8 35.7a184 184 0 0 0-34.3 65.9c-2.3-.5-.5-4-3.5-2.1-21.5 15.2-52 21.5-87 23.1 16.8 23 50.2 35 87.7 33 33-2 58.2-20.2 77-39.3 4-4 18-15.5 19.7-19.6 2.2-5.2-.7-12.2 2.8-15.4 1.9 8.7-1.2 18.4-2.8 25.9 17 16 41.2 24.6 75.7 23.1zm-1.4 2.8c-33.8.9-57.6-8.3-75.7-23.1a31.8 31.8 0 0 1-6.3 12c14.7 18.7 40 30.3 75.7 25.8 1.8-5.1 4.5-9.4 6.3-14.7zm-51.2-253c9.3-1.8 22-6.3 17.5-17.5-9.3-3.3-13.4 2.3-22.4-.7-18-6-15.5-40.5-30.8-40-4.2.2-7.2 4.4-7.7 7-2 10.3 7.7 13 4.9 23.2-1.1-1-1.5-2.7-1.4-5-6.8 3.7-11.2 13.1-9.2 23.2-7.6 27-27.1 42-51.8 51.9 8.3 12.7 14 28 14.7 48.3a70 70 0 0 1 22.4 6.3 170 170 0 0 0 36.5-43.4c9.6-17.3 14.4-38 27.3-53.3zm-14.7-30.8c15-4 5-24-6.3-12.6 2.7 3.5 4 8.6 6.3 12.6zm-37.2 16.1c.2-5.4 2.5-8.8 3.5-13.3-6.2-2-21-5.5-19.6 5.6 3.6 4.4 12.7 3.2 16.1 7.7zm15.5 136.7c-12-13.9-28.3-28.5-51.9-30.2-5.5-.3-14.5 1.3-19-.7 2.4 0 4.4-.3 5.7-1.4-15.7-18.9-36.8-32.4-60.3-43.4 2.6-1.5 5 2.3 8.4 2 1.7-4.3 4.7-7.4 6.3-11.8-6-5-12.5-9.5-19.6-13.3-.1 10.6 4.8 19.9 2.8 30.1-9.1-2.3-15.5-7.4-25.2-9.1-2.3 10.5 4.4 18 7 26-8.8 11.9-23 18.5-36.5 25.8 8.7 7 16.4 15.9 17.6 28.8 2.3 25.1-20 39.4-35 49 1 26.8 7.2 48.4 16.7 66.6 43 .7 76.4-8.2 102.4-24.5 14.6-43.5 37.1-79.2 80.6-94zm-51.9-31.6c.6-20.7-9-44-21.7-54.6-10.9-9-36.3 3.2-41.4 14.7 22.4 8.7 37.6 24.5 53.3 40h9.8zM291 477.6c20.4-19.5 32.2-55.3 35.7-89-22.6 13-68.2 9.5-91.8 0a61.6 61.6 0 0 1-4.2 32.2c-2.4 6.3-4.5 14-9.1 15.4 2.9-8.8 9.7-17.4 9-27.3-18.4 2.5-33 9-41.3 21.7 7.4 32.8 28.7 58.5 63.8 61 17 1.2 29.3-5.9 37.9-14zm-44.9-314c-2-6.1-.5-15.8-4.9-19.6-1.9 4-7 4.6-8.4 9 3.7 4.3 7.5 8.4 13.3 10.6zm.7 7c-1.7-7.6-9.4-9.3-14-14 .6 4-2.6 4.4-2.8 7.7 6.3 1.4 10.6 4.8 16.8 6.3zm-20.3-19c3.2-3.2 8.8-4.2 7.7-11.8-2.8-4-9.7-1.3-12.6.7-4-2.3-5.9-1.6-8.4 2 3.5.7 9.8-1.4 11.2 1.5-5.2 13.4-16.5 22.8-30.9 21-13.4-1.7-26.6-18.7-26.6-33 0-26.8 38.5-34.8 54-51.1 4-4.2 9-10.9 10.5-16.1 2.4-8.3-.4-20.9-8.4-20.4-6.7.5-7.2 10.8-12 12-9.9 26.1-56.3 38.3-46.2 82.7 1 4 4 10.7 7 14.7 5.8 7.4 19.9 18.5 32.3 16.8 8.4-1.2 11.2-12.2 23.8-8.4 1.3-2 3.4-3.1 2.8-7 .8-3.4-4.2-1-4.2-3.5zm5.6 255.2c1.4-5.1.4-12.7.7-19a75.1 75.1 0 0 0-46.3 21.8c0 6.2.8 11.4 2.1 16 9.9-8 23.4-18.6 43.5-18.8zm-7-318.9c2-2.6 4.4-8 0-9.8-13.8 19.8-43.9 23.4-54.7 46.2 8.3 2 7.4-5.2 9.8-9 3.1 1 4.1 0 7.7 0 2.9-1.9 2.5-7 5-9.2 3 .4 5.2-.3 7.7-.7 2.3-1.4 2-5.3 4.2-7 3.7.8 6.9 1 9.8-.7 1.3-2.4 2-5.5 2.8-8.4 3.5.5 5-1 7.7-1.4zm2.8 101a54 54 0 0 1-8.4-25.3c-16.6 11-35 20.1-49.8 33V207c7.8 1.9 15.9 3.3 21.7 7 13.9-6.7 27.4-13.7 36.5-25.2zm-60.3 106.4c18.2-9.5 44-25.3 41.4-51.1-3-27.8-35-43-66.6-31.6 22.5 12.3 33.1 52.7 25.2 82.7zm28.8-222.1c6-5.9 20.5-23.6 7-27.4-14-3.8-20.3 17-28 20.4A25.6 25.6 0 0 1 153.5 97c-35.2 3.4-37.3-53-2.1-51.9-.7-12.8 6.2-18 12-24.5-2-4.7-10.3-2.7-12.7 0a68.8 68.8 0 0 0-35.7-15.4C85.5 2.8 71.8 24.4 64.6 46.5c1 3 5.4 2.6 6.3 5.7-3.4 1-6-5.3-7-2.2-1.9 4.9-2 14.7-.7 20.4 1.1 2.4 5.9 1.1 6.3 4.2-2.5.2-3.4-1.3-5.6-1.4 8.4 28.7 37.3 37 59.6 51.8-2.1-5.8-7.4-8.5-7-16.8 8-3 19 2.2 24.5 6.3-8.2-1-15.2-6.6-23.1-5.6 1.8 8.7 7 14 11.9 19.6 2-3.1 9-8 12.6-4.9-18.3.7-16.2 27.6 1.4 25.3 7.4-1 7.5-10 12.6-12-1.6 4.8-4 8.7-7 12a60.4 60.4 0 0 1 21.7 43.4c10.1-6.3 19.7-13 29.5-19.6-25.3-6.3-41-22.6-38.6-49.8 2.2-24.5 22-37.6 34.4-49.7zm4.2-29.5c1.7-32-50.8-31.5-47.7 1.4 12 1.6 18.2 9 22.4 18.3 8.8-6.3 12.1-17.8 25.3-19.7zM169 286.2c.2-27-5.2-48.5-16.8-63.7-14.4 7-37.3 3.7-51.2-1.4-1.7.8-.8 4.2-4.2 3.5 2.8-8.2 6.6-17.1 1.4-23.9-7.6-9.8-30.6-4.3-28 8.4 2.1 10.5 18.8 3.4 21.7 0-3.6 10-22.8 10.6-23.8-.7-.7-8.4 7.5-13.8 16.8-14.7-3.1-12.9-4.7-34.3-21-29.4-3.7 9.9 6.4 19 2.1 27.3-1.9.2.7-4-2.1-2.8-22.6-5.4-20.2 32.9-6.3 33 11.4 0 6.3-16.3 5.6-23.2 6.8 8.6 5 25.3-5.6 25.3-10.4 0-12.2-14.1-12.6-26-9.7-4-25-3-21.8 12 5 7 16.2-1.7 21 1.3 0 3.3-3.7-1.2-3.4 2.1-3.8 20 13.1 25.2 25.2 31.6-3.1 1.5-6.2-3-6.3 0 15 34 62 55.2 109.3 41.3zm-15.4 5.6c2.6 8.1 14.7 6.3 14.7-2.8l-14.7 2.8zM148 95.6c35.4 3.4 33.9-54.4-1.4-48.4C119.3 52 122 93.1 148 95.6zm2.1 125.5c-2.5-8.2-19.8-12-16.8 3.5 6.8 0 11.8-1.8 16.8-3.5zM68.8 31.8c1.9-7.5 9.8-12.6 11.2-18.2C66 9 56 17.2 57 31.8c3.8-1.3 7.8-.3 11.9 0zm-5.6 12.6c.9-4.2 3-7.2 4.2-11.2-4.6-.4-5.9-.4-10.5 0 .7 5.2 2 9.6 6.3 11.2zm-7.7-9.8c-15.6 4.8-4.9 34 5.6 33.7a40.6 40.6 0 0 1 1.4-21 19 19 0 0 1-7-12.7z"/><path fill="#D6A563" d="M204.9 127.5c-2.2-4.5-5-15-5-19.9 0-.6 2.8-2 3.6-2.9 0 7.8 1.5 18.2 4.4 22.2-1-.2-1.6 1.1-3 .6z"/><path fill="#669BC7" d="M475.3 305.1c1.8 24.2-4.5 44.2-11.2 64.5-34.5 1.5-58.8-7.1-75.7-23.1 1.6-7.5 4.7-17.2 2.8-26-3.5 3.3-.6 10.3-2.8 15.5-1.7 4-15.7 15.6-19.6 19.6-18.9 19-44 37.4-77.1 39.3-37.5 2-70.9-10-87.6-33 35-1.6 65.4-7.9 86.9-23.1 3-1.9 1.2 1.6 3.5 2a184 184 0 0 1 34.3-65.8c15-17.2 35.8-33.3 63.8-35.7 45.6-4 79.6 25.3 82.7 65.8z"/><path fill="#669BC7" d="M387 349.3c18 14.8 41.9 24 75.7 23.1-1.8 5.3-4.5 9.6-6.3 14.7-35.8 4.5-61-7.1-75.7-25.9 2.9-3.2 4.8-7.3 6.3-11.9z"/><path fill="#FFD035" d="M429 102c4.6 11-8.2 15.6-17.5 17.4-12.9 15.2-17.7 36-27.3 53.3a170.1 170.1 0 0 1-36.5 43.4 70 70 0 0 0-22.4-6.3 91.5 91.5 0 0 0-14.7-48.3c24.7-9.9 44.2-25 51.8-51.9-2-10 2.4-19.5 9.2-23.1-.1 2.2.3 3.9 1.4 4.9 2.8-10.2-6.9-13-5-23.1.6-2.7 3.6-6.9 7.8-7 15.3-.6 12.8 34 30.8 40 9 3 13-2.7 22.4.6z"/><path fill="#FFD035" d="M390.5 76c11.3-11.3 21.2 8.6 6.3 12.6-2.3-4-3.6-9-6.3-12.6zM363.1 91.4c-1 4.5-3.3 8-3.5 13.3-3.4-4.5-12.5-3.3-16-7.7-1.4-11 13.3-7.6 19.5-5.6z"/><path fill="#FFF" d="M323.2 211.2c23.6 1.7 40 16.3 51.9 30.2-43.5 14.7-66 50.4-80.6 93.9-26 16.3-59.4 25.2-102.4 24.5a152.6 152.6 0 0 1-16.8-66.6c15-9.6 37.4-23.9 35-49-1.1-13-8.8-21.8-17.5-28.8 13.5-7.3 27.6-14 36.5-25.9-2.6-8-9.3-15.4-7-26 9.7 1.8 16 6.9 25.2 9.2 2-10.2-3-19.5-2.8-30.1 7.1 3.8 13.6 8.3 19.6 13.3-1.6 4.4-4.6 7.5-6.3 11.9-3.5.2-5.8-3.6-8.4-2.1 23.5 11 44.6 24.5 60.3 43.4-1.3 1-3.3 1.4-5.6 1.4 4.4 2 13.4.4 18.9.7z"/><path fill="#FFF" d="M301.5 155.2c12.8 10.6 22.3 34 21.7 54.6h-9.8c-15.7-15.4-30.9-31.2-53.3-40 5-11.4 30.5-23.6 41.4-14.6z"/><path fill="#669BC7" d="M326.7 388.5c-3.5 33.8-15.3 69.6-35.7 89a48.3 48.3 0 0 1-37.9 14c-35-2.4-56.4-28.1-63.8-60.9 8.3-12.7 22.9-19.2 41.4-21.7.6 10-6.2 18.5-9.1 27.3 4.6-1.4 6.7-9 9-15.4 3.5-9 6.4-20.6 4.3-32.3 23.6 9.6 69.2 13.1 91.8 0z"/><path fill="#FFF" d="M241.2 144c4.4 3.8 2.8 13.5 5 19.6a34.2 34.2 0 0 1-13.4-10.5c1.4-4.5 6.5-5.2 8.4-9.1zM232.8 156.6c4.6 4.7 12.3 6.4 14 14-6.2-1.5-10.5-4.9-16.8-6.3.2-3.3 3.4-3.6 2.8-7.7z"/><path fill="#D6A563" d="M234.2 139.8c1.1 7.6-4.5 8.6-7.7 11.9 0 2.5 5 .1 4.2 3.5.6 3.9-1.5 5-2.8 7-12.6-3.8-15.4 7.2-23.8 8.4-12.4 1.7-26.5-9.4-32.3-16.8-3-4-6-10.7-7-14.7-10.1-44.4 36.3-56.6 46.3-82.7 4.7-1.2 5.2-11.5 11.9-12 8-.5 10.8 12.1 8.4 20.4a47.2 47.2 0 0 1-10.5 16c-15.5 16.4-54 24.4-54 51.2 0 14.3 13.2 31.3 26.6 33 14.4 1.8 25.7-7.6 30.9-21-1.4-2.9-7.7-.8-11.2-1.4 2.5-3.7 4.4-4.4 8.4-2.1 2.9-2 9.8-4.7 12.6-.7z"/><path fill="#669BC7" d="M232.8 387.8c-.3 6.3.7 13.9-.7 19-20.1.2-33.6 10.7-43.5 18.9-1.3-4.7-2.2-10-2-16.1a75.1 75.1 0 0 1 46.2-21.8z"/><path fill="#FFF" d="M225 78c4.5 1.9 2 7.3 0 9.9-2.5.4-4 1.9-7.6 1.4-.8 3-1.5 6-2.8 8.4-3 1.6-6.1 1.5-9.8.7-2.1 1.7-2 5.6-4.2 7-2.5.4-4.6 1-7.8.7-2.4 2.3-2 7.3-4.9 9.1-3.6 0-4.6 1-7.7 0-2.4 3.9-1.5 11-9.8 9.1 10.8-22.8 40.9-26.4 54.7-46.2zM219.5 163.6a54 54 0 0 0 8.4 25.2c-9 11.5-22.6 18.5-36.5 25.2-5.8-3.7-14-5.1-21.7-7v-10.5c14.8-12.8 33.2-22 49.8-33z"/><path fill="#FFF" d="M209 244.2c2.7 25.8-23.2 41.6-41.4 51.1 8-30-2.7-70.4-25.2-82.7 31.6-11.4 63.7 3.8 66.6 31.6z"/><path fill="#FFD035" d="M203.4 45.8c13.5 3.8-1 21.5-7 27.4-12.4 12-32.2 25.2-34.4 49.7-2.4 27.2 13.3 43.6 38.6 49.8-9.8 6.6-19.4 13.3-29.5 19.6a60.4 60.4 0 0 0-21.7-43.4c3-3.3 5.4-7.2 7-12-5 2-5.3 11-12.6 12-17.6 2.3-19.7-24.6-1.4-25.3-3.7-3-10.7 1.8-12.6 5-5-5.7-10.1-11-12-19.7 8-1 15 4.6 23.2 5.6-5.4-4.1-16.5-9.4-24.5-6.3-.4 8.3 4.9 11 7 16.8C101 110.2 72.3 102 63.9 73.2c2.2 0 3 1.6 5.6 1.4-.4-3-5.2-1.8-6.3-4.2a44.4 44.4 0 0 1 .7-20.4c1-3 3.6 3.2 7 2.2-1-3-5.3-2.7-6.3-5.7 7.2-22.1 21-43.7 50.5-41.3 15 1.2 25.4 8 35.7 15.4 2.4-2.7 10.7-4.7 12.6 0-5.7 6.4-12.6 11.7-12 24.5-35.1-1-33 55.3 2.2 52a25.6 25.6 0 0 0 21.7-31c7.8-3.2 14.2-24.1 28-20.3zm-62.4 87c1.9-1.8 3.7.4 6.3 0-3.5-6-12.7-.5-12.6 5.6 3.8.8 1.7-4.4 4.9-4.3-.7 4 5 8.3 7 5-3-1-5.8-2.2-5.6-6.4z"/><path fill="#FFF" d="M152.9 45.1c-3.1-32.9 49.4-33.4 47.7-1.4-13.2 1.9-16.5 13.4-25.3 19.7C171.1 54 165 46.7 153 45zm36.4-9c2.9.2 4.5-.8 4.2-3.6-.7-3.4-6.9-2.5-5.6 2.1.2.8.8 1.2 1.4 1.4z"/><path fill="#010101" d="M193.5 32.5c.3 2.8-1.3 3.8-4.2 3.5-.6-.2-1.2-.6-1.4-1.4-1.3-4.6 4.9-5.5 5.6-2z"/><path fill="#FFD035" d="M152.2 222.5c11.6 15.2 17 36.7 16.8 63.7-47.4 14-94.3-7.3-109.3-41.3 0-3 3.2 1.5 6.3 0-12-6.4-29-11.7-25.2-31.6-.3-3.3 3.3 1.2 3.5-2-5-3.1-16 5.5-21-1.5-3.3-15 12-16 21.7-11.9.4 11.9 2.2 26 12.6 26 10.5 0 12.4-16.7 5.6-25.3.7 7 5.8 23.2-5.6 23.2-13.9-.1-16.3-38.4 6.3-33 2.8-1.1.2 3 2.1 2.8 4.3-8.2-5.8-17.4-2.1-27.3 16.3-5 17.9 16.5 21 29.4-9.3 1-17.5 6.3-16.8 14.7 1 11.3 20.2 10.7 23.8.7-3 3.4-19.6 10.5-21.7 0-2.6-12.7 20.4-18.2 28-8.4 5.2 6.8 1.4 15.7-1.4 23.9 3.4.7 2.5-2.7 4.2-3.5 14 5.1 36.8 8.5 51.2 1.4z"/><path fill="#FFF" d="M168.3 289c0 9-12 11-14.7 2.8l14.7-2.8zM146.6 47.2c35.3-6 36.8 51.8 1.4 48.4-25.9-2.5-28.7-43.7-1.4-48.4zm-.7 33.7c2.9.3 4.4-.7 4.2-3.5-.8-3.4-7-2.5-5.6 2 .3.7.7 1.3 1.4 1.5z"/><path fill="#010101" d="M150.1 77.4c.2 2.8-1.3 3.8-4.2 3.5-.7-.2-1.1-.8-1.4-1.4-1.3-4.6 4.8-5.5 5.6-2.1z"/><path fill="#FFD035" d="M147.3 132.7c-2.6.5-4.4-1.7-6.3 0-.2 4.2 2.6 5.3 5.6 6.4-2 3.3-7.7-1-7-5-3.2 0-1 5-5 4.3 0-6.2 9.2-11.6 12.7-5.7z"/><path fill="#FFF" d="M133.3 224.6c-3-15.5 14.3-11.7 16.8-3.5-5 1.7-10 3.5-16.8 3.5zM80 13.6c-1.4 5.6-9.3 10.7-11.2 18.2-4-.3-8.1-1.3-12 0C56 17.2 66 9 80 13.6zM67.4 33.2c-1.2 4-3.3 7-4.2 11.2-4.2-1.6-5.6-6-6.3-11.2 4.6-.4 5.9-.4 10.5 0z"/><path fill="#FFF" d="M61 68.3c-10.4.3-21-29-5.5-33.7a19 19 0 0 0 7 12.6 40.6 40.6 0 0 0-1.4 21z"/><g><path fill="none" stroke="#D6A563" stroke-linejoin="round" stroke-miterlimit="10" d="M203.5 104.7c0 7.8 1.5 18.2 4.4 22.2-1-.2-1.6 1.1-3 .6-2.2-4.5-5-15-5-19.9 0-.6 2.8-2 3.6-2.9z"/></g><path fill="#EF3D25" d="M209.6 128.2c-.8.1-17.1 2.8-19.1 11-1.6 6.5 5.5 19.8 5.5 24.4 4.9.9 9.5-2 14-3.4s-3.4-11.6-2.9-15.1c.6-3.5 3-1.7 4.5-3.2 1.6-1.5 8.5-5.9 6.4-11.7-.7-1.9-3.3-2.7-8.4-2z"/><path fill="none" stroke="#010101" stroke-linecap="round" stroke-miterlimit="10" stroke-width="1.5" d="M213.2 141.4s-9.5 3.8-10.6 7M197.8 131.6c4 .4 8.6-.1 10.7 1.9"/></svg>';


const TestSvgRenderer = () => (
  <View style={styles.container}>
    <SvgRenderer svgXmlData={svgCircle} />
  </View>
);

or a static file

<SvgRenderer width="200" height="200" source={require('./img/homer.svg')} />

This will render:

Component example

You can also try our Example app that will render the following:

SVG items

Testing

  1. Make sure you have installed dependencies with yarn
  2. Run tests with yarn test

About

Render SVG images in React Native from an URL or static file

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 73.8%
  • JavaScript 9.3%
  • Objective-C 7.0%
  • Ruby 3.8%
  • Python 3.2%
  • Java 2.9%