vault-development / react-native-svg-uri

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

Display svg image from API #171

Open latusdenis opened 5 years ago

latusdenis commented 5 years ago

Hi! Trying to display the image, which I get from https://restcountries.eu/rest/v2/all.

<SvgUri width="30" height="30" source={{uri: 'https://restcountries.eu/data/afg.svg'}} />

But I am getting this error: image

Using the image from example instead works perfectly. What can be the problem?

Thanks!

geekdreamzz commented 5 years ago

Same for me - also tried sending "string" into svgXmlData prop which the readme says, but get the same errors

geekdreamzz commented 5 years ago

hey @latusdenis - I don't have a fix but I think I know whats happening. In my svg when I removed the <use /> tag - it renders just fine... So it's almost like it doesn't work for svgs that have pointers to another element.

I plan to see if I can generate my svgs with a bunch of fills only. I'll also try and see if I can take a look at this lib and make a pr if I can develop a fix.

geekdreamzz commented 5 years ago

was able to get around this error with this: https://github.com/kristerkari/react-native-svg-transformer

latusdenis commented 5 years ago

@geeklevel1000 Thanks for your help! May me the problem with the lib, which doesn't render some SVG's properly. I've used https://github.com/chitezh/react-native-svg-image lib instead and it worked perfectly for me.

durdevic commented 2 years ago

I had issues with showing SVGs on Android on release version even though it worked on development (known issue).

This solved my issue, https://github.com/seekshiva/react-native-remote-svg