Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native: TextInput placeholder not showing up on IOS

I have a react-native component which has a TextInput. On android, the placeholder shows up with no problem, however, on IOS, it does not show up. Below I have attached a picture of the problem, as well as the code for the text input.

IOS TextInput Not showing placeholder


<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>

like image 525
King Of Missionary Avatar asked Oct 26 '25 12:10

King Of Missionary


1 Answers

Found out that it shows up, I needed to add this attribute to the TextInput:

placeholderTextColor="black"
like image 84
King Of Missionary Avatar answered Oct 29 '25 00:10

King Of Missionary



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!