Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

444
Views
react-native-dropdown-picker changing dropdown background color by condition

We are using react-native-dropdown-picker.

<DropDownPicker
    items={timeList.map(item => {
        return ({
            label: item.timeslot,
            value: item.timeslot
        })
    })}
    defaultValue={timeList[0].timeslot}
    placeholder={"Select date"}
    containerStyle={styles.dropDownContainer}
    itemStyle={{ justifyContent: "flex-start" }}
    dropDownStyle={{ backgroundColor: colors.white }}
    dropDownMaxHeight={hp("45%")}
    onChangeItem={item => timeSelected(item.value)}
    arrowSize={30}
    arrowStyle={{ position: "absolute", right: 0 }}
    labelStyle={{
        fontSize: wp('3.5%'),
        fontFamily: constants.themeFont,
        textAlign: 'left',
        color: '#000',
        alignSelf: 'center',
    }} />

So the dropdown's background color has been set from 'dropDownStyle' property. I have given the color white.

Let's say, in the 'timeList' (array)variable, I have a key 'enabled' (boolean value) on every object on the array. So I want to give different background colors for different values(true/ false) of the key 'enabled'.

The 'dropDownStyle' is the common property for all the values on the dropdown. So how to change the background color based on every item attribute.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!