【问题标题】:React Native Text Input place the text on bottom of the inputReact Native Text Input 将文本放在输入的底部
【发布时间】:2021-07-20 14:43:52
【问题描述】:

我在 react native 中有一个文本输入,默认情况下,文本在输入框中居中

有没有办法让文字在输入的底部,就好像输入框的下边框和文字之间有0填充一样?

<TextInput
   type='submit'
   style={styles.input}
   onChangeText={text => this.setState({ name: text })}
   title='Name'
   value={this.state.name}
/>
input: {
        height: 40,
        width: 250,
        margin: 12,
        borderRadius: 0,
        backgroundColor: 'white',
        borderBottomWidth: 1 
}

【问题讨论】:

    标签: reactjs react-native textinput


    【解决方案1】:

    对于 Android,您可以使用 textAlignVertical:'bottom', paddingTop: 0, paddingBottom:0,在 TextInput 中将文本与底部对齐

    input: {
    height: 40,
    width: 250,
    margin: 12,
    borderRadius: 0,  
    backgroundColor: 'white',
    borderBottomWidth: 1 , 
    textAlignVertical:'bottom', paddingTop: 0, paddingBottom:0,
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 2022-10-13
      • 1970-01-01
      • 1970-01-01
      • 2011-10-03
      • 2018-10-28
      相关资源
      最近更新 更多