MCPcopy
hub / github.com/software-mansion/react-native-svg

github.com/software-mansion/react-native-svg @v15.15.5 sqlite

repository ↗ · DeepWiki ↗ · release v15.15.5 ↗
2,935 symbols 6,336 edges 410 files 28 documented · 1%
README

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

bash npm install react-native-svg

from yarn

bash yarn add react-native-svg

  1. Link native code

bash 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
>=15.13.0 >=0.78.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.

Extension points exported contracts — how you extend this code

RNSVGDefsManagerInterface (Interface)
(no doc) [2 implementers]
android/src/paper/java/com/facebook/react/viewmanagers/RNSVGDefsManagerInterface.java
SVGPoint (Interface)
(no doc) [1 implementers]
src/elements/Shape.tsx
Example (Interface)
(no doc)
apps/common/example/utils/types.ts
AST (Interface)
(no doc)
src/xml.tsx
FilterImageProps (Interface)
(no doc)
src/filter-image/FilterImage.tsx
FilterPrimitiveCommonProps (Interface)
(no doc)
src/lib/extract/extractFilter.ts
SvgNodeCommonProps (Interface)
(no doc)
src/fabric/TextPathNativeComponent.ts
StyledAST (Interface)
(no doc)
src/css/css.tsx

Core symbols most depended-on inside this repo

invalidate
called by 169
android/src/main/java/com/horcrux/svg/SvgView.java
peg$fail
called by 79
src/filter-image/extract/extractFiltersString.js
from
called by 67
android/src/main/java/com/horcrux/svg/SVGLength.java
peg$parse_
called by 66
src/filter-image/extract/extractFiltersString.js
get
called by 54
android/src/main/java/com/horcrux/svg/SvgPackage.java
parse_list_number
called by 54
android/src/main/java/com/horcrux/svg/PathParser.java
peg$parsewsp
called by 46
src/lib/extract/transform.js
peg$fail
called by 41
src/lib/extract/transformToRn.js

Shape

Method 1,792
Function 563
Class 349
Interface 206
Enum 25

Languages

Java64%
TypeScript36%

Modules by API surface

android/src/main/java/com/horcrux/svg/RenderableViewManager.java261 symbols
src/elements.web.ts102 symbols
src/filter-image/extract/extractFiltersString.js74 symbols
src/lib/extract/transform.js64 symbols
android/src/main/java/com/horcrux/svg/SvgViewManager.java59 symbols
android/src/main/java/com/horcrux/svg/SvgView.java50 symbols
src/lib/extract/transformToRn.js49 symbols
android/src/paper/java/com/facebook/react/viewmanagers/RNSVGSvgViewAndroidManagerInterface.java49 symbols
android/src/paper/java/com/facebook/react/viewmanagers/RNSVGTextPathManagerInterface.java48 symbols
src/css/css.tsx46 symbols
android/src/main/java/com/horcrux/svg/VirtualView.java46 symbols
android/src/paper/java/com/facebook/react/viewmanagers/RNSVGPatternManagerInterface.java44 symbols

Dependencies from manifests, versioned

@babel/core7.25.2 · 1×
@babel/preset-env7.25.3 · 1×
@babel/runtime7.20.0 · 1×
@expo/metro-runtime6.1.2 · 1×
@expo/vector-icons15.0.2 · 1×
@react-native-async-storage/async-storage2.0.0 · 1×
@react-native-community/cli20.0.0 · 1×
@react-native-community/cli-platform-android20.0.0 · 1×
@react-native-community/cli-platform-ios20.0.0 · 1×
@react-native-community/eslint-config3.0.0 · 1×
@react-native/babel-preset0.77.0 · 1×
@react-native/eslint-config0.77.0 · 1×

For agents

$ claude mcp add react-native-svg \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact