简体   繁体   English

React native:TextInput 占位符未显示在 IOS 上

[英]React native: TextInput placeholder not showing up on IOS

I have a react-native component which has a TextInput.我有一个带有 TextInput 的 react-native 组件。 On android, the placeholder shows up with no problem, however, on IOS, it does not show up.在 android 上,占位符显示没有问题,但是,在 IOS 上,它没有显示。 Below I have attached a picture of the problem, as well as the code for the text input.下面我附上了问题的图片,以及文本输入的代码。

IOS TextInput Not showing placeholder IOS TextInput不显示占位符


<TextInput
        style={{
          backgroundColor:"white",
    height: 40,
    margin: 12,
    borderWidth: 1,
    borderBottomColor: '#ffffff',
    borderTopColor: '#ffffff',
    borderRightColor: '#ffffff',
    borderLeftColor: '#ffffff',
    padding: 10,
    borderColor: "#ffffff",
    width:"70%",
    position:"absolute",
    top:80,
    borderRadius:10
  }}
        placeholder="Search"
        onChangeText={txtHandler}
        defaultValue={text}
      ></TextInput>

发现它出现了,我需要将此属性添加到 TextInput:

placeholderTextColor="black"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM