1yarn add react-native-svg
2yarn add react-native-svg-uri
3npx react-native link react-native-svg
4...
5import * as React from 'react';
6import SvgUri from 'react-native-svg-uri'; // SVG Package
7import testSvg from './test.svg'; // SVG File
8export default () => (
9 <SvgUri width="200" height="200" svgXmlData={testSvg}/>
10);
1npm add react-native-svg --save
2npm install react-native-svg-transformer --save
3
4
5//Add this this to metro.config.js
6const { getDefaultConfig } = require("metro-config");
7
8module.exports = (async () => {
9 const {
10 resolver: {
11 sourceExts,
12 assetExts
13 }
14 } = await getDefaultConfig();
15
16 return {
17 transformer: {
18 babelTransformerPath: require.resolve("react-native-svg-transformer")
19 },
20 resolver: {
21 assetExts: assetExts.filter(ext => ext !== "svg"),
22 sourceExts: [...sourceExts, "svg"]
23 }};
24})();