vault-development / react-native-svg-uri

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

Need updates #84

Closed CYB3RL1F3 closed 6 years ago

CYB3RL1F3 commented 6 years ago

Hello,

I recon the component needs to be updated to be supported by React 16 and React Native 0.49.

I tried to install the latest version of react-native-svg-ui and react-native-svg, and I got an error mentionning PropTypes doesn't exists. I looked at it and noticed that PropTypes was still imported from 'react', that is deprecated and now impossible to do.

I "manually" fixed the issue, but now I get another error : "Raw text cannot be used outside a tag".

Once I close the error message, the svg is well rendered. If I remove the component it works well.

import arrow from 'assets/svg/arrow.svg';
<View style={styles.arrow}>
          <SvgUri source={arrow} width="16" height="16" />
        </View>

Is it possible to upgrade, to render it compatible with the latest versions of React Native ?

capture d ecran 2017-10-20 a 18 04 10

Thanks a lot :)

lettertwo commented 6 years ago

From my testing, I've noticed that this error isn't logged if whitespace is stripped from the svg.

I haven't tested this, but it looks to me like this commit might fix this (at least in my case).

Edit: Seems this PR introduced the fix, but i think it's not quite ready yet.

nickjohnson-dev commented 6 years ago

I have tested the changes from the commit by @lettertwo, and it fixed the problem in my own project.

If we could get a patch release with this fix ASAP, that would be awesome.

@matc4 Thanks for taking the time to create this library. It's really helpful!

matc4 commented 6 years ago

Ready!