react-native-svg
TypeScript icon, indicating that this package has built-in type declarations

15.11.2 • Public • Published

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
>=15.8.0 >=0.73.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. react-native run-windows

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

Known issues:

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

React Native SVG is maintained by Software Mansion

Since 2012 Software Mansion is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – Hire us.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
15.11.2197,789latest

Version History

VersionDownloads (Last 7 Days)Published
15.11.2197,789
15.11.174,994
15.11.026
15.10.165,314
15.10.02,798
15.9.021,898
15.8.0265,828
15.8.0-rc.34
15.8.0-rc.22
15.8.0-rc.12
15.7.113,299
15.8.0-rc.01
15.7.097
15.6.079,852
15.5.08,009
15.4.010,470
15.3.030,814
14.2.011,224
13.14.118,941
15.2.097,296
15.2.0-rc.027
15.1.013,847
15.0.04,182
14.1.036,195
14.0.06,066
13.14.026,083
13.13.06,635
13.12.0346
13.11.01,748
13.10.08,545
13.9.026,189
13.8.03,536
12.5.142,666
13.7.02,565
12.5.0967
13.6.02,472
13.5.0330
13.4.08,553
13.3.0413
13.2.0781
13.1.085
13.0.0158
12.4.44,441
12.4.32,894
12.4.2310
12.4.17
12.4.0177
12.3.07,602
12.2.015,441
12.1.121,123
12.1.1-09
12.1.066,443
12.0.31,181
12.0.210
12.0.135
12.0.052
11.0.1691
11.0.019
10.1.01,602
10.0.0140
9.13.69,232
9.13.57
9.13.46
9.13.32,041
9.13.212
9.13.114
9.13.04
9.12.0121
9.11.1184
9.11.06
9.10.285
9.10.15
9.10.05
9.9.976
9.9.880
9.9.7133
9.9.616
9.9.523
9.9.48
9.9.38
9.9.213
9.9.14
9.9.02
9.8.65
9.8.53
9.8.416
9.8.33
9.8.21
9.8.11
9.8.04
9.7.112
9.7.08
9.6.4230
9.6.34
9.6.29
9.6.18
9.6.04
9.5.354
9.5.22
9.5.121
9.5.05
9.4.0344
9.3.750
8.0.1145
7.2.11,213
6.5.323,552
9.3.67
9.3.56
9.3.42
9.3.327
9.3.24
9.3.14
9.3.08
9.2.459
9.2.31
9.2.27
9.2.15
9.2.05
9.1.19
9.1.060
9.0.71
9.0.6190
9.0.513
9.0.45
9.0.34
9.0.25
9.0.16
9.0.030
8.0.10159
8.0.98
8.0.856
8.0.72
8.0.62
8.0.52
8.0.43
8.0.33
8.0.230
8.0.13
8.0.041
7.2.03
7.1.22
7.1.15
7.1.01
7.0.390
7.0.25
7.0.12
7.0.04
6.5.26
6.5.15
6.5.016
6.4.16
6.4.04
6.3.122
6.3.03
6.2.2164
6.2.180
6.2.03
6.1.42
6.1.32
6.1.26
6.1.13
6.1.062
6.0.1-rc.31
6.0.1-rc.221
6.0.1-rc.11
6.0.1-rc.04
6.0.01
5.5.1849
6.0.0-rc121
6.0.0-rc112
6.0.0-rc101
6.0.0-rc91
6.0.0-rc81
6.0.0-rc71
6.0.0-rc61
6.0.0-rc52
6.0.0-rc41
6.0.0-rc32
6.0.0-rc21
5.5.02
5.5.0-rc11
5.4.212
6.0.0-rc11
5.4.15
5.4.02
5.3.32
5.3.24
5.3.11
5.3.055
5.2.018
5.1.86
5.1.74
5.1.62
5.1.52
5.1.44
5.1.3128
5.1.24
5.1.1153
5.1.03
5.0.26
5.0.11
5.0.05
4.6.113
4.6.0228
4.5.07
4.4.126
4.4.04
4.3.314
4.3.26
4.3.116
4.3.01
4.2.16
4.2.049
4.1.52
4.1.432
4.1.34
4.1.25
4.1.12
4.1.04
4.0.04
4.0.0-rc1
3.1.11
3.1.03
3.0.017
3.0.0-rc4
2.2.04
2.1.13
2.1.03
2.0.010
1.3.1186
1.3.04
1.2.655
1.2.51
1.2.414
1.2.34
1.2.2168
1.2.12
1.2.01
1.1.33
1.1.22
1.1.03
1.0.18
1.0.017
1.0.0-rc2
0.2.14
0.2.01
0.1.53
0.1.43
0.1.34
0.1.216
0.1.17

Package Sidebar

Install

npm i react-native-svg

Weekly Downloads

1,254,455

Version

15.11.2

License

MIT

Unpacked Size

4.05 MB

Total Files

1482

Last publish

Collaborators

  • brentvatne
  • kmag
  • wolewicki
  • jake7