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

15.11.1 • 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.129,002latest

Version History

VersionDownloads (Last 7 Days)Published
15.11.129,002
15.11.01,909
15.10.1109,016
15.10.06,507
15.9.037,470
15.8.0145,348
15.8.0-rc.37
15.8.0-rc.219
15.8.0-rc.1691
15.7.119,307
15.8.0-rc.00
15.7.0264
15.6.044,673
15.5.013,781
15.4.015,138
15.3.044,758
14.2.015,526
13.14.130,343
15.2.0174,777
15.2.0-rc.067
15.1.018,490
15.0.06,481
14.1.067,710
14.0.05,755
13.14.037,546
13.13.07,470
13.12.0506
13.11.02,636
13.10.05,366
13.9.029,338
13.8.05,274
12.5.149,221
13.7.02,812
12.5.01,082
13.6.04,323
13.5.0541
13.4.017,967
13.3.0328
13.2.0504
13.1.0134
13.0.0269
12.4.410,335
12.4.31,638
12.4.254
12.4.130
12.4.0262
12.3.09,000
12.2.023,445
12.1.19,156
12.1.1-049
12.1.070,757
12.0.31,341
12.0.29
12.0.19
12.0.036
11.0.11,135
11.0.018
10.1.0765
10.0.0175
9.13.610,415
9.13.58
9.13.44
9.13.32,149
9.13.237
9.13.13
9.13.021
9.12.017
9.11.1417
9.11.03
9.10.24
9.10.15
9.10.06
9.9.936
9.9.820
9.9.70
9.9.66
9.9.510
9.9.49
9.9.327
9.9.242
9.9.16
9.9.02
9.8.63
9.8.57
9.8.423
9.8.32
9.8.20
9.8.17
9.8.01
9.7.1111
9.7.012
9.6.4287
9.6.36
9.6.220
9.6.112
9.6.02
9.5.373
9.5.25
9.5.121
9.5.02
9.4.0269
9.3.7136
8.0.11154
7.2.1509
6.5.325,040
9.3.611
9.3.54
9.3.43
9.3.329
9.3.22
9.3.17
9.3.06
9.2.446
9.2.31
9.2.22
9.2.11
9.2.01
9.1.14
9.1.02
9.0.73
9.0.680
9.0.56
9.0.43
9.0.31
9.0.24
9.0.10
9.0.042
8.0.10168
8.0.987
8.0.854
8.0.73
8.0.62
8.0.50
8.0.41
8.0.32
8.0.23
8.0.119
8.0.02
7.2.03
7.1.23
7.1.11
7.1.02
7.0.364
7.0.21
7.0.11
7.0.03
6.5.220
6.5.14
6.5.04
6.4.18
6.4.02
6.3.115
6.3.02
6.2.2406
6.2.138
6.2.04
6.1.40
6.1.32
6.1.22
6.1.11
6.1.03
6.0.1-rc.30
6.0.1-rc.214
6.0.1-rc.10
6.0.1-rc.02
6.0.02
5.5.11,312
6.0.0-rc121
6.0.0-rc110
6.0.0-rc103
6.0.0-rc91
6.0.0-rc80
6.0.0-rc71
6.0.0-rc60
6.0.0-rc50
6.0.0-rc42
6.0.0-rc31
6.0.0-rc20
5.5.04
5.5.0-rc11
5.4.237
6.0.0-rc10
5.4.15
5.4.01
5.3.35
5.3.20
5.3.11
5.3.0135
5.2.07
5.1.812
5.1.711
5.1.612
5.1.59
5.1.41
5.1.39
5.1.2178
5.1.19
5.1.03
5.0.29
5.0.10
5.0.01
4.6.1131
4.6.063
4.5.02
4.4.14
4.4.017
4.3.35
4.3.214
4.3.15
4.3.02
4.2.148
4.2.011
4.1.51
4.1.433
4.1.31
4.1.21
4.1.10
4.1.00
4.0.01
4.0.0-rc0
3.1.15
3.1.011
3.0.031
3.0.0-rc0
2.2.011
2.1.11
2.1.00
2.0.02
1.3.15
1.3.00
1.2.64
1.2.51
1.2.41
1.2.35
1.2.25
1.2.10
1.2.03
1.1.32
1.1.23
1.1.02
1.0.10
1.0.06
1.0.0-rc1
0.2.14
0.2.01
0.1.52
0.1.4104
0.1.35
0.1.26
0.1.14

Package Sidebar

Install

npm i react-native-svg

Weekly Downloads

922,199

Version

15.11.1

License

MIT

Unpacked Size

4.05 MB

Total Files

1482

Last publish

Collaborators

  • brentvatne
  • kmag
  • wolewicki
  • jake7