Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with "react-native-vector-icons" in React native

Tags:

react-native

I install this library :

npm install react-native-vector-icons

and link it

react native link

and i import it to my project

import Icon from 'react-native-vector-icons/Ionicons'

then i use it in render part of the component like this :

<Icon name={'ios-person-outline'} />

But when i run the android app there is no error but the icon is a qustion icon eny body has idea ?

like image 473
MoHammaD ReZa DehGhani Avatar asked Dec 03 '22 19:12

MoHammaD ReZa DehGhani


1 Answers

I used to have similar issues when I started with react-native-vector-icons until I got to understand the different type components.

type="AntDesign"

type="Entypo"

type="FontAwesome"

type="FontAwesome5"

type="FontAwesome5Brands"

type="Foundation"

type="Ionicons"

type="MaterialCommunityIcons"

type="MaterialIcons"

type="SimpleLineIcons"

type="Octicons"

etc...

Icon name "person-outline" can be found under "MaterialIcons" on "https://oblador.github.io/react-native-vector-icons/", so we can do;

<Icon name='person-outline' type="MaterialIcons" />

Hope this explanation helps.

NOTE: Make sure you take the initial steps like;

npm install react-native-vector-icons --save

AND

react-native link react-native-vector-icons
like image 200
Victor Ejiogu Avatar answered Dec 06 '22 10:12

Victor Ejiogu