React Native Fontawesome Icons
- No bloatware, one package with one iconset, nothing more nothing less
- Full set of FontAwesome Icons properly updated
- Insanely fast with minimal memory footprint
- Uses the OS to render icons, for best in class performance (refer to performance note bellow)
npm i -g yarn
yarn add react-native-fontawesome
npm i --save react-native-fontawesome
This module uses Font Awesome version 4.7.0. There is no need to link binaries just import the package and include the Font File in your project.
Follow this guides for adding FontAwesome.ttf to your projects:
Adding Custom Fonts to A React Native Application for IOS
Custom Fonts in React Native for Android
import FontAwesome, { Icons } from 'react-native-fontawesome';
...
render() {
return (
<View>
<TouchableHighlight>
<Text style={{margin: 10, fontSize: 15, textAlign: 'left'}}>
<FontAwesome>{Icons.chevronLeft}</FontAwesome>
Text
</Text>
</TouchableHighlight>
</View>
);
},
Javascript don't accept hyphens as valid object names hence all hyphens were removed and names converted to camel case.
Example: th-large
becomes thLarge
You can apply styles directly into the FontAwesome RN component by just passing a style as you do in a <Text>
component.
<FontAwesome style={{fontSize: 32}}>
{Icons.chevronLeft}
</FontAwesome>
This package uses the Text element to render Icons. The Text element delegates to the OS the render process of the icons based on the Font file. Both IOS and Android render fonts amazingly fast with little memory overhead. In essence FontAwesome.ttf will be used by the OS to render icons and will benefit of years of native software improvement as well hardware acceleration.
Take a look on this https://github.com/entria/font-generator, it will generate a TTF font to be used much like this package