question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

placeholderTextColor not being set

See original GitHub issue

Describe the bug The placeholderTextColor is not being set whenever one wants to set a different placeholder text to the ones you want to display as values. Such as this:

screen shot 2018-10-23 at 17 58 28

To Reproduce

  1. Create a Picker component
  2. Change the placeholderTextColor
  3. Change the default placeholder to be a different value than the one displayed on items

Expected behavior The placeholder text color should change to red. However, because of this line: https://github.com/lawnstarter/react-native-picker-select/blob/master/src/index.js#L193 the color attribute is never set.

Screenshots

screen shot 2018-10-23 at 18 07 02

  • Device: iOS Simulator
  • OS: iOS 12
  • react-native-picker-select version: 4.2.1
  • react-native version: 0.55.4
  • react version: 16.4.0

Reproduction and/or code sample In order to reproduce the behaviour, just create the following component:


const placeholderTextColor = 'red';

const CustomPicker = () =>
  <Picker
    placeholderTextColor="red"
    placeholder={{label: 'Select an option', value: null}}
    doneText="Select"
    items={[{label: 'test 0', value: 0}, {label: 'test 1', value: 1}]}
    value={null}
    onValueChange={v => console.log(v)}
  />

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

37reactions
noelqcommented, Oct 7, 2020

@NathanNovak I did this and it works :


<RNPickerSelect style={pickerStyle} ... />


const pickerStyle = {
    inputIOS: {
        color: 'white',
        paddingHorizontal: 10,
        backgroundColor: 'red',
        borderRadius: 5,
    },
    placeholder: {
        color: 'white',
      },
    inputAndroid: {
        color: 'white',
        paddingHorizontal: 10,
        backgroundColor: 'red',
        borderRadius: 5,
    },
};
4reactions
rassmatecommented, Apr 30, 2021

I too have this issue, tried the above but with no luck

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactNative TextInput placeholderTextColor doesn't seem to ...
I was having issues getting the opacity to work, so I found the above ... this.state.location.length to see if the field is empty...
Read more >
How to Change Placeholder Text Color? - GeneratePress
Hello,. I tried all color options from the Customizer but the placeholder text color couldn't be changed. In the checkout there are ...
Read more >
placeholder - CSS: Cascading Style Sheets - MDN Web Docs
Placeholder text typically has a lighter color treatment to indicate that it is a suggestion for what kind of input will be valid,...
Read more >
How To Change Input Placeholder Color - W3Schools
Step 2) Add CSS: In most browsers, the placeholder text is grey. To change this, style the placeholder with the non-standard ::placeholder selector....
Read more >
Change UITextField placeholder text color with Swift
If not, you will need a text field set up for this tutorial. I have a text field outlet and I will be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found