我正在使用React Native和Expo,除了这个自定义字体的问题之外,一切都进行得很好。我将我的字体Lobster-Regular.ttf
放在./assets/fonts中,并且我一直在尝试加载它,如官方文档中所示:
componentDidMount() {
Font.loadAsync({
'Lobster': require('./assets/fonts/Lobster-Regular.ttf'),
});
}
然后,我将我的页眉样式设置为:
headerText: {
color: 'white',
fontSize: 30,
fontFamily: 'Lobster'
},
我得到的只是
fontFamily 'Lobster‘不是系统字体,未通过Font.loadAsync加载。
我是不是遗漏了什么?
https://stackoverflow.com/questions/52917558
复制相似问题