0
votes

I am using google font for my project (https://fonts.google.com/specimen/Noto+Sans+KR).

I have followed following documentation for linking fonts. https://medium.com/@danielskripnik/how-to-add-and-remove-custom-fonts-in-react-native-b2830084b0e4

style for component is :

{fontFamily:'NotoSansKR-Regular'}

It's working in IOS but not working in android. Previous RN versions are working fine.

2
Maybe this will help: medium.com/react-native-training/…. - HedeH
tried both not working @HedeH - Shafi PS
When you say "not working," what do you mean? - Kai
@Kai font is not loading in android. project/android/app/src/main/assets/fonts folder is there - Shafi PS

2 Answers

6
votes

If you're using a custom font do not apply any style like fontWeight or fontStyle if you do so it will drop your custom font style from your text.

Another thing is that to name your font-file as its font-family name, this way will make {fontFamily: 'Font-Family'} will work for both platform.

StyleSheet.create({
    textStyle: {
        fontFamily: 'Font-FileName'
    }
})
3
votes

I might have a solution for this. I had the same problem, the fonts were visible in my emulator, the font files are located under 'android/src/main/assets/fonts' and yet it wasn't visible on my physical android device (Huawei Honor 8X).

I found out that the problem was with my physical device's Font settings. To fix this, on your phone, go to

Settings -> Display -> Text Style -> Default

Please Note that these settings might differ as per your device. I've mentioned the steps for my phone.

Always use the default Text Style to render custom fonts in your app. Nowadays, phones like the OnePlus etc. have their own custom fonts and I think this is interfering with custom fonts defined in Applications.

Hope this helps.