小编Ton*_*ild的帖子

反应原生元素输入全宽

我试图从 React Native Elements 实现输入,这是蓝色的。我想让输入在红色视图中具有全宽。所以我做了

width: '100%', marginHorizo​​ntal: 0, padding: 0, and alignItems: 'stretch' 独立。

但没有一个不起作用。问题是什么?这是屏幕截图

https://i.stack.imgur.com/NDhuC.png

这是相应的代码

    <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)

javascript css react-native

2
推荐指数
1
解决办法
5091
查看次数

标签 统计

css ×1

javascript ×1

react-native ×1