加载自定义字体不起作用

时间:2016-10-20 17:45:55

标签: android react-native

我正在尝试将自定义字体加载到React Native但它只是不起作用。

当我打开它时,我有文件gerstnerbq_bold.tff它在左上角Font name: Gerstner BQ说我将此文件放在android\app\src\main\assets\fonts中并在CSS fontFamily: 'Gerstner Original Bold',中使用它我确实尝试过fontFamily的所有其他组合,但它只是不起作用。

我还使用react-native run-android重新启动了服务器,但仍未成功。

2 个答案:

答案 0 :(得分:0)

The problem was apparently because I was using fontWeight. When using fontWeight then fontFamily doesn't work for me.

答案 1 :(得分:0)

Yeah I've actually had this issue before. Only some fonts have font weight enabled on android. If you use a font that doesn't then React-Native will use the default font.