我想创建一个像这样的评论组件:
问题是我没有找到一种方法来为lorem ipusm文本做样式。我尝试了下一个:
<View {...props} style={[styles.main, props.style]}>
<View style={{ display: "flex", flexDirection: "row" }}>
<Avatar user={user} />
<Text style={styles.username}>{user.username}</Text>
</View>
<Text style={styles.comment}>
{comment}
</Text>
</View>
其中comment
将是lorem Ipsum文本。对于样式:
export const useCommentTheme = () =>
useCreateStyle((colors) => ({
main: {
display: "flex",
flexDirection: "row",
alignItems: "center",
flexWrap: "wrap",
},
username: {
color: colors.primary,
fontFamily: poppins.extraBold,
marginLeft: 5,
fontSize: 16,
},
comment: {
color: colors.text,
marginLeft: 10,
fontSize: 14,
},
}));
这是什么做的是把所有的文字下头像和用户名,而不是在旁边的用户名,并添加休息时,文字溢出。我怎么做,使文字休息
2条答案
按热度按时间plicqrtu1#
您可以使用
{'\n'}
,例如nimxete22#
很简单,只需添加
numberOfLines
: