Android – react-native android fontFamily does not take effect

androidreact-native

Question 1:

I add a fontFamily to index.android.js's welcome style, but it takes no effect. Does fontFamily actually work on android?

welcome:{
fontSize:20,
fontFamily:'roboto-thin',
textAlign:'center',
margin:10}

Question 2:

if fontFamily works on android, is there a way to load custom font from assets? Or is this some feature to be implemented by react-native?

Best Answer

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.

  1. Put your font files in projectfolder/android/app/src/main/assets/fonts/font_name.ttf
  2. Remember to recompile which is: react-native run-android
  3. And then you can use fontFamily: 'font_name' in your style.