【发布时间】:2021-01-08 10:42:51
【问题描述】:
我是原生反应新手,我在定位文本时遇到了问题。 我想要这样的东西:
Hi, Daffa
XII RPL
但这是我的结果:
Hi, Daffa XII RPL
这是我的代码:
import React from 'react';
import {View, StyleSheet, Text, Image} from 'react-native';
export default function Header() {
return (
<View style={styles.header}>
<Image style={styles.img} source={require('../assets/me.png')} />
<Text style={styles.text}>Hi, Daffa Quraisy</Text>
<Text style={styles.kelas}>XII RPL</Text>
</View>
);
}
const styles = StyleSheet.create({
header: {
height: 200,
backgroundColor: '#327fe3',
flexDirection: 'row',
alignItems: 'center',
},
img: {
height: 50,
width: 50,
marginLeft: 20,
padding: 0,
},
text: {
color: 'white',
marginLeft: 18,
fontWeight: 'bold',
},
kelas: {
color: 'white',
fontSize: 12,
marginLeft: 18,
flexWrap: 'nowrap',
},
});
感谢阅读本文,如果我的问题有点愚蠢,我很抱歉,对于我的英语不好感到抱歉。
【问题讨论】:
标签: javascript reactjs react-native mobile