- Allowed selecting date when Repeat type is set to "None"

- Enabled opening the repeat freq picker with click on the Repeat todo icon
This commit is contained in:
Dejan
2024-11-20 20:04:23 +01:00
parent cc2a649f8c
commit 012a70313b

View File

@ -106,6 +106,11 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => {
}, 500)
}, []);
const repeatPickerRef = useRef();
const showRepeatPicker = () => {
repeatPickerRef.current?.toggleExpandable(true);
}
return (
<Dialog
bottom={true}
@ -210,26 +215,19 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => {
)}
</View>
<View row centerV>
<TodoRepeatIcon />
<TodoRepeatIcon onPress={showRepeatPicker}/>
<Picker
ref={repeatPickerRef}
marginL-12
placeholder="Select Repeat Type"
value={todo?.repeatType}
onChange={(value) => {
if (value) {
if (value.toString() == "None") {
setTodo((oldValue) => ({
...oldValue,
date: null,
repeatType: "None",
}));
} else {
setTodo((oldValue) => ({
...oldValue,
date: new Date(),
repeatType: value.toString(),
}));
}
setTodo((oldValue) => ({
...oldValue,
date: new Date(),
repeatType: value.toString(),
}));
}
}}
topBarProps={{title: "Repeat"}}