- Fixed issue with date resetting every time a repeat type is selected

- Showing take turns button when todo has repeat rule and has more than 1 assignee
This commit is contained in:
Dejan
2024-12-08 12:00:42 +01:00
parent 11115d151d
commit 89bb924b40
2 changed files with 18 additions and 16 deletions

View File

@ -240,8 +240,8 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => {
if (value) { if (value) {
setTodo((oldValue) => ({ setTodo((oldValue) => ({
...oldValue, ...oldValue,
date: new Date(),
repeatType: value.toString(), repeatType: value.toString(),
repeatDays: []
})); }));
} }
}} }}
@ -315,20 +315,22 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => {
setSelectedAttendees={setSelectedAssignees} setSelectedAttendees={setSelectedAssignees}
/> />
</View> </View>
<View row centerV style={styles.rotateSwitch}> {todo.repeatType !== REPEAT_TYPE.NONE && selectedAssignees?.length > 1 &&
<Text style={{fontFamily: "PlusJakartaSans_500Medium", fontSize: 16}}> <View row centerV style={styles.rotateSwitch}>
Take Turns <Text style={{fontFamily: "PlusJakartaSans_500Medium", fontSize: 16}}>
</Text> Take Turns
<Switch </Text>
onColor={"#ea156c"} <Switch
value={todo.rotate} onColor={"#ea156c"}
style={{width: 43.06, height: 27.13}} value={todo.rotate}
marginL-10 style={{width: 43.06, height: 27.13}}
onValueChange={(value) => marginL-10
setTodo((oldValue) => ({...oldValue, rotate: value})) onValueChange={(value) =>
} setTodo((oldValue) => ({...oldValue, rotate: value}))
/> }
</View> />
</View>
}
<View style={styles.divider}/> <View style={styles.divider}/>
<View marginH-30 marginB-15 row centerV> <View marginH-30 marginB-15 row centerV>
<Ionicons name="gift-outline" size={25} color="#919191"/> <Ionicons name="gift-outline" size={25} color="#919191"/>

View File

@ -42,8 +42,8 @@ export const useUpdateSubUser = () => {
} }
}, },
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({queryKey: ["getChildrenByParentId"]})
queryClient.invalidateQueries({queryKey: ["familyMembers"]}) queryClient.invalidateQueries({queryKey: ["familyMembers"]})
queryClient.invalidateQueries({queryKey: ["profiles"]})
} }
}); });
} }