Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native react-native-vector-icons: How to use font awesome icons

In my react-native application I have added this library react-native-vector-icons to use icons. From the github page, FontAwesome is listed among the bundled icon sets. But I don't see how I can reference a fontawesome item in my element. It seems that I can only use "ios-xxx", "md-xxx" or "log-xxx".

When I try something like:

<Icon name='fa-rss' style={{marginRight:10}} /> 

I get this warning:

enter image description here

like image 911
TheSoul Avatar asked Dec 27 '16 09:12

TheSoul


People also ask

How do I use Font Awesome icons in react-native?

Use of Font-Awesome Icon in React NativeYou can apply styles directly into the FontAwesome RN component by just passing a style as you do in a <Text> component. You need to pass the icon name which you can get from the Official Site. There are many filters to find the Icon of your need.

Can I use Expo vector icons in react-native?

@expo/vector-icons This library is installed by default on the template project using npx create-expo-app and is part of the expo package. It is built on top of react-native-vector-icons and uses a similar API. It includes popular icon sets that you can browse at icons.

How do you install react-native vector icons in react-native?

Installation of React Native Vector Icons. 1. Open your react native project folder in command prompt and execute the below code: npm install react-native-vector-icons --save.


1 Answers

Use

import Icon from 'react-native-vector-icons/FontAwesome';

<Icon name="rss" size={30} color="#900" />
like image 188
Ahmed Ali Avatar answered Sep 24 '22 07:09

Ahmed Ali