【发布时间】:2020-02-18 05:49:38
【问题描述】:
我无法在 android 和 ios 上的 React Native 中居中 Text 组件中的 View 组件.
如您所见,+ 登录不在白色圆圈的中心。
这是我的组件:
<TouchableOpacity
style={styles.blueButton}
>
<View style={styles.addButton}>
<Text style={styles.plus}>+</Text>
</View>
</TouchableOpacity>
这是我的样式表:
blueButton: {
height: 40,
width: 40,
borderRadius: 3,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#3498DB',
},
addButton: {
width: 15,
height: 15,
borderRadius: 30,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'white',
},
plus: {
color: '#3498DB',
fontSize: 20,
},
【问题讨论】:
-
你能像屏幕截图一样用蓝色显示你的视图吗?
-
当然,我也添加了蓝色按钮。
标签: reactjs react-native text-alignment react-native-stylesheet