react-native android fontFamily does not take effect
For Android: Custom fonts were added with 0.16.0-rc. So you need to have 0.16.0-rc version first and after that you can just download any fonts from the web.
- Put your font files in projectfolder/android/app/src/main/assets/fonts/font_name.ttf
- Remember to recompile which is:
react-native run-android
- And then you can use
fontFamily: 'font_name'
in your style.
Also note the following restrictions for custom Android fonts in react-native:
- fonts must be placed in
android/app/src/main/assets/fonts
- only
.ttf
files are supported - The name of the file has to match the
fontFamily
exactly. For instance, iffontFamily
is'Source Sans Pro'
, the file must be calledSource Sans Pro.ttf
(and NOTSourceSansPro.ttf
). Any suffixes as mentioned in the following paragraph are automatically removed from the file. - When the font is in bold and/or italic, it must use on the following suffixes:
_bold
(e.g.Source Sans Pro_bold.ttf
)_italic
_bold_italic