【发布时间】:2016-12-19 09:51:58
【问题描述】:
我对 react-native css-styling 很陌生.. 并且有以下代码:
<Text>
<Text style={(styles.author, { textAlign: "left" })}>
{question.view_count + " views\t" + question.comment_count}
{question.comment_count > 1 || question.comment_count == 0
? " comments"
: " comment"}
</Text>
<Text style={{ textAlign: "right" }}>
{question.solution_count > 0
? question.solution_count + " solutions"
: " Solve this"}
</Text>
</Text>;
问题是第二个“textAlign: 'right'” 不起作用 - 文本仍在左侧。我希望文本在同一行,但(显然)右边的第二个文本对象。
有什么提示吗?谢谢!
【问题讨论】:
-
输出的 HTML/CSS 是什么样的?
-
@Paulie_D 查看我的编辑
-
不...不是结果的图像...实际的 HTML/CSS 如果底线只是一个元素...您需要将其分成两个。
-
@Paulie_D 在 react-native 中可能吗?也许我对问题的标记已关闭..
-
仅供参考 -
<Text style={styles.author, {textAlign: 'left'}}>实际上应该是<Text style={[styles.author, {textAlign: 'left'}]}>您需要将覆盖样式放在数组中,第二项覆盖第一项:)
标签: javascript css text react-native