vault-development / react-native-svg-uri

Render SVG images in React Native from an URL or static file
850 stars 334 forks source link

Error screen on a fresh project #192

Closed Muljayan closed 4 years ago

Muljayan commented 4 years ago

Bug

Environment info

React native info output:

"react": "16.8.6",
"react-native": "0.60.4"

Library version: 1.2.3

Steps To Reproduce

  1. Create a fresh project using react-native-cli.
  2. Bring in an SVG file into the src folder of the project (I downloaded and used the homer simpson image mentioned in the documentation for the test ).
  3. Import the svg as import MySVG from './mysvg.svg';
  4. Pass MySVG into svgXmlData property of SvgUri component

Describe what you expected to happen:

  1. The image should render on screen

Reproducible sample code

import React from 'react';
import SvgUri from 'react-native-svg-uri';

import MySVG from './mysvg.svg';

const MyComponent = () => {
  return (
     <>
      <SvgUri
        svgXmlData={MySVG}
        width="25"
        height="25"
      />
    </>
  );
};

export default MyComponent;

Error Message

Screen Shot 2019-08-08 at 3 25 18 PM

Muljayan commented 4 years ago

This works now and I have no idea how. I repeated the same thing over and over again and it finally works.