React Native Custom Fonts

Dave Hudson
Jun 5, 2017 · 3 min read

TLDR => Quick tutorial on setting up custom fonts with React Native across iOS and Android.

Cross Platform Custom Font Naming

To avoid conditional logic in your React Native styles it’s a good plan to rename a font if necessary to ensure it is read the same on both iOS and Android.

For example, I’m using a font file named “vinchand.ttf”. Yet when I open it up in I can see that the fonts full name is “vincHand” with a capital H.

Image for post
Image for post

To ensure things run smoothly I’m going to rename the font to be “vincHand.ttf” as Android will read from the filename whilst iOS will read from the full name property.

Add Fonts to Assets

Next add all the font files you want to an “assets/fonts” folder in the root of your react native project:

Image for post
Image for post


Next we need to tell React Native where our custom fonts are located. We do this by adding rnpm to package.json providing the path to the font files:

Then we tell react native to link those font files for us:

This should add the font references in your Info.plist file for iOS and on Android copy the font files to android/app/src/main/assets/fonts. You can verify this by opening up Info.plist from the iOS folder and looking for a UIAppFonts key, you should see something similar to:

Adding Fonts to Android

On Android if you look in the file path “android/app/src/main/assets/fonts/” you should see your fonts have been copied over:

Image for post
Image for post

React Native Styles

With your fonts embedded and referenced it’s a simple case of adding them to your React Native styles. Simply add a fontFamily property with your font name:

iOS Screenshot

Image for post
Image for post

Android Screenshot

Image for post
Image for post

Source Code

You can find the source code for this tutorial on GitLab:

React Native Training

Stories and tutorials for developers interested in React…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store