React Native TextInput:占位符和 detx 填充

React Native TextInput: placeholder and detx padding

我有一个带圆角的 TextInput :

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

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

使用 paddingLeft 代替 marginLeft

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

希望对您有所帮助

可以用

paddingHorizontal: 10