In my example I present a checkboxes list butI cant uncheck the checkboxes.Now I can only check them but cant uncheck .How should I fix MY code that it will works fine ? ?
const [checkList, setCheckList] = useState<any[]>(actionList.map(e => ({ key: e.key, checked: false }))); const isChecked = (key) => { checkList.filter(e => e.key == key)[0].checked } const renderActionItem = ({ item, index }) => { return (<TouchableOpacity key={index} activeOpacity={.7} style={styles.touchableOpacity} onPress={() => { console.log(item) }}><CheckBox style={styles.checkBox} tintColors={{ true: 'white', false: 'white' }} value={isChecked(item.key)} onValueChange={() => { const newCheckList = checkList.slice() newCheckList.forEach(e => { if (e.key == item.key) { e.checked = !e.checked } }) setCheckList(newCheckList) }} /><Text style={styles.labelText}>{`${item.sequenceID} . ${item.label}`}</Text></TouchableOpacity> ) }