While developing a project in react native and using icons from IonIcons, I realized that the icons for repeat single tract and repeat queue are absent. I have found suitable icons in the form of an svg, how do I add them to my project? I am using react-native-vector-icons package.
I have tried manually inserting the icon into the font file and change the glyph maps. I have also tried adding a custom font file. Both didn’t work.
2
Answers
To use custom svg icons, you’ll need to install these two dependencies:
react-native-svg
react-native-svg-transformer
(make sure to follow the set-up instructions for both the dependencies)
Once you’ve configured the dependencies, re-build the app. Then, create a reusable svg component as follows which will accept the props
name
,style
,width
,height
.Finally, use this component in any other component as follows (assuming you have saved the svg file as
mySvgIcon.svg
):I don’t know exactly your React Native version, so I try to give you the most detail document.
Here is Link.
Some notes for you: