# react-native-svg-uri

> Render an SVG Image from an URL

Latest version **1.2.3** (published 2017-11-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-svg-uri
pnpm add react-native-svg-uri
yarn add react-native-svg-uri
bun add react-native-svg-uri
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2017-11-16 |
| First published | 2016-09-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/react-native-svg-uri) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+16 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 849 |
| Author | Matias Cortes |
| Maintainers | matc4 |
| Keywords | react-native, svg, url, uri, http |

## Links

- npm: https://www.npmjs.com/package/react-native-svg-uri
- Repository: https://github.com/matiascba/react-native-svg-uri
- Homepage: https://github.com/matiascba/react-native-svg-uri#readme
- Issues: https://github.com/matiascba/react-native-svg-uri/issues
- npm.io page: https://npm.io/package/react-native-svg-uri

## Dependencies (1)

- [xmldom](https://npm.io/package/xmldom.md) ^0.1.22

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.2.3 (latest) — 2017-11-16
- 1.2.2 — 2017-11-16
- 1.2.1 — 2017-08-27
- 1.2.0 — 2017-01-18
- 1.1.2 — 2016-12-08
- 1.1.1 — 2016-12-08
- 0.0.3 — 2016-09-22
- 0.0.2 — 2016-09-18
- 0.0.1 — 2016-09-18

## README

# react-native-svg-uri
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](https://github.com/react-native-community/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`

```bash
npm install react-native-svg-uri --save
```

Link library react-native-svg

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

## Props

| 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

## 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.

## <a name="Usage">Usage</a>

Here's a simple example:

```javascript
import SvgUri from 'react-native-svg-uri';

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

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

This will render:

![Component example](./screenshoots/sample.png)

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

---
_Source: https://npm.io/package/react-native-svg-uri · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
