Skip to content

Instantly share code, notes, and snippets.

@dayaki
Created March 2, 2019 23:23
Show Gist options
  • Save dayaki/d981971db9f33e35aa7a259f4d6d483f to your computer and use it in GitHub Desktop.
Save dayaki/d981971db9f33e35aa7a259f4d6d483f to your computer and use it in GitHub Desktop.
Use custom fonts in React Native
1. Put all your fonts in you React-Native project directory
`./assets/fonts/`
2. Add the following line in your package.json
```
"rnpm": {
"assets": ["./assets/fonts"]
}
```
3. finally run in the terminal from your project directory
`react-native link`
4. to use it declare this way in your styles
`fontFamily: 'your-font-name without extension'`
If your font is Raleway-Bold.ttf then,
`fontFamily: 'Raleway-Bold'`
@dayaki
Copy link
Author

dayaki commented Mar 2, 2019

./assets/fonts/

"rnpm": {
  "assets": ["./assets/fonts"]
}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment