【问题标题】:react native input elements: change the height of input container反应原生输入元素:改变输入容器的高度
【发布时间】:2020-05-20 09:07:49
【问题描述】:

我有一个使用 react-native-elements 的输入容器,该容器包含一个图标。我想降低容器的高度,但结果不好,图标周围的高度不合适:

我的造型:

input: {
      layout: {
        ...inputs.darkCredentials,
        containerStyle: {
          ...inputs.darkCredentials.containerStyle,
          width: '100%',
          padding: 0,
          marginTop: Platform.OS === 'ios' ? 25 : 17,
          marginBottom: Platform.OS === 'ios' ? 15 : 13,
          borderRadius: 12,
          height: 32,
          // marginBottom: 45,
          elevation: 5,
          shadowColor: '#000000',
          shadowOffset: { height: 0.5 },
          shadowOpacity: 0.15,
          shadowRadius: 5,
        },
        leftIconContainerStyle: {
          ...inputs.darkCredentials.leftIconContainerStyle,
          // height: Platform.OS === 'ios' ? 40 : 45,
          backgroundColor: greenPrestoDark,
          padding: 0,
          height: 32,
          margin: 0,
          paddingLeft: 15,
          borderRadius: 12,
        },
        labelStyle: {
          marginLeft: 10,
          height: 32,
          color: 'white',
          position: 'absolute',
          top: -25,
        },
      },

and for the icon:

   icon: {
      layout: {
        type: 'material-community',
        name: 'lock',
        ...icons.darkCredentials,
        size: 32,
        height: 32,
        style: { color: 'white' },
      },

我正在尝试设置高度:32 处

我应该怎么做才能完全降低输入容器的高度?

【问题讨论】:

  • 您是否尝试过减小图标大小?尝试将 size 道具添加到您的 Icon 组件
  • 是的,我试过了,谢谢,但即使图标本身的大小非常小,它也不起作用,它仍然会自动占用高度,我无法摆脱它

标签: react-native react-native-elements


【解决方案1】:

你可以这样充电吗

 inputStyle={styles.inputStyle}
  inputStyle: {
    height:200
  },

【讨论】:

  • 谢谢,我试过了,但没有帮助
猜你喜欢
  • 2019-12-20
  • 1970-01-01
  • 2020-10-19
  • 1970-01-01
  • 1970-01-01
  • 2019-08-02
  • 2020-12-15
  • 2016-07-08
  • 1970-01-01
相关资源
最近更新 更多