Reputation: 5356
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:
How can I use Fontawesome icons in my react-native app?
Thanks for your help
Upvotes: 1
Views: 2942
Reputation: 6689
You have to use import
instead:
import Icon from 'react-native-vector-icons/FontAwesome';
Upvotes: 4