TheSoul
TheSoul

Reputation: 5356

react-native-vector-icons: Using FontAwesome

I am trying to use FontAwesome icons in my react-native app using this library react-native-vector-icons. I have followed the installation process (npm install, link, updating my gradle.properties...) Then in my code I import the Icon like this:

const Icon = require('react-native-vector-icons/FontAwesome');

And I use it in my render method:

<Button>
  <Icon name='home' />                        
</Button>

Unfortunately at runtime, this blows up with this error:

enter image description here

How can I use Fontawesome icons in my react-native app?

Thanks for your help

Upvotes: 1

Views: 2942

Answers (1)

max23_
max23_

Reputation: 6689

You have to use import instead:

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

Upvotes: 4

Related Questions