as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

react-native-svg

The @amazon-devices/react-native-svg library provides SVG support to React Native on Vega with a compatibility layer for the web.

The @amazon-devices/react-native-svg library supports most SVG elements and properties like Rect, Circle, Line, Polyline, Polygon, and G. This library performs a simple conversion of SVG code to the react-native-svg component.

This library is system-deployed and available to React Native for Vega apps without a separate installation process. The library is deployed as an autolinking library, which your app links to at runtime. The library is guaranteed to be compatible only with the version of React Native for Vega for which it's built.

When you uplevel your app's version of React Native for Vega, consider the best practice of upleveling its library dependencies.

Installation

  1. Add the JavaScript library dependency in the package.json file.

    Copied to clipboard.

     "dependencies": {
         ...
         "@amazon-devices/react-native-svg": "~2.0.0"
    }
    
  2. Reinstall dependencies using the npm install command.

Examples

This example demonstrates how to render a Circle component.

Copied to clipboard.

import { Circle, Svg } from '@amazon-devices/react-native-svg';
import React from 'react';
import { StyleSheet, View } from 'react-native';

const CircleExample = () => {
  return (
    <Svg height="100" width="100">
      <Circle cx="50%" cy="50%" r="40%" fill="pink" />
    </Svg>
  );
};

const App = () => {
  return (
    <View style={styles.container}>
      <CircleExample />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'white',
    flex: 1,
  },
});

export default App;

This example demonstrates how to render a Polygon component.

Copied to clipboard.

import { G, Polygon, Svg } from '@amazon-devices/react-native-svg';
import React from 'react';
import { StyleSheet, View } from 'react-native';

const StarExample = () => {
  return (
    <Svg height="105" width="105">
      <G scale="0.5">
        <Polygon
          points="100,10 40,198 190,78 10,78 160,198"
          fill="lime"
          stroke="purple"
          strokeWidth="5"
        />
      </G>
    </Svg>
  );
};

const App = () => {
  return (
    <View style={styles.container}>
      <StarExample />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'white',
    flex: 1,
  },
});

export default App;

API reference

See the GitHub documentation page for react-native-svg for more information about this library and the API reference.

The SVG library on Vega adds support for the following SVG components and touch events.

Components

Component Description Supported
Svg HOC for other elements. ✅ Yes
Rect Creates a rectangle and variations of a rectangle shape. ✅ Yes
Circle Creates a circle. ✅ Yes
Ellipse Creates an ellipse. An ellipse is similar but different to a circle. An ellipse has an x and a y radius that differs from each other, but a circle has an equal x and y radius. ✅ Yes
Line An SVG basic shape that creates a line connecting two points. ✅ Yes
Path Defines a path. ✅ Yes
Text Defines text. ✅ Yes
TSpan Draws multiple lines of text in SVG. Instead of positioning each line of text absolutely, the element positions a line of text relatively to the previous line of text. ✅ Yes
G A container used to group other SVG elements. ✅ Yes
Image Includes a raster image in an SVG component. ✅ Yes
ClipPath Defines a clipping path. ✅ Yes
Use Reuses an SVG shape from elsewhere in the SVG document. ✅ Yes
Defs Embeds definitions that can be reused inside an SVG image. ✅ Yes
RadialGradient Defines a radial gradient. The element must be nested within a <Defs> tag. ✅ Yes
LinearGradient Defines a linear gradient. The element must be nested within a <Defs> or <Svg> tag. ✅ Yes
Mask Specifies that any other graphics object or G element can be used as an alpha mask for compositing the current object into the background. ✅ Yes
Polygon Creates a graphic that contains at least three sides. Polygons are made of straight lines, and the shape is "closed" (all the lines connect up). ❌ No
Polyline Creates any shape that consists of only straight lines. ❌ No
TextPath Places text along the shape of an element. To specify which block of text, include the text within an element that includes an href attribute with a reference to the element. ❌ No
Symbol Defines reusable symbols. ❌ No
Pattern Fills or strokes an object with a pattern of a pre-defined graphic object. The pattern can be replicated ("tiled") at fixed intervals in x and y to cover the painted areas. ❌ No
patternTransform An SVG specification that transforms the pattern tiles. ❌ No
Marker A symbol attached to one or more vertices of path, line, polyline, and polygon elements. Markers are used to make arrowheads or polymarkers. ❌ No
ForeignObject Includes elements in a non-SVG namespace that are rendered within a region of the SVG graphic, using other user agent processes. ❌ No

Touch events

Event Supported
disabled ❌ No
onPress ❌ No
onPressIn ❌ No
onPressOut ❌ No
onLongPress ❌ No
delayPressIn ❌ No
delayPressOut ❌ No
delayLongPress ❌ No

Supported versions

Package name Amazon NPM library version Vega OS build number Vega SDK version Release notes
@amazon-devices/react-native-svg 2.1.0+13.14.0 OS 1.1 (201010438050) 0.20  

Supported Third-Party Libraries and Services.


Last updated: Sep 30, 2025