- Grocery list changes

- Removed the Add item button from the bottom and added an empty grocery box
This commit is contained in:
Dejan
2024-12-08 14:01:35 +01:00
parent 47a0ea2f36
commit 1c2f18e288
3 changed files with 33 additions and 30 deletions

View File

@ -113,7 +113,7 @@ const EditGroceryItem = ({
}}
maxLength={25}
/>
<View row centerV>
{(editGrocery.title || editGrocery.title !== "") && <View row centerV>
<AntDesign
name="check"
size={24}
@ -130,7 +130,7 @@ const EditGroceryItem = ({
}
}}
/>
</View>
</View>}
</View>
<Dropdown
style={{ marginTop: 15 }}

View File

@ -98,6 +98,12 @@ const GroceryList = ({onInputFocus}: {onInputFocus: (y: number) => void}) => {
setPendingGroceries(groceries?.filter((item) => !item.approved));
}, [groceries]);
const handleCancelAddGrocery = () => {
setIsAddingGrocery(false);
setTitle("");
setCategory(GroceryCategory.None)
}
return (
<View marginH-20 marginB-45>
<HeaderTemplate
@ -244,7 +250,6 @@ const GroceryList = ({onInputFocus}: {onInputFocus: (y: number) => void}) => {
</Text>
</View>
</View>
{isAddingGrocery && (
<View style={{marginTop: 8}}>
<EditGroceryItem
editGrocery={{
@ -253,12 +258,11 @@ const GroceryList = ({onInputFocus}: {onInputFocus: (y: number) => void}) => {
category: category,
setTitle: setTitle,
setSubmit: setSubmitted,
closeEdit: () => setIsAddingGrocery(false)
closeEdit: handleCancelAddGrocery
}}
onInputFocus={onInputFocus}
/>
</View>
)}
{/* Render Approved Groceries Grouped by Category */}
{approvedGroceries?.length > 0

View File

@ -71,7 +71,6 @@ const GroceryWrapper = () => {
<GroceryList onInputFocus={handleInputFocus} />
</View>
</ScrollView>
{!isAddingGrocery && <AddGroceryItem />}
</>
);
};