Socket
Socket
Sign inDemoInstall

react-native-svg-uri-reborn

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-svg-uri-reborn

Render an SVG Image from an URL


Version published
Weekly downloads
60
increased by57.89%
Maintainers
1
Install size
135 kB
Created
Weekly downloads
 

Readme

Source

react-native-svg-uri-reborn

Render SVG images in React Native from an URL or a static file

The project is built on top of react-native-svg-uri , due to original project is not likely being maintained. This fork should be a drop-in replacement and some bug fixing support have being added.

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

npm install react-native-svg-uri-reborn --save

Link library react-native-svg

react-native link react-native-svg # not react-native-svg-uri !!!

Props

PropTypeDefaultNote
sourceImageSourceSame kind of source prop that <Image /> component has
svgXmlDataStringYou can pass the SVG as String directly
fillColorOverrides all fill attributes of the svg file
fillAllBooleanAdds the fill color to the entire svg object

Known Bugs

  • [ANDROID] There is a problem with static SVG file on Android, Works OK in debug mode but fails to load the file in release mode. At the moment the only workaround is to pass the svg content in the svgXmlData prop.

Usage

Here's a simple example:

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

const TestSvgUri = () => (
  <View style={styles.container}>
    <SvgUri
      width="200"
      height="200"
      source={{uri:'http://thenewcode.com/assets/images/thumbnails/homer-simpson.svg'}}
    />
  </View>
);

or a static file

<SvgUri width="200" height="200" source={require('./img/homer.svg')} />

This will render:

Component example

Testing

  1. Make sure you have installed dependencies with npm i
  2. Run tests with npm test

Keywords

FAQs

Last updated on 01 Apr 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc