react-native-svg
SVG library for react-native
Last updated 5 years ago by msand .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install react-native-svg 
SYNC missed versions from official npm registry.
React Native SVG at Software Mansion

Version NPM

react-native-svg provides SVG support to React Native on iOS, Android, macOS, Windows, and a compatibility layer for the web.

Check out the Example app

Features

  1. Supports most SVG elements and properties (Rect, Circle, Line, Polyline, Polygon, G ...).
  2. Easy to convert SVG code to react-native-svg.

Installation

With expo

✅ The Expo client app comes with the native code installed!

Install the JavaScript with:

npx expo install react-native-svg

📚 See the Expo docs for more info or jump ahead to Usage.

With react-native-cli

  1. Install library

    from npm

    npm install react-native-svg
    

    from yarn

    yarn add react-native-svg
    
  2. Link native code

    cd ios && pod install
    

Supported react-native versions

react-native-svg react-native
3.2.0 0.29
4.2.0 0.32
4.3.0 0.33
4.4.0 0.38
4.5.0 0.40
5.1.8 0.44
5.2.0 0.45
5.3.0 0.46
5.4.1 0.47
5.5.1 >=0.50
>=6 >=0.50
>=7 >=0.57.4
>=8 >=0.57.4
>=9 >=0.57.4
>=12.3.0 >=0.64.0
>=15.0.0 >=0.70.0

Support for Fabric

Fabric is React Native's new rendering system. As of version 13.0.0 of this project, Fabric is supported only for react-native 0.69.0+. Support for earlier versions is not possible due to breaking changes in configuration.

react-native-svg react-native
>=13.0.0 0.69.0+
>=13.6.0 0.70.0+
>=13.10.0 0.72.0+

Troubleshooting

Unexpected behavior

If you have unexpected behavior, please create a clean project with the latest versions of react-native and react-native-svg

react-native init CleanProject
cd CleanProject/
yarn add react-native-svg
cd ios && pod install && cd ..

Make a reproduction of the problem in App.js

react-native run-ios
react-native run-android

Adding Windows support

  1. npx react-native-windows-init --overwrite
  2. cd windows\<AppName>
  3. Open <AppName>.vcxproj

RN 0.68+

  1. Scroll to the bottom until you find:
    <ItemGroup>
       <PackageReference Include="Microsoft.Windows.CppWinRT" Version="X.X.XXXXXX.X" />
    </ItemGroup>
    
  2. Add the following to that <ItemGroup>
    <PackageReference Include="Win2D.uwp" Version="1.26.0" />
    

Pre RN 0.68

  1. Scroll to the bottom until you find:

    <ImportGroup Label="ExtensionTargets">
    
  2. Add the following to that <ImportGroup>

    <Import Project="$(SolutionDir)\packages\Win2D.uwp.1.26.0\build\native\Win2D.uwp.targets" Condition="Exists('$(SolutionDir)\packages\Win2D.uwp.1.26.0\build\native\Win2D.uwp.targets')" />
    

Opening issues

Verify that it is still an issue with the latest version as specified in the previous step. If so, open a new issue, include the entire App.js file, specify what platforms you've tested, and the results of running this command:

react-native info

If you suspect that you've found a spec conformance bug, then you can test using your component in a react-native-web project by forking this codesandbox, to see how different browsers render the same content: https://codesandbox.io/s/pypn6mn3y7 If any evergreen browser with significant userbase or other svg user agent renders some svg content better, or supports more of the svg and related specs, please open an issue asap.

Usage

To check how to use the library, see USAGE.md

TODO:

  1. Filters (connected PR)

Known issues:

  1. Unable to apply focus point of RadialGradient on Android.

Current Tags

  • 15.6.0                                ...           latest (3 months ago)

