我已经在模式中实现了多个复选框以选择日期。我希望如果用户关闭模式并重新打开它,则先前选择的模式应该被选中。
<ListItem
bottomDivider
checkBox = {
{
checkedIcon : 'dot-circle-o',
uncheckedIcon : 'circle-o',
checked : checkBoxState.includes(dateObj),
checkedColor : "#5FB345",
onPress : ()=>{press(dateObj,i)},
disabled : (skipWeekend && dateObj.date.includes('Sat')) || (skipWeekend && dateObj.date.includes('Sun')) ? true : false
}
}
onPress = {()=>{press(dateObj,i)}}
/>
const press = (dateObj,i)=>{
setDateErr(false)
if (!checkBoxState.includes(dateObj)) {
setUserPlanDates(renderPlanEndDate(i));
setCheckBoxState([dateObj]);
} else {
setCheckBoxState(checkBoxState.filter(a => a === dateObj));
}
};