vault-development / react-native-svg-uri

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

Error: Text strings must be rendered within a <Text> component. #201

Open DTanmoy opened 4 years ago

wagnerpaz commented 4 years ago

Same here!

DeVoresyah commented 4 years ago

same

mainsmirnov commented 4 years ago

Same

alikrodrigues commented 4 years ago

Same..

chenweigh commented 4 years ago

Same

theroshanjha01 commented 4 years ago

same here

ziudeso commented 4 years ago

same

Ilya1995 commented 4 years ago

+1

PZenha commented 4 years ago

+1

bitttttten commented 4 years ago

Sometimes you get this if your svg has inlined raster graphics. You can test by opening your svg in illustrator or something like that, finding the raster graphics and deleting them, then testing the svg.

You could also look at different export options for your svg in illustrator, if you "embed" images you might have more success.

leovargasdev commented 4 years ago

I was also having the same problem, but I found the react-native-svg package, worked for me!

Example:

import { SvgUri } from 'react-native-svg';

<SvgUri
      width="200"
      height="200"
      uri="http://thenewcode.com/assets/images/thumbnails/homer-simpson.svg"
/>
factorycreacom commented 2 years ago

I was also having the same problem, but I found the react-native-svg package, worked for me!

Example:

import { SvgUri } from 'react-native-svg';

<SvgUri
      width="200"
      height="200"
      uri="http://thenewcode.com/assets/images/thumbnails/homer-simpson.svg"
/>

Thanks. worked for me

chloe-schoreisz commented 2 years ago

I don't know why, but react-native-svg is not working on my end. I'm encountering this issue for svgs generated through Illustratror (which is what our designer uses to create them).

Any ideas ? Or anyone knows how to set up illustrator so that it doesn't create these comments ?

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" .... >
<style type="text/css">
.st0{fill:#0C3276;}
</style>
<g>
    <path ... />
    <path ... />
    <path ... />
</g>
</svg>
sunjungAn commented 1 year ago

check your svg file. i had the same issue, i resolve my issue. remove comment and any semicolon in svg string

ex) <!-- Generator: ~~ -->