### Start Example App (iOS) Source: https://github.com/software-mansion/react-native-svg/blob/main/CONTRIBUTING.md Launches the example application on an iOS simulator or device. Ensure the Metro server is running. ```bash yarn ios ``` -------------------------------- ### Start Example App (Android) Source: https://github.com/software-mansion/react-native-svg/blob/main/CONTRIBUTING.md Launches the example application on an Android device or emulator. Ensure the Metro server is running. ```bash yarn android ``` -------------------------------- ### Line Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/shape-elements.md Render a straight line with start and end coordinates, stroke color, and stroke width. ```jsx import { Line } from 'react-native-svg'; ``` -------------------------------- ### Complete SVG Configuration Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/configuration.md A comprehensive example demonstrating the setup of a React Native SVG component, including rendering size, default styling, transforms, accessibility, touch handling, and nested elements with gradients. ```jsx import React from 'react'; import { Svg, Rect, Circle, Defs, LinearGradient, Stop } from 'react-native-svg'; export const ConfiguredSvg = () => ( console.log('SVG pressed')} > ); ``` -------------------------------- ### Using FillRule Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/types.md Example of setting the fillRule attribute for a Path component, using 'evenodd' to determine how the inside of a shape is determined. ```jsx ``` -------------------------------- ### Using Transform Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/types.md Example of applying a 2D transformation to a G (group) element using an array representing the transformation matrix. ```jsx ``` -------------------------------- ### Basic SVG with Shapes Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/svg-root.md A basic example demonstrating how to create an SVG element and render shapes like Rect, Circle, and Line within it. ```jsx import React from 'react'; import { View } from 'react-native'; import Svg, { Circle, Rect, Line } from 'react-native-svg'; export const BasicSvg = () => ( ); ``` -------------------------------- ### Line Element Example Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Shows how to draw a line connecting two points using the Line element. Properties x1, y1, x2, y2 define the start and end points, while stroke and strokeWidth style the line. ```jsx ``` -------------------------------- ### Rect Examples Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/shape-elements.md Render a basic rectangle with position, dimensions, and fill, or a rectangle with rounded corners. ```jsx import { Rect } from 'react-native-svg'; // Basic rectangle // Rectangle with rounded corners ``` -------------------------------- ### Install react-native-svg with yarn Source: https://github.com/software-mansion/react-native-svg/blob/main/README.md Install the react-native-svg library using yarn. This command is used for projects managed with yarn. ```bash yarn add react-native-svg ``` -------------------------------- ### Responsive SVG with ViewBox Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/svg-root.md Demonstrates creating a responsive SVG that adjusts its size based on the window dimensions and uses viewBox and preserveAspectRatio for scaling. ```jsx import React from 'react'; import { Dimensions } from 'react-native'; import Svg, { Circle } from 'react-native-svg'; export const ResponsiveSvg = () => { const { width } = Dimensions.get('window'); const size = Math.min(width, 300); return ( ); }; ``` -------------------------------- ### Circle Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/shape-elements.md Render a basic circle with specified center coordinates, radius, fill, stroke, and stroke width. ```jsx import { Circle } from 'react-native-svg'; ``` -------------------------------- ### Rendering Multiple Markers on a Path Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md This example demonstrates applying different markers (start, mid, and end) to a single path element. It uses SvgXml to render an SVG string containing multiple marker definitions and a path utilizing them. ```jsx import React from 'react'; import { StyleSheet, View } from 'react-native'; import { SvgXml } from 'react-native-svg'; const markerRendering = ` `; export default class App extends React.Component { render() { return ( ); } } const styles = StyleSheet.create({ container: { backgroundColor: 'white', justifyContent: 'center', alignItems: 'center', flex: 1, }, }); ``` -------------------------------- ### Polyline Examples Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/shape-elements.md Render an open polyline using points defined as a string or an array, with stroke and fill properties. ```jsx import { Polyline } from 'react-native-svg'; // As string // As array ``` -------------------------------- ### Install react-native-svg with npm Source: https://github.com/software-mansion/react-native-svg/blob/main/README.md Install the react-native-svg library using npm. This is a common step for projects managed with npm. ```bash npm install react-native-svg ``` -------------------------------- ### FeMerge Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/filter-elements.md Combines multiple filter primitive results into a single output. This example applies a blur and then merges it with the original graphic. ```jsx ``` -------------------------------- ### Complete Filter Example with Drop Shadow Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/filter-elements.md This example demonstrates how to define and apply a drop shadow filter to multiple shapes within an SVG. It includes setting up the filter in Defs and applying it using the filter prop. ```jsx import React from 'react'; import { Svg, Defs, Filter, FeGaussianBlur, FeMerge, FeOffset, FeMergeNode, Rect, Circle } from 'react-native-svg'; export const FilterExample = () => ( {/* Drop shadow filter */} ); ``` -------------------------------- ### Using FontWeight Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/types.md Demonstrates setting the fontWeight property for a Text component using either a keyword like 'bold' or a numeric string like '600'. ```jsx ``` -------------------------------- ### Link native code for iOS Source: https://github.com/software-mansion/react-native-svg/blob/main/README.md After installing the library, run this command in the 'ios' directory to link the native code for iOS projects. ```bash cd ios && pod install ``` -------------------------------- ### FeBlend Element Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/filter-elements.md Shows how to use FeBlend to combine two inputs with a specified blend mode. The 'mode' prop determines the blending operation. ```jsx ``` -------------------------------- ### FeTurbulence Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/filter-elements.md Generates a fractal noise texture. This example creates a marble-like effect using fractal noise with specified frequency and octaves. ```jsx ``` -------------------------------- ### Using NumberProp Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/types.md Example of using NumberProp for numeric or percentage-based values in SVG attributes like cx, cy, and r. ```jsx ``` -------------------------------- ### SVG Export to Data URL Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/svg-root.md An example showing how to export an SVG to a base64 data URL using the `toDataURL` method and a ref. This is useful for saving or sharing the SVG. ```jsx import React, { useRef } from 'react'; import { TouchableOpacity, Text } from 'react-native'; import Svg, { Path } from 'react-native-svg'; export const ExportableSvg = () => { const svgRef = useRef(null); const exportImage = () => { svgRef.current?.toDataURL((base64) => { // Use base64 string to save file, share, etc. console.log(base64); }); }; return ( Tap to Export ); }; ``` -------------------------------- ### Run E2E Tests Source: https://github.com/software-mansion/react-native-svg/blob/main/CONTRIBUTING.md Executes the end-to-end tests for the project. Ensure you have followed the setup instructions for E2E testing. ```bash yarn e2e ``` -------------------------------- ### Rect Element Example Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Shows how to create a rectangle using the Rect element. Properties like x, y, width, height, fill, strokeWidth, and stroke are demonstrated. ```jsx ``` -------------------------------- ### Svg toDataURL Method Usage Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/svg-root.md Example of using the `toDataURL` method on an SVG component's ref to get its base64 representation. This is typically used within a component that handles exporting or saving the SVG. ```jsx const svgRef = useRef(null); const handleExport = () => { svgRef.current?.toDataURL((base64) => { console.log('SVG as data URL:', base64); }); }; return ( <> Export ); ``` -------------------------------- ### FeComponentTransfer Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/filter-elements.md Remaps color components (Red, Green, Blue, Alpha) using transfer functions. This example increases brightness by scaling RGB channels. ```jsx ``` -------------------------------- ### Polygon Element Example Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Demonstrates creating a polygon with at least three sides using the Polygon element. The 'points' prop defines the coordinates of each corner. ```jsx ``` -------------------------------- ### Install react-native-svg with Expo Source: https://github.com/software-mansion/react-native-svg/blob/main/README.md Use this command to install react-native-svg when working with Expo. The Expo client app includes the necessary native code. ```bash npx expo install react-native-svg ``` -------------------------------- ### Using NumberArray Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/types.md Example of using NumberArray for attributes like x and y in the Text component, accepting an array of numbers or a percentage string. ```jsx A B C ``` -------------------------------- ### FeOffset Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/filter-elements.md Applies a horizontal and vertical offset to an input graphic, commonly used for creating drop shadows. ```jsx ``` -------------------------------- ### Circle Element Example Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Demonstrates the creation of a circle using the Circle element. Key properties include cx, cy for the center coordinates, r for the radius, and fill for the color. ```jsx ``` -------------------------------- ### Polygon Examples Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/shape-elements.md Render a closed polygon using points defined as a string or an array, with fill and stroke properties. ```jsx import { Polygon } from 'react-native-svg'; // As string // As array ``` -------------------------------- ### Ellipse Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/shape-elements.md Render an ellipse with specified center coordinates, horizontal and vertical radii, and fill color. ```jsx import { Ellipse } from 'react-native-svg'; ``` -------------------------------- ### Svg Component with ViewBox Examples Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/configuration.md Demonstrates different configurations for the viewBox attribute to define the SVG coordinate system. Use these to set the origin and scale of your SVG content. ```jsx // Standard square (origin at 0,0, 100x100 units) ``` ```jsx // Offset origin (start at 50,50) ``` ```jsx // High-resolution coordinates ``` -------------------------------- ### Linear Gradient with Percentage Props Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Demonstrates using percentage values for gradient start and end points, and color stops. While functional, using exact numbers is recommended for performance. ```jsx ``` -------------------------------- ### SVG Pattern Example Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Illustrates how to create a pattern using a Path element and apply it to an Ellipse. The pattern consists of red triangles with blue strokes, tiled to fill the ellipse. ```jsx ``` -------------------------------- ### LinearGradient Example: Diagonal with Opacity Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/gradient-elements.md Creates a diagonal gradient with varying opacity using multiple Stop elements. ```jsx import { Svg, Defs, LinearGradient, Stop, Rect } from 'react-native-svg'; // Diagonal gradient with opacity ``` -------------------------------- ### LinearGradient Example: Multiple Stops (Rainbow) Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/gradient-elements.md Demonstrates a linear gradient with multiple color stops to create a rainbow effect. ```jsx import { Svg, Defs, LinearGradient, Stop, Rect } from 'react-native-svg'; // Multiple gradient stops ``` -------------------------------- ### Basic SVG Rendering Example Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Renders a Circle and a Rect within an SVG component. Ensure all necessary components from 'react-native-svg' are imported. ```jsx import Svg, { Circle, Ellipse, G, Text, TSpan, TextPath, Path, Polygon, Polyline, Line, Rect, Use, Image, Symbol, Defs, LinearGradient, RadialGradient, Stop, ClipPath, Pattern, Mask, } from 'react-native-svg'; import React from 'react'; import { View, StyleSheet } from 'react-native'; export default class SvgExample extends React.Component { render() { return ( ); } } ``` -------------------------------- ### Example Usage of Defs with LinearGradient and ClipPath Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/definition-container-elements.md Demonstrates how to use the Defs element to define a LinearGradient and a ClipPath, which are then applied to a Rect element. Ensure that the 'id' attributes match the 'url(#id)' references. ```jsx import { Svg, Defs, LinearGradient, Stop, ClipPath, Rect } from 'react-native-svg'; ``` -------------------------------- ### FeFlood Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/filter-elements.md Fills a filter region with a solid color and opacity. Useful for creating colored backgrounds or overlays within filters. ```jsx ``` -------------------------------- ### TextPath Usage Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/text-elements.md Shows how to render text along a specified path using the TextPath component, with examples for curved and arc paths. ```APIDOC ## TextPath ### Description Renders text that follows a specified path, enabling curved or non-linear text placement. It requires a reference to a `Path` element with an `id`. ### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | `href` | `string` | — | Reference to a Path element (e.g., "#pathId") | | `xlinkHref` | `string` | — | Deprecated: use `href` instead | | `startOffset` | `NumberProp` | `0` | Offset along the path (0-100% or absolute units) | | `method` | `TextPathMethod` | — | Positioning method (align, stretch) | | `spacing` | `TextPathSpacing` | — | Spacing style (auto, exact) | | `midLine` | `TextPathMidLine` | — | Midline rendering (sharp, smooth) | | `side` | `string` | — | Which side of path to place text | | `fontSize` | `NumberProp` | — | Font size | | `fontFamily` | `string` | — | Font family | | `fontWeight` | `FontWeight` | — | Font weight | | `fill` | `ColorValue` | — | Text color | | `children` | `TextChild` | — | Text content | | ... | ... | — | Inherits TextSpecificProps | ### Requirements - Must reference a valid Path element using `href` or `xlinkHref`. - The referenced path must have an `id` attribute. - Falls back to rendering as TSpan if href is invalid. ### Example ```jsx import { Svg, Path, Text, TextPath, Defs } from 'react-native-svg'; // Text following a curved path Text on curved path // Text following an arc Following an arc // Multiple text paths on different paths Top curve Bottom curve ``` ``` -------------------------------- ### FeDropShadow Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/filter-elements.md Use FeDropShadow to create a drop shadow effect for an element. Specify offsets, blur, color, and opacity for the shadow. ```jsx ``` -------------------------------- ### Ellipse Element Example Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Illustrates how to create an ellipse using the Ellipse element. Properties like cx, cy for the center, rx for the horizontal radius, ry for the vertical radius, and fill/stroke are shown. ```jsx ``` -------------------------------- ### Complete Gradient Example with Multiple Gradients Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/gradient-elements.md Demonstrates the use of multiple linear and radial gradients within a single SVG, applied to different shapes. This shows how to combine various gradient types for complex visuals. ```jsx import React from 'react'; import { Svg, Defs, LinearGradient, RadialGradient, Stop, Rect, Circle, G } from 'react-native-svg'; export const GradientExample = () => ( {/* Linear gradient for background */} {/* Radial gradient for spotlight effect */} {/* Linear gradient for shape */} {/* Background */} {/* Spotlight effect */} {/* Shape with gradient */} ); ``` -------------------------------- ### Applying Markers to Multiple Paths with Shared Definitions Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md This example shows how to define a marker once and apply it to multiple path elements within a group. The 'marker-end' property is used on both the group and individual paths. ```jsx import React from 'react'; import { StyleSheet, View } from 'react-native'; import { SvgXml } from 'react-native-svg'; const markerRendering = ` `; export default class App extends React.Component { render() { return ( ); } } const styles = StyleSheet.create({ container: { backgroundColor: 'white', justifyContent: 'center', alignItems: 'center', flex: 1, }, }); ``` -------------------------------- ### SVG Component Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/xml-parsing.md A complete React Native component demonstrating the usage of `SvgXml`, `SvgUri`, and `SvgFromXml` for rendering SVGs from inline XML, URLs, and with class component control. ```jsx import React, { useState, useRef } from 'react'; import { View, Text, ScrollView, ActivityIndicator, TouchableOpacity, } from 'react-native'; import { SvgXml, SvgUri, SvgFromXml, parse } from 'react-native-svg'; const sampleSvg = ` `; export const ParseExample = () => { const [selectedTab, setSelectedTab] = useState('xml'); const fromXmlRef = useRef(null); return ( {/* SvgXml - Simple inline parsing */} {selectedTab === 'xml' && ( Using SvgXml: console.log('Error:', e)} fallback={Parse failed} /> )} {/* SvgUri - Load from URL */} {selectedTab === 'uri' && ( Using SvgUri: } /> )} {/* SvgFromXml - Class component with control */} {selectedTab === 'class' && ( Using SvgFromXml: fromXmlRef.current?.parse(sampleSvg)} > Re-parse )} ); }; ``` -------------------------------- ### Example Usage of Symbol and Use for Reusable Shapes Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/definition-container-elements.md Shows how to define a reusable 'star' symbol using the Symbol element within Defs, and then instantiate it multiple times using the Use element with different positions and sizes. The 'viewBox' prop on Symbol is crucial for defining its internal coordinate system. ```jsx import { Svg, Defs, Symbol, Path, Use } from 'react-native-svg'; ``` -------------------------------- ### Complex Clip Path Example with Image Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/definition-container-elements.md Uses a ClipPath with a rounded rectangle to mask an Image element. This demonstrates applying clipping to more complex shapes and external resources. ```jsx import { Svg, Defs, ClipPath, Rect, Image } from 'react-native-svg'; // Complex clip path ``` -------------------------------- ### Apply Filters Prop to FilterImage Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md This example shows how to apply filters to a FilterImage component using the 'filters' prop. It accepts an array of filter objects, each specifying the filter name, type, and values. ```tsx import React from 'react'; import { StyleSheet } from 'react-native'; import { FilterImage } from 'react-native-svg/filter-image'; const myImage = require('./myImage.jpg'); export default () => { return ( ); }; const styles = StyleSheet.create({ image: { width: 200, height: 200, }, }); ``` -------------------------------- ### Simple Repeating Pattern Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/definition-container-elements.md Shows how to create a simple repeating pattern using the Pattern element in React Native SVG. The pattern is defined in Defs and applied to a Rect element. ```jsx import { Svg, Defs, Pattern, Rect, Circle } from 'react-native-svg'; // Simple repeating pattern ``` -------------------------------- ### SVG Mask Example Source: https://github.com/software-mansion/react-native-svg/blob/main/USAGE.md Demonstrates how to use a LinearGradient to create a mask for text. The mask is applied to a blue text element, revealing it only where the gradient is opaque. A fallback text with a black stroke is also shown. ```jsx Masked text ``` -------------------------------- ### Add Windows support to React Native project Source: https://github.com/software-mansion/react-native-svg/blob/main/README.md Initialize Windows support for your React Native project using this command, then run the application on Windows. ```bash npx react-native-windows-init --overwrite react-native run-windows ``` -------------------------------- ### Circular Clip Path Example Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/definition-container-elements.md Applies a circular clipping path to a red rectangle, revealing only the portion within the circle. The 'clipPath' prop on the Rect element references the ClipPath defined in Defs by its 'id'. ```jsx import { Svg, Defs, ClipPath, Circle, Rect } from 'react-native-svg'; // Circular clip mask ``` -------------------------------- ### Run project on iOS and Android Source: https://github.com/software-mansion/react-native-svg/blob/main/README.md After setting up a clean project, use these commands to run your application on iOS and Android simulators or devices. ```bash react-native run-ios react-native run-android ``` -------------------------------- ### Basic Text Rendering Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/text-elements.md Renders a simple 'Hello World' text string with specified position, font size, and fill color. ```jsx import { Svg, Text } from 'react-native-svg'; // Basic text Hello World ``` -------------------------------- ### LinearGradient Example: Vertical Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/gradient-elements.md Defines a vertical linear gradient from yellow to green, applied to a rectangle. ```jsx import { Svg, Defs, LinearGradient, Stop, Rect } from 'react-native-svg'; // Vertical gradient (top to bottom) ``` -------------------------------- ### TextAnchor Type Alias Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/types.md Defines the horizontal alignment of text. Options are 'start', 'middle', or 'end'. ```typescript type TextAnchor = 'start' | 'middle' | 'end'; ``` -------------------------------- ### Create a clean project for troubleshooting Source: https://github.com/software-mansion/react-native-svg/blob/main/README.md To troubleshoot unexpected behavior, create a new React Native project and add react-native-svg to isolate the issue. This ensures a clean environment for testing. ```bash react-native init CleanProject cd CleanProject/ yarn add react-native-svg cd ios && pod install && cd .. ``` -------------------------------- ### Main Entry Point Imports Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/README.md This section shows the main components and utilities that can be imported directly from the 'react-native-svg' package. ```APIDOC ## Main Entry Point ### Imports ```typescript import { // Root SVG Svg, // Shape Elements Circle, Ellipse, Rect, Line, Polygon, Polyline, Path, // Text Elements Text, TSpan, TextPath, // Container Elements G, Symbol, Use, ForeignObject, Image, // Definition Elements Defs, ClipPath, Mask, Pattern, // Gradient Elements LinearGradient, RadialGradient, Stop, // Marker Element Marker, // Filter Elements Filter, FeBlend, FeGaussianBlur, FeColorMatrix, FeComposite, FeOffset, FeMerge, FeFlood, FeImage, FeComponentTransfer, FeFuncR, FeFuncG, FeFuncB, FeFuncA, FeConvolveMatrix, FeDiffuseLighting, FeDisplacementMap, FeDistantLight, FeDropShadow, FePointLight, FeSpecularLighting, FeSpotLight, FeMorphology, FeTurbulence, FeTile, // Shape base class Shape, // XML Parsing SvgXml, SvgUri, SvgFromXml, SvgFromUri, SvgAst, parse, camelCase, fetchText, // Types AstProps, JsxAST, Middleware, Styles, UriProps, UriState, XmlAST, XmlProps, XmlState, } from 'react-native-svg'; ``` ``` -------------------------------- ### LinearGradient Example: Horizontal Source: https://github.com/software-mansion/react-native-svg/blob/main/_autodocs/api-reference/gradient-elements.md Defines a simple horizontal linear gradient from red to blue, used to fill a rectangle. ```jsx import { Svg, Defs, LinearGradient, Stop, Rect } from 'react-native-svg'; // Simple horizontal gradient (left to right) ```