我在View中有一个TextInput,它有alignItems ='center' . 使用此设置,TextInput将获取TextInput中文本类型的长度 .
<View style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}} >
<TextInput />
<Text>This is React Native</Text>
</View>
屏幕截图如下
而我想要实现的是将子项对齐在中心,并且还拉伸TextInput的宽度以匹配父项
就像在这张图片中一样
如何在本机中做到这一点?
2 回答
用你的代码替换上面的代码 .