我正在使用Text组件显示带有国家/地区代码的电话号码,在android上,看起来像这样:
+ 123-456789
但是在iPhone上,“ +”看起来像这样:
123-456789 +
当前代码如下:
<Text h4 style={styles.details} >
+123-456789
</Text>
这是使用的样式:
details:{
color:colors.black,
alignSelf:'center',
flexDirection:'row'
},
我不明白为什么它在iPhone上会被颠倒,有什么想法吗?
答案 0 :(得分:1)
您的代码也将在iOS中正常显示。看我的代码。我还附加了一个链接。
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.paragraph}>
+123-456789
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
backgroundColor: '#ecf0f1',
padding: 8,
},
paragraph: {
margin: 24,
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
},
});
答案 1 :(得分:1)
尝试一下
<Text h4 style={styles.details} >
{"+123-456789"}
</Text>