【发布时间】:2021-07-05 15:29:14
【问题描述】:
这是我的 react-native.config.js 文件:
module.exports = {
project: {
ios: {},
android: {}, // grouped into "project"
},
assets: ['./assets/fonts/'], // stays the same
};
我在我的 assets/fonts 文件夹中添加了一些字体并运行 react-native link。在此之后,我在 IOs 模拟器上测试了我的应用程序,字体工作正常,但在 android 上却无法正常工作。
这是整个组件:
import React from 'react';
import {SafeAreaView, StyleSheet, Text} from 'react-native';
const styles = StyleSheet.create({
textContainer: {
marginTop: '30%',
alignSelf: 'center',
},
text: {
fontFamily: 'BodoniSvtyTwoITCTTBook',
color: 'red',
fontSize: 25,
},
});
const App = () => {
return (
<SafeAreaView style={styles.textContainer}>
<Text style={styles.text}>
Welcome to Font-Play in react-native for android
</Text>
</SafeAreaView>
);
};
export default App;
资产在android文件夹中的位置:
有什么建议吗?
【问题讨论】:
标签: android reactjs react-native