- Moved the touching area on the whole grocery card not just on the text

This commit is contained in:
Dejan
2024-12-30 20:49:16 +01:00
parent 04d865cce9
commit 2a6357983f
2 changed files with 96 additions and 96 deletions

View File

@ -68,7 +68,7 @@ const EditGroceryItem = ({
); );
const handleClose = () => { const handleClose = () => {
setGrocery(defaultGroceryItem); closeEdit();
} }
const handleSubmit = () => { const handleSubmit = () => {

View File

@ -39,6 +39,7 @@ const GroceryItem = ({
return `${firstName.charAt(0).toUpperCase()}${lastName.charAt(0).toUpperCase()}`; return `${firstName.charAt(0).toUpperCase()}${lastName.charAt(0).toUpperCase()}`;
}; };
const isEditable = (isParent || isCaregiver) && item.approved && !item.bought;
return ( return (
<View <View
key={item.id} key={item.id}
@ -49,6 +50,7 @@ const GroceryItem = ({
overflow: "hidden", overflow: "hidden",
}} }}
> >
<TouchableOpacity onPress={isEditable ? () => setIsEditingTitle(true) : null}>
<View <View
row row
spread spread
@ -65,7 +67,6 @@ const GroceryItem = ({
item={item} item={item}
onClose={() => setOpenFreqEdit(false)} onClose={() => setOpenFreqEdit(false)}
/> />
{isEditingTitle ? ( {isEditingTitle ? (
<EditGroceryItem <EditGroceryItem
editGrocery={item} editGrocery={item}
@ -75,7 +76,6 @@ const GroceryItem = ({
) : ( ) : (
<View flex> <View flex>
{(isParent || isCaregiver) && !item.bought ? ( {(isParent || isCaregiver) && !item.bought ? (
<TouchableOpacity onPress={() => setIsEditingTitle(true)}>
<Text <Text
text70T text70T
style={[ style={[
@ -87,7 +87,6 @@ const GroceryItem = ({
> >
{item.title} {item.title}
</Text> </Text>
</TouchableOpacity>
) : ( ) : (
<Text <Text
text70T text70T
@ -152,6 +151,7 @@ const GroceryItem = ({
) )
)} )}
</View> </View>
</TouchableOpacity>
{!item.approved && ( {!item.approved && (
<> <>