From 2b55c5db0ca4f8d5f8b4f544cf55e945b949e57d Mon Sep 17 00:00:00 2001 From: ivic00 <102467664+ivic00@users.noreply.github.com> Date: Mon, 7 Oct 2024 00:10:51 +0200 Subject: [PATCH] grocery changes --- app/(auth)/_layout.tsx | 3 + components/pages/grocery/EditGroceryItem.tsx | 12 +- components/pages/grocery/GroceryItem.tsx | 140 ++++++++-------- components/pages/grocery/GroceryList.tsx | 160 +++++++++++++------ components/pages/grocery/GroceryWrapper.tsx | 24 ++- 5 files changed, 204 insertions(+), 135 deletions(-) diff --git a/app/(auth)/_layout.tsx b/app/(auth)/_layout.tsx index 867d5fd..b6e8aee 100644 --- a/app/(auth)/_layout.tsx +++ b/app/(auth)/_layout.tsx @@ -16,6 +16,8 @@ import { MaterialCommunityIcons, Octicons, } from "@expo/vector-icons"; +import MenuIcon from "@/assets/svgs/MenuIcon"; +import { router } from "expo-router"; export default function TabLayout() { const { mutateAsync: signOut } = useSignOut(); @@ -30,6 +32,7 @@ export default function TabLayout() { backgroundColor: "#f9f8f7", height: "100%", }, + drawerIcon: () => , }} drawerContent={(props) => { return ( diff --git a/components/pages/grocery/EditGroceryItem.tsx b/components/pages/grocery/EditGroceryItem.tsx index 2d8d6d1..c92ac2f 100644 --- a/components/pages/grocery/EditGroceryItem.tsx +++ b/components/pages/grocery/EditGroceryItem.tsx @@ -1,6 +1,6 @@ import { View, Text } from "react-native"; -import React, { useEffect, useState } from "react"; -import { TextField } from "react-native-ui-lib"; +import React, { RefObject, useEffect, useRef, useState } from "react"; +import { TextField, TextFieldRef } from "react-native-ui-lib"; import { GroceryCategory, IGrocery, @@ -21,12 +21,19 @@ interface IEditGrocery { const EditGroceryItem = ({ editGrocery }: { editGrocery: IEditGrocery }) => { const { fuzzyMatchGroceryCategory } = useGroceryContext(); + const inputRef = useRef(null); useEffect(() => { if (editGrocery.setCategory) editGrocery.setCategory(fuzzyMatchGroceryCategory(editGrocery.title)); }, [editGrocery.title]); + useEffect(() => { + if (inputRef.current) { + inputRef.current.focus(); // Focus on the TextField + } + }, []); + return ( { }} > { diff --git a/components/pages/grocery/GroceryItem.tsx b/components/pages/grocery/GroceryItem.tsx index 750040a..97e5ade 100644 --- a/components/pages/grocery/GroceryItem.tsx +++ b/components/pages/grocery/GroceryItem.tsx @@ -54,13 +54,11 @@ const GroceryItem = ({ style={{ borderRadius: 18, marginVertical: 5 }} backgroundColor="white" centerV - padding-0 + paddingV-12 + paddingR-12 + paddingL-12 > - { - setOpenFreqEdit(true); - }} - > + - - {!isEditingTitle ? ( - - setIsEditingTitle(true)}> - {item.title} - - - ) : ( - + setIsEditingTitle(true)}> + {item.title} + + + ) : ( + + )} + {!item.approved ? ( + + { + handleItemApproved(item.id, { approved: true }); }} /> - )} - - - {!item.approved ? ( - -