Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Can I import react-native-vector-icons/font-awesome and react-native-vector-icons/Ionicons on same screen? Basically I want to use both font-awesome and Ionicons icons on same screen for different icons?

Example-
import ActionButton from 'react-native-action-button';
import Icon from 'react-native-vector-icons/font-awesome';
import Icon from 'react-native-vector-icons/Ionicons';
like image 657
Kamlesh Tilwani Avatar asked Nov 18 '25 16:11

Kamlesh Tilwani


1 Answers

Yes, you can. Because FontAwesome and Ionicons are exported as defaults, you can import them with any name, like so

import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import IonIcon from 'react-native-vector-icons/Ionicons';

and in your render() method use like

<FontAwesomeIcon name="github" size={16} color="red">
<IonIcon name="github" size={16} color="blue">
like image 89
magneticz Avatar answered Nov 21 '25 07:11

magneticz