我很难让自定义 webfonts 在 android 上与 react-native 一起使用。
我已按照此处的说明https://medium.com/@gattermeier/custom-fonts-in-react-native-for-android-b8a331a7d2a7#.w6aok6lpw但没有成功。
我尝试了几种不同的字体,仍然没有乐趣。
nb我试过重命名字体文件,用下划线替换破折号,全部小写等等,但仍然没有成功。
任何帮助,非常感谢。这是我的代码:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
} from 'react-native';
class MyBeltingApp extends Component {
render() {
return (
<View>
<Text style={styles.welcome}>
Straigtline
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
welcome: {
fontFamily: 'GT-Walsheim-Bold',
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});
AppRegistry.registerComponent('MyBeltingApp', () => MyBeltingApp);