Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

446
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda