【发布时间】:2019-12-20 01:57:38
【问题描述】:
我试图实现来自 React Native Elements 的输入,它是蓝色的。我想让输入在红色视图中具有全宽。 所以我做到了
width: '100%', marginHorizontal: 0, padding: 0 和 alignItems: 'stretch' 独立。
但没有一个不起作用。问题是什么? 这是屏幕截图
这是对应的代码
<View style = {styles.campusInputView}>
<Input
containerStyle = {styles.campusInputContainer}
inputStyle = {styles.campusInput}
placeholder = 'KAIST'
editable = {false}
/>
</View>
搭配风格
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: 1,
fontFamily: 'NanumSquareB',
fontSize: 20,
paddingVertical: 0,
},
【问题讨论】:
标签: javascript css react-native