Custom fonts for both Android and iOS
suggest changeThis uses the older rnpm asset flow (react-native link). Current React Native projects declare assets in react-native.config.js instead.
-
Create a folder in your project and add your font files to it.
-
Example: a root folder named
mystuff, thenfonts, with the font files inside: -
Add the following to
package.json:
"rnpm": {
"assets": [
"path/to/fontfolder"
]
}
- For the example above, the path is
mystuff/fonts:
"rnpm": {
"assets": [
"mystuff/fonts"
]
}
- Run
react-native link. - Use the font on a
Textcomponent:
<Text style={{ fontFamily: 'FONT-NAME' }}>My Text</Text>
FONT-NAME depends on the platform.
Android
FONT-NAME is the file name without the extension. If the file is Roboto-Regular.ttf, set fontFamily: 'Roboto-Regular'.
iOS
FONT-NAME is the "Full Name" shown in Get Info (right-click the font file, then Get Info). See this note on font names. In the screenshot below, the file is MM Proxima Nova Ultra bold.otf, but the Full Name is Proxima Nova Semibold, so you set fontFamily: 'Proxima Nova Semibold'.

- Run
react-native run-iosorreact-native run-androidagain so the app rebuilds with the new resources.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents