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

205
Visualizações
how to validate radio button in react native

click here to see output i need

I am beginner in react native.

When I select the 1st question, option is selected and stored in state.

Then I select the 2nd question, option is stored in state but before selected value is not in state.

Also, if I select the 1st question option Yes, then I select the 2nd question option Yes, and again if I select 1st question option No but before I select the 1st question option must be removed in state.

myArray = [
 {
   isSignReq: 1,
   name: "You are hereby given the opportunity to read and understand the",
   sno: 1,
   yesno: 0,
 },
 {
  isSignReq: 1,
  name: "Your Full wages commence from the day of departure from last international",
  sno: 2,
  yesno: 0,
},
{
 isSignReq: 1,
 name: "The company shall bear or reimburse cost for obtaining necessary 
         Flag documents",
 sno: 3,
 yesno: 0,
},
{
 isSignReq: 1,
 name: "Company has the right to recover the cost of training, interview 
        and evaluations.",
 sno: 4,
 yesno: 0,
},
{
 isSignReq: 1,
 name: "Company follows strict Drug and alcohol Policy and any abuse on 
        board will result.",
 sno: 5,
 yesno: 0,
},
{
 isSignReq: 1,
 name: "Ships may trade through any High Risk area including Gulf of Aden and West African.",
 sno: 6,
 yesno: 0,
},
]

import React, { useState } from 'react';
import RadioForm from 'react-native-simple-radio-button';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {

 const [isChecked, setIsChecked] = useState([])
 var radio_props = [{ label: "Yes", value: 1 }, { label: "No", value: 2 }];

 return (
 <View style={styles.container}>
  {
    myArray.map((values, index) => {
      return (
        <View key={index.toString()}>
          <RadioForm
            radio_props={radio_props}
            initial={null}
            onPress={(value) => {
              setIsChecked({status:value, data:values})
            }}
          />
        </View>
      )
    })
  }
  </View>
 );
}
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