使用React Native,我遇到textAlign
的问题,因为它在升级到RN 0.59.3后变得奇怪地在android上运行
我希望文本对齐(无论内容如何),但它给出了正确的英文文本,左边有阿拉伯文本
我有这个简单的代码(我希望两行都对齐)
<View style={{ flex: 1 }}>
<Text style={styles.title}>تجربة تجربة</Text>
<Text style={styles.title}>Test Test</Text>
</View>
风格:
title: {
textAlign: 'right',
alignSelf: 'stretch',
backgroundColor: '#EEE',
margin: 10,
color: '#000',
}
它在IOS上正常工作,但在Android上不正确(升级到RN 0.59.3后),如下所示:
我可以通过this change in gravity in RN 0.59.3找出问题所在
那么现在我如何确保文本对齐?
更新:它看起来像RN 0.59.3引入的bug
我做了降级到RN 0.59.2并且错误消失了
更新:该错误已在RN 0.59.8中修复
预计将受到<View>
以外的<Text />
影响。
这是工作代码
return(
<View
style={{
flex: 1,
flexDirection: "column",
alignItems: "center",
justifyContent: "center"
}}
>
<Text style={styles.title}>تجربة تجربة</Text>
<Text style={styles.title}>Test Test</Text>
</View>);
const styles = StyleSheet.create({
title: {
textAlign: "right",
alignSelf: "stretch",
backgroundColor: "#EEE",
margin: 10,
color: "#000"
}
});
Android:三星Galaxy s9 plus