• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React Native Font Awesome Icons

react-native-fontawesome

React Native Fontawesome Icons

npm version npm downloads

Benefits

  • 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)

Installation process

Using yarn

npm i -g yarn

yarn add react-native-fontawesome

Using npm

npm i --save react-native-fontawesome

This module uses Font Awesome version 5.9.0. There is no need to link binaries just import the package and include the Font File in your project.

This package will not download Font Awesome for you. You have to manually download the font files (Click here to get the right files) and put it into your working folder.

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

Usage

import FontAwesome, { SolidIcons, RegularIcons, BrandIcons } from 'react-native-fontawesome';

...
render() {
  return (
    <View>
        <FontAwesome icon={SolidIcons.smile} />
        <FontAwesome icon={RegularIcons.smileWink} />
        <FontAwesome icon={BrandIcons.github} />
    </View>
  );
},

Note on hyphens

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 parse the name if you want, like this:

import { parseIconName } from 'react-native-fontawesome';

const validIcon = parseIconFromClassName('fas fa-chevron-left') // will be parsed to chevronLeft

// So anywhere you would have used Icons.chevronLeft (or some other icon name) 
// you can now just use the returned value directly (validIcon in this example).  
// The function parseIconName internally returns an BrandIcons[parsedIconName] or SolidIcons[parsedIconName] or RegularIcons[parsedIconName] result.
// So you can use like that:

<FontAwesome style={{fontSize: 32}} icon={validIcon}>

You can use that in some cases when you store the icon from web in you database and then you use dynamically in your mobile.

Styling

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}} icon={BrandIcons.github}>

Click here to get the right font-files.

Warning!

Font Awesome have some paid icons and the link above is for downloading the free icons set. So if you choose some icon from our list, and this icon does not show properly, check if the icon that you choose is a paid one before open a issue. In this case, you must buy the PRO icons set in the Font Awesome's PRO website. In case you are using a paid icon, and you are using a paid icon set that you already bough, you must pass a pro property to the icon, like this:

<FontAwesome icon={RegularIcons.exclamationTriangle} pro={true}>

Why this is fast, and uses almost no extra memory

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.

Do you want to create a Custom Font with your Icons?

Take a look on this https://github.com/entria/font-generator, it will generate a TTF font to be used much like this package

Sample project

In this repository you'll find a sample/ folder that contains a working sample project, tested on both, Android and IOS. You can see here how to build and run the application

More Repositories

1

entria-fullstack

Monorepo Playground with GraphQL, React, React Native, Relay Modern, TypeScript and Jest
TypeScript
496
star
2

jobs

Come and join the Entria team
JavaScript
396
star
3

graphql-dataloader-boilerplate

Very simple boilerplate using GraphQL and DataLoader
JavaScript
394
star
4

react-native-view-overflow

Fix Overflow in react-native for Android
Objective-C
304
star
5

koa-passport-mongoose-graphql

Koa 2 server with Passport + Mongoose + GraphQL
JavaScript
193
star
6

ReactNavigationRelayModern

React Navigation integration with Relay
JavaScript
173
star
7

awesome-pix

Awesome PIX
145
star
8

graphql-mongoose-loader

GraphQL Mongoose Loader helpers
TypeScript
115
star
9

graphql-mongo-helpers

GraphQL + MongoDB helpers that scale
TypeScript
82
star
10

react-app-loader

Production ready library for handling Microfrontends
JavaScript
75
star
11

entria-deploy

Entria Deploy helpers
TypeScript
56
star
12

graphql-vigilant-bot

Github Bot to find breaking changes in your schema.graphql
JavaScript
55
star
13

guidelines

Entria Guidelines - this is how we build software!
52
star
14

font-generator

Generate ttf font and Icons.js for React Native usage
JavaScript
46
star
15

hyperledger-fabric-graphql-boilerplate

Hyperledger Fabric GraphQL Boilerplate
JavaScript
45
star
16

graphql-find-breaking-changes-cli

Find Breaking Changes against 2 .graphql schema versions
JavaScript
44
star
17

graphql-dataloader-boilerplate-ts

Entria's https://github.com/entria/graphql-dataloader-boilerplate using TypeScript
TypeScript
44
star
18

codemods

Node.js/Javascript codemods used at @entria
TypeScript
40
star
19

awesome-woovi-challenge

Awesome Woovi Challenges
37
star
20

docker-react-native-android

Docker image used to build React Native projects for Android
Dockerfile
28
star
21

graphql-optimizing

GraphQL Request Watterfalls Optimizations
JavaScript
27
star
22

react-native-visa-checkout

Objective-C
27
star
23

restria

Entria's REST API boilerplate
JavaScript
27
star
24

woovi-playground

TypeScript
24
star
25

apiWithLog

Powerful Fetch
TypeScript
22
star
26

entria-components

Entria common components
JavaScript
19
star
27

entria-graphql

GraphQL Generators for Entria Projects
JavaScript
19
star
28

node-printer

node-printer fork
C++
19
star
29

relay-utils

Relay utility methods
JavaScript
17
star
30

flow-typed-wip

A central repository for Flow-Typed WIP library definitions
17
star
31

responsiveness

Responsive style tools for ReactJS
JavaScript
15
star
32

api

API wrapper on top of fetch using flow generics
JavaScript
14
star
33

graphql-pg-loader

GraphQL PG Loader and Connection helpers
14
star
34

mongo-aggregate-lodash

Mongo aggregate helpers similar to lodash utilities
JavaScript
13
star
35

datalist

Turns your data into a table with Relay Modern RefetchContainer
JavaScript
12
star
36

toNamedParametersCodemod

I bet you gonna need this
TypeScript
12
star
37

formia

Entria forms
JavaScript
11
star
38

graphql-dataloader-boilerplate-reason

JavaScript
10
star
39

yarn-package-boilerplate

An Yarn package with babel, jest, flow, prettier and more
JavaScript
9
star
40

entria-workshop

JavaScript
9
star
41

atom-entria-snippets

Atom Snippets for React, React Router, Redux, GraphQL and Relay
JavaScript
9
star
42

woovi-dev

Some Woovi development files
9
star
43

entria-utils

JavaScript
8
star
44

cli-yargs-boilerplate

Simple Yargs boilerplate to create a CLI (command line interface)
JavaScript
8
star
45

mongodb-backup-docker

MongoDB Backup Docker
Shell
8
star
46

debug-mongoose-aggregate

Simple aggregate debugger for mongoose
JavaScript
8
star
47

woovi-backend-graphql

Woovi GraphQL Backend Server Example
TypeScript
7
star
48

n8n-nodes-woovi

Automated workflow on N8N + Woovi
TypeScript
7
star
49

swaggerGraphQLMocked

Mock a swagger json using GraphQL
JavaScript
7
star
50

eslint-config-entria

Eslint config to be shared on entria projects
6
star
51

react-native-datami

Objective-C++
4
star
52

fantasyland

Everything we're talking, searching and discussing about fantasyland specs.
4
star
53

redis-flush-all-forever

Connects to a redis server and issue FLUSHALL command
JavaScript
2
star
54

docker-thumbor

https://hub.docker.com/r/feedbackhouse/thumbor
Smarty
1
star
55

circleci-automation

cli tool to cancel redundants builds
JavaScript
1
star
56

bugs-omie

Melhorias e Bugs da Plataforma Omie
1
star