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

173
Visualizações
React Native Wheel Color Picker - naeemur - Not sure how to actually access the color

I'm trying to get the result of the colour picker so that I can constantly update the colour of a card in a separate component. The colour picker is for the colour of the card! I've tried a few things, but most come back as undefined or as an error. The issue is whate to put in setCardColour() I have this.currentColor but that doesn't work. Any ideas?

  • This is the function for when the colour changes :

    function changeCardColour() {
      setCardColour(this.currentColour)
      console.log(cardColour)
    }
    
  • This is the Colour picker itself :

    <ColourPicker
      color = {cardColour}
      swatches = {false}
      style = {styles.colourWheel}
      onColorChange = {changeCardColour}
    />
    
  • I would like the card to change colour

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need to change code like,

function changeCardColour(selectedColour) {
  setCardColour(selectedColour)
}

According to doc, onColorChange: (color) => {} callback function for slider and wheel thumb movement.

const RoundedColorPicker = () => {
  const [currentColor, setCurrentColor] = useState('#000');

  const onColorChange = (selectedColor: string) => {
    setCurrentColor(selectedColor);
  };

  return (
    <SafeAreaView style={RoundedColorPickerStyle.container}>
      <View
        style={[
          RoundedColorPickerStyle.currentColorContainer,
          {backgroundColor: currentColor},
        ]}
      />
      <Text>Current Color:{currentColor}</Text>
      <ColorPicker
        color={currentColor}
        swatchesOnly={false}
        onColorChange={onColorChange}
        thumbSize={40}
        sliderSize={40}
        noSnap={true}
        row={false}
      />
    </SafeAreaView>
  );
};

I use like this way and it is working fine for me.

about 4 years ago · Juan Pablo Isaza Relatório
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