Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!