Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the placeholder color in android app created using React Native

I'm creating an Android app using React Native in which there's a form. The placeholder doesn't even appear for the textInput fields so I thought of changing the placeholder color but I don't know how to do that. The docs mentioned some way which I don't understand.

Here's the code:

  <TextInput   secureTextEntry={secureTextEntry}   style={inputStyle}   placeholder={placeholder}   value={value}   onChangeText={onChangeText}   />    inputStyle: {   color: '#000',   paddingRight: 5,   paddingLeft: 5,   fontSize: 18,   lineHeight: 23,   flex: 2,   } 

I also tried:

  <TextInput   placeholderTextColor="blue"   style={inputStyle}   placeholder={placeholder}   value={value}   onChangeText={onChangeText}   /> 

and

  inputStyle: {   color: '#000',   paddingRight: 5,   paddingLeft: 5,   fontSize: 18,   lineHeight: 23,   flex: 2,   placeholderTextColor: '#333'   } 
like image 566
Etherealm Avatar asked Jun 24 '17 17:06

Etherealm


People also ask

How do you change color of placeholder in React Native?

To change the styling of TextInput placeholder in React Native, we can set the placeholderTextColor prop. to set the placeholderTextColor to 'red' to set the placeholder color of the input to red.

How can I change placeholder color?

<input type="text" placeholder="A red placeholder text..">

How do I add a placeholder in React Native?

Use the placeholder prop to set a placeholder on an input field in React, e.g. <input type="text" placeholder="Your first name" /> . The placeholder text of an input field is shown until the user types something in the field. Copied!


1 Answers

Like so:

<TextInput    placeholder="something"    placeholderTextColor="#000"  /> 
like image 109
Ray Avatar answered Oct 06 '22 01:10

Ray