gpt4 book ai didi

css - 无法更改字体系列(React-Native)

转载 作者:行者123 更新时间:2023-12-03 16:36:21 25 4
gpt4 key购买 nike

我对 native react 很陌生,对 CSS 没有太多经验。我只是想将字体系列更改为 helvetica。我试了很多次都没有改变

这是我的 css 代码:

import {StyleSheet} from "react-native";

export default StyleSheet.create({

header: {
backgroundColor:'#004D4D',
height: 35,
},

headerT: {
color: '#FFFFFF',
fontSize: 20,
fontFamily: 'Helvetica',
textAlign: 'center',
justifyContent: 'center',
},

body: {
backgroundColor:'#E6FFFF',
flex:1,
},

})

这是我要修改的页面
import React, { Component } from 'react';
import { Text, View, Button } from 'react-native';
import styles from "../style/css";

class HomeScreen extends Component{
render(){
return(
<View style={styles.body}>


<View style={styles.header}>
<Text style={styles.headerT}>Home Screen</Text>
</View>


</View>

);
}
}

export default HomeScreen;

这是我的目录

enter image description here

最佳答案

可用的 native 字体列表:https://github.com/react-native-training/react-native-fonts

如果您使用的是 Android,Helvetica 将无法直接工作,您需要使用自定义字体。

这是Custom Fonts in React Native for iOS & Android Builds的文章

关于css - 无法更改字体系列(React-Native),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60619440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com