Akila

Akila

  • NA
  • 216
  • 33.6k

React native checkbox selected

Feb 16 2022 11:01 AM

Hi,

I am using check box in one page.after select the check box then click submit.i want if i open that page again before select checkbox display checkd.

const [user, setusers] = useState([]);

  const onValueChange = (item, index) => {

    console.log("tes",item.label);

    const newdata = user.map((newitem) => {

      if (newitem.value == item.value) {

        return {

          ...newitem,

          checked: index,

        };

      }

 

      return newitem;

 

    });

    setusers(newdata);

    let slectt = user.filter((e) => e.checked == false);

     

  };

 <CheckBox

          disabled={false}

          style={styles.checkbox}

          boxType={"circle"}

          value={item.checked}

          onChange={() => onValueChange(item, !item.checked)}

          tintColors={{ true: "#F14A16", false: "grey" }}

         

        />

<Button title='submit'/>


Answers (1)