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

189
Visualizações
How to only select one option at a time from radio button in Reac Native

Im using galio's radio component this here. Im trying to select only one value at a time. I try to achieve that with this code:

const [selected, setSelected ] = useState(false);
const OptionList = (groupOption) => {
   return (
     <FlatList
       data={groupOption.options}
       keyExtractor={(result) => result.id.toString()}
       renderItem={({ item }) => {
         return (
           <View>
             <Radio label={item.description} onChange={() => setSelected(true)} initialValue={selected} />
           </View>
         );
       }}
     />
   );
 };

But since its in a flat list it changes the value for all of them. How can i only select one radio button at a time? Any ideas?

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

0

Use Radio Group or save the selected index in the state, when the user clicks on the radio button, change that selected index and mark it selected.

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