238 Versions

  • 15.6.0                                ...           3 months ago
  • 15.5.0                                ...           3 months ago
  • 15.4.0                                ...           4 months ago
  • 15.3.0                                ...           6 months ago
  • 14.2.0                                ...           6 months ago
  • 13.14.1                                ...           6 months ago
  • 15.2.0                                ...           7 months ago
  • 15.2.0-rc.0                                ...           8 months ago
  • 15.1.0                                ...           8 months ago
  • 15.0.0                                ...           9 months ago
  • 14.1.0                                ...           a year ago
  • 14.0.0                                ...           a year ago
  • 13.14.0                                ...           a year ago
  • 13.13.0                                ...           a year ago
  • 13.12.0                                ...           a year ago
  • 13.11.0                                ...           a year ago
  • 13.10.0                                ...           a year ago
  • 13.9.0                                ...           2 years ago
  • 13.8.0                                ...           2 years ago
  • 12.5.1                                ...           2 years ago
  • 13.7.0                                ...           2 years ago
  • 12.5.0                                ...           2 years ago
  • 13.6.0                                ...           2 years ago
  • 13.5.0                                ...           2 years ago
  • 13.4.0                                ...           2 years ago
  • 13.3.0                                ...           2 years ago
  • 13.2.0                                ...           2 years ago
  • 13.1.0                                ...           2 years ago
  • 13.0.0                                ...           2 years ago
  • 12.4.4                                ...           2 years ago
  • 12.4.3                                ...           2 years ago
  • 12.4.2                                ...           2 years ago
  • 12.4.1                                ...           2 years ago
  • 12.4.0                                ...           2 years ago
  • 12.3.0                                ...           3 years ago
  • 12.2.0                                ...           3 years ago
  • 12.1.1                                ...           4 years ago
  • 12.1.1-0                                ...           4 years ago
  • 12.1.0                                ...           5 years ago
  • 12.0.3                                ...           5 years ago
  • 12.0.2                                ...           5 years ago
  • 12.0.1                                ...           5 years ago
  • 12.0.0                                ...           5 years ago
  • 11.0.1                                ...           5 years ago
  • 11.0.0                                ...           5 years ago
  • 10.1.0                                ...           5 years ago
  • 10.0.0                                ...           5 years ago
  • 9.13.6                                ...           5 years ago
  • 9.13.5                                ...           5 years ago
  • 9.13.4                                ...           5 years ago
  • 9.13.3                                ...           5 years ago
  • 9.13.2                                ...           5 years ago
  • 9.13.1                                ...           5 years ago
  • 9.13.0                                ...           5 years ago
  • 9.12.0                                ...           5 years ago
  • 9.11.1                                ...           5 years ago
  • 9.11.0                                ...           5 years ago
  • 9.10.2                                ...           5 years ago
  • 9.10.1                                ...           5 years ago
  • 9.10.0                                ...           5 years ago
  • 9.9.9                                ...           5 years ago
  • 9.9.8                                ...           5 years ago
  • 9.9.7                                ...           5 years ago
  • 9.9.6                                ...           5 years ago
  • 9.9.5                                ...           5 years ago
  • 9.9.4                                ...           5 years ago
  • 9.9.3                                ...           5 years ago
  • 9.9.2                                ...           5 years ago
  • 9.9.1                                ...           5 years ago
  • 9.9.0                                ...           5 years ago
  • 9.8.6                                ...           5 years ago
  • 9.8.5                                ...           5 years ago
  • 9.8.4                                ...           5 years ago
  • 9.8.3                                ...           5 years ago
  • 9.8.2                                ...           5 years ago
  • 9.8.1                                ...           5 years ago
  • 9.8.0                                ...           5 years ago
  • 9.7.1                                ...           5 years ago
  • 9.7.0                                ...           5 years ago
  • 9.6.4                                ...           5 years ago
  • 9.6.3                                ...           5 years ago
  • 9.6.2                                ...           5 years ago
  • 9.6.1                                ...           5 years ago
  • 9.6.0                                ...           5 years ago
  • 9.5.3                                ...           5 years ago
  • 9.5.2                                ...           5 years ago
  • 9.5.1                                ...           5 years ago
  • 9.5.0                                ...           5 years ago
  • 9.4.0                                ...           6 years ago
  • 9.3.7                                ...           6 years ago
  • 8.0.11                                ...           6 years ago
  • 7.2.1                                ...           6 years ago
  • 6.5.3                                ...           6 years ago
  • 9.3.6                                ...           6 years ago
  • 9.3.5                                ...           6 years ago
  • 9.3.4                                ...           6 years ago
  • 9.3.3                                ...           6 years ago
  • 9.3.2                                ...           6 years ago
  • 9.3.1                                ...           6 years ago
  • 9.3.0                                ...           6 years ago
  • 9.2.4                                ...           6 years ago
  • 9.2.3                                ...           6 years ago
  • 9.2.2                                ...           6 years ago
  • 9.2.1                                ...           6 years ago
  • 9.2.0                                ...           6 years ago
  • 9.1.1                                ...           6 years ago
  • 9.1.0                                ...           6 years ago
  • 9.0.7                                ...           6 years ago
  • 9.0.6                                ...           6 years ago
  • 9.0.5                                ...           6 years ago
  • 9.0.4                                ...           6 years ago
  • 9.0.3                                ...           6 years ago
  • 9.0.2                                ...           6 years ago
  • 9.0.1                                ...           6 years ago
  • 9.0.0                                ...           6 years ago
  • 8.0.10                                ...           6 years ago
  • 8.0.9                                ...           6 years ago
  • 8.0.8                                ...           6 years ago
  • 8.0.7                                ...           6 years ago
  • 8.0.6                                ...           6 years ago
  • 8.0.5                                ...           6 years ago
  • 8.0.4                                ...           6 years ago
  • 8.0.3                                ...           6 years ago
  • 8.0.2                                ...           6 years ago
  • 8.0.1                                ...           6 years ago
  • 8.0.0                                ...           6 years ago
  • 7.2.0                                ...           6 years ago
  • 7.1.2                                ...           6 years ago
  • 7.1.1                                ...           6 years ago
  • 7.1.0                                ...           6 years ago
  • 7.0.3                                ...           6 years ago
  • 7.0.2                                ...           6 years ago
  • 7.0.1                                ...           6 years ago
  • 7.0.0                                ...           6 years ago
  • 6.5.2                                ...           6 years ago
  • 6.5.1                                ...           6 years ago
  • 6.5.0                                ...           6 years ago
  • 6.4.1                                ...           6 years ago
  • 6.4.0                                ...           6 years ago
  • 6.3.1                                ...           7 years ago
  • 6.3.0                                ...           7 years ago
  • 6.2.2                                ...           7 years ago
  • 6.2.1                                ...           7 years ago
  • 6.2.0                                ...           7 years ago
  • 6.1.4                                ...           7 years ago
  • 6.1.3                                ...           7 years ago
  • 6.1.2                                ...           7 years ago
  • 6.1.1                                ...           7 years ago
  • 6.1.0                                ...           7 years ago
  • 6.0.1-rc.3                                ...           7 years ago
  • 6.0.1-rc.2                                ...           7 years ago
  • 6.0.1-rc.1                                ...           7 years ago
  • 6.0.1-rc.0                                ...           7 years ago
  • 6.0.0                                ...           7 years ago
  • 5.5.1                                ...           7 years ago
  • 6.0.0-rc12                                ...           7 years ago
  • 6.0.0-rc11                                ...           7 years ago
  • 6.0.0-rc10                                ...           7 years ago
  • 6.0.0-rc9                                ...           7 years ago
  • 6.0.0-rc8                                ...           7 years ago
  • 6.0.0-rc7                                ...           7 years ago
  • 6.0.0-rc6                                ...           7 years ago
  • 6.0.0-rc5                                ...           7 years ago
  • 6.0.0-rc4                                ...           7 years ago
  • 6.0.0-rc3                                ...           7 years ago
  • 6.0.0-rc2                                ...           7 years ago
  • 5.5.0                                ...           7 years ago
  • 5.5.0-rc1                                ...           7 years ago
  • 5.4.2                                ...           7 years ago
  • 6.0.0-rc1                                ...           7 years ago
  • 5.4.1                                ...           7 years ago
  • 5.4.0                                ...           7 years ago
  • 5.3.3                                ...           7 years ago
  • 5.3.2                                ...           7 years ago
  • 5.3.1                                ...           7 years ago
  • 5.3.0                                ...           7 years ago
  • 5.2.0                                ...           7 years ago
  • 5.1.8                                ...           8 years ago
  • 5.1.7                                ...           8 years ago
  • 5.1.6                                ...           8 years ago
  • 5.1.5                                ...           8 years ago
  • 5.1.4                                ...           8 years ago
  • 5.1.3                                ...           8 years ago
  • 5.1.2                                ...           8 years ago
  • 5.1.1                                ...           8 years ago
  • 5.1.0                                ...           8 years ago
  • 5.0.2                                ...           8 years ago
  • 5.0.1                                ...           8 years ago
  • 5.0.0                                ...           8 years ago
  • 4.6.1                                ...           8 years ago
  • 4.6.0                                ...           8 years ago
  • 4.5.0                                ...           8 years ago
  • 4.4.1                                ...           8 years ago
  • 4.4.0                                ...           8 years ago
  • 4.3.3                                ...           8 years ago
  • 4.3.2                                ...           8 years ago
  • 4.3.1                                ...           8 years ago
  • 4.3.0                                ...           8 years ago
  • 4.2.1                                ...           8 years ago
  • 4.2.0                                ...           8 years ago
  • 4.1.5                                ...           8 years ago
  • 4.1.4                                ...           8 years ago
  • 4.1.3                                ...           8 years ago
  • 4.1.2                                ...           8 years ago
  • 4.1.1                                ...           8 years ago
  • 4.1.0                                ...           8 years ago
  • 4.0.0                                ...           8 years ago
  • 4.0.0-rc                                ...           8 years ago
  • 3.1.1                                ...           8 years ago
  • 3.1.0                                ...           8 years ago
  • 3.0.0                                ...           8 years ago
  • 3.0.0-rc                                ...           8 years ago
  • 2.2.0                                ...           8 years ago
  • 2.1.1                                ...           8 years ago
  • 2.1.0                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 1.3.1                                ...           9 years ago
  • 1.3.0                                ...           9 years ago
  • 1.2.6                                ...           9 years ago
  • 1.2.5                                ...           9 years ago
  • 1.2.4                                ...           9 years ago
  • 1.2.3                                ...           9 years ago
  • 1.2.2                                ...           9 years ago
  • 1.2.1                                ...           9 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.3                                ...           9 years ago
  • 1.1.2                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
  • 1.0.0-rc                                ...           9 years ago
  • 0.2.1                                ...           9 years ago
  • 0.2.0                                ...           9 years ago
  • 0.1.5                                ...           9 years ago
  • 0.1.4                                ...           10 years ago
  • 0.1.3                                ...           10 years ago
  • 0.1.2                                ...           10 years ago
  • 0.1.1                                ...           10 years ago
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE