Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

445
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda