我试图从 React Native Elements 实现输入,这是蓝色的。我想让输入在红色视图中具有全宽。所以我做了
width: '100%', marginHorizontal: 0, padding: 0, and alignItems: 'stretch' 独立。
但没有一个不起作用。问题是什么?这是屏幕截图

这是相应的代码
<View style = {styles.campusInputView}>
<Input
containerStyle = {styles.campusInputContainer}
inputStyle = {styles.campusInput}
placeholder = 'KAIST'
editable = {false}
/>
</View>
Run Code Online (Sandbox Code Playgroud)
与风格
campusInputView: {
borderWidth: 1,
borderColor: 'red',
position: 'absolute',
top: height * 100 / 640,
left: width * 45 / 360,
width: width * 270 / 360,
},
campusInputContainer: {
borderWidth: 1,
borderColor: 'green',
alignItems: 'stretch',
},
campusInput: {
borderWidth: 1,
borderColor: 'blue',
flex: …Run Code Online (Sandbox Code Playgroud)