# 🎨 React Native FontAwesome

```ts
import { SolidAddressBook } from '@swiftread/fontawesome'

export const Icon = () => <SolidAddressBook />
```

## Overview

This library exports React Native components for each of [FontAwesome's 2,025 free icons](https://fontawesome.com/search?o=r&m=free). Based on [nandorojo's react-native-heroicons](https://github.com/nandorojo/react-native-heroicons).

- 😎 Free, beautiful icons
- 🔥 Customizable with `react-native-svg` props
- 🌲 Tree-shaken components
- 🤖 TypeScript support
- 📈 JS-only (+ works with Expo)




## Installation

```sh
yarn add @swiftread/fontawesome react-native-svg
```

## Usage

Each icon is exported as its own component with an adjusted name.

For example, to use the solid `address-book` icon, import `SolidAddressBook`:

```tsx
import { SolidAddressBook } from '@swiftread/fontawesome'
```

You can also `import * as Fontawesome`:

```tsx
import * as FontAwesome from '@swiftread/fontawesome'

export const Icon = () => <FontAwesome.SolidAddressBook />
```

For a full directory of components, see the [FontAwesome](https://fontawesome.com/search?o=r&m=free) website.

### Custom color

```tsx
<SolidAddressBook color="black" />
```

### Custom size

```tsx
<SolidAddressBook height={30} width={30} />
```

## Props

Each icon component accepts all the props from `react-native-svg`'s `Svg` component. Reference [their docs](https://github.com/react-native-svg/react-native-svg#svg).

## How it works

This library uses `react-native-svg`. The components are generated by `svgr`. I downloaded all the free icons from [FontAwesome](https://fontawesome.com/download) and [ran a script](/generate/index.ts) to codegen the files from there.

## Contributing

Since FontAwesome updates their icons somewhat frequently, you may want to import the new ones. These are the steps to update this library with new icons:

1. Fork this repo
2. Download the full folder of free icons from [FontAwesome](https://fontawesome.com/download)
3. Replace the `generate/fontawesome/svgs` folder with the the `svgs` folder you downloaded
4. Run `yarn install` and `yarn prepare`
5. Commit your changes, and open a PR!
