How can I use different fonts (more than one) of action-native-vector icons in the same file?
2 answers
vector-native-vector-icons exports the <Icon />
default component . You can name your default imports whatever you want. For your example, you can:
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'
import EntypoIcon from 'react-native-vector-icons/Entypo'
This way you can use as many fonts as you like.
+6
source to share
Instead (works for 1 font per file):
Import
import Icon from 'react-native-vector-icons/FontAwesome';
Using:
<Icon name="search" size={20} />
Do this (for 2 or more fonts per file):
Import
import { FontAwesome, Entypo } from 'react-native-vector-icons';
Using:
<FontAwesome name="search" size={20} />
<Entypo name="add-user" size={20} />
-1
source to share