Name: react-native-svg-uri
Owner: Uphold
Description: Render SVG images in React Native from an URL or static file
Forked from: vault-development/react-native-svg-uri
Created: 2018-01-10 15:18:09.0
Updated: 2018-01-10 15:18:11.0
Pushed: 2018-02-06 14:36:10.0
Size: 92
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Render SVG images in React Native from an URL or a static file
This was tested with RN 0.33 and react-native-svg 4.3.1 (depends on this library) react-native-svg
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
install react-native-svg-uri --save
Link library react-native-svg
t-native link react-native-svg # not react-native-svg-uri !!!
| Prop | Type | Default | Note |
|—|—|—|—|
| source
| ImageSource
| | 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
Here's a simple example:
rt SvgUri from 'react-native-svg-uri';
t TestSvgUri = () => (
iew style={styles.container}>
<SvgUri
width="200"
height="200"
source={{uri:'http://thenewcode.com/assets/images/thumbnails/homer-simpson.svg'}}
/>
View>
or a static file
Uri width="200" height="200" source={require('./img/homer.svg')} />
This will render:
npm i
npm test