React Native TextInput:占位符和Detx填充

时间:2019-07-09 09:05:18

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

我有一个带有圆角的TextInput:

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

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

2 个答案:

答案 0 :(得分:1)

代替marginLeft,使用paddingLeft

public IQueryable<CompanyModel> GetCompanyData()
{

List<CompanyModel> query = (from e in Context.tblCompany
                         where e.Cmp_Id == this.CompanyId
                         && e.TenantId == this.TenantId
                         select new CompanyModel()
                         {
                             CmpId = e.Cmp_Id,
                             SrNo = 0,
                         }).ToList();

 int counter=0;
 query.Foreach(x=>x.SrNo = counter++);

return query;
}

我希望这会有所帮助

答案 1 :(得分:0)

你可以使用它

paddingHorizontal: 10