What is the easiest way to do this? I found plenty of svg to JSX converters, which is what I want, but that doesn\'t work in react-native. I need to convert the svg code to some
I'm using expo for building react native app and I had the same inquiry but I found some solution here react-native-svg. I use the XML Option which was as below.
STEP 1- first I used this link convert SVG to JSX for React to convert the SVG to JSX (Some times you don't need to convert it, it depends on icon itself).
STEP 2- open new file component and import react and import { SvgXml } from 'react-native-svg'
, then create a normal functional component inside.
STEP 3- wrap the converted SVG icon tag with Quotation mark to be like this ""
then store it in a variable var, const, let..etc.
STEP 4- return
.
STEP 5- export the component as usual.
here is an example code
import React from 'react'
import { SvgXml } from 'react-native-svg';
function FastRunningIcon(props) {
const xml = ``
return
}
export default FastRunningIcon;