【问题标题】:React Native TextInput: placeholder and detx paddingReact Native TextInput:占位符和 detx 填充
【发布时间】:2023-03-21 22:43:02
【问题描述】:

我有一个带圆角的 TextInput :

<TextInput
    style={{
        backgroundColor : '#FFFFFF',
        borderRadius : 30,
        marginLeft : 8,
        marginRight : 8,
        marginTop : 10
    }}
    placeholder = 'A placeholder'
/>

但我想为占位符(以及将包含在 TextInput 中的文本)提供一些左侧填充,因为现在文本离左侧 TextInput 边框太近了。 我该怎么做?

【问题讨论】:

  • paddingLeft 属性有什么问题?

标签: react-native textinput react-native-textinput


【解决方案1】:

使用 paddingLeft 代替 marginLeft

<TextInput
    style={{
          backgroundColor: '#ffffff',
          borderRadius: 30,
          paddingLeft: 8,
          paddingRight: 8,
          marginTop: 10
        }}
        placeholder='A placeholder'
      />

我希望这会有所帮助

【讨论】:

    【解决方案2】:

    你可以使用它

    paddingHorizontal: 10
    

    【讨论】:

      猜你喜欢
      • 2017-04-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-12
      • 2016-06-05
      • 1970-01-01
      • 1970-01-01
      • 2017-05-13
      • 2019-07-18
      相关资源
      最近更新 更多