Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

react-native-fast-svg

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-fast-svg

Render an SVG Images from url (using react-native-svg-uri), plus caching

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
83
18.57%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-fast-svg

Render SVG images in React Native using a URL or a static file.

SVG's rendered from a url are cached using react native's Async Storage.

Forked from 'react-native-svg-uri'.

Install library from npm

npm install react-native-fast-svg --save

Link library react-native-svg

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

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
fillAllBooleanfalseAdds the fill color to the entire svg object
noCacheBooleeanfalsewill not cache this particular SVG if true

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-fast-svg';

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

  • Make sure you have installed dependencies with npm i
  • Run tests with npm test

Keywords

react-native

FAQs

Package last updated on 11 Mar 2019

Did you know?

Socket

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