grocery icon changes

This commit is contained in:
ivic00
2024-08-26 23:20:54 +02:00
parent f440261447
commit c6985ef8f2

View File

@ -1,7 +1,9 @@
import { FlatList } from "react-native";
import React, { useState } from "react";
import { View, Text, ListItem } from "react-native-ui-lib";
import { View, Text, ListItem, Button } from "react-native-ui-lib";
import MaterialCommunityIcons from "@expo/vector-icons/MaterialCommunityIcons";
import { ProfileType, useAuthContext } from "@/contexts/AuthContext";
import AntDesign from "@expo/vector-icons/AntDesign";
export interface IGrocery {
title: String;
@ -66,7 +68,7 @@ const GroceryList = () => {
bought: false,
},
]);
const { user, profileType } = useAuthContext();
const renderItem = ({ item }: { item: IGrocery }) => (
<ListItem backgroundColor="white">
<ListItem.Part left containerStyle={{ flex: 1, paddingStart: 15 }}>
@ -90,9 +92,42 @@ const GroceryList = () => {
</View>
</ListItem.Part>
<ListItem.Part right containerStyle={{ paddingEnd: 15 }}>
<Text style={{ color: item.approved ? "green" : "red" }}>
{item.approved ? "+" : "X"}
</Text>
{profileType == ProfileType.PARENT ? (
<View row>
<Button
children={
<AntDesign
name="check"
size={24}
style={{
color: item.approved ? "green" : "#aaaaaa",
}}
/>
}
backgroundColor="transparent"
size={Button.sizes.small}
/>
<Button
children={
<AntDesign
name="close"
size={24}
style={{ color: item.approved ? "#aaaaaa" : "red" }}
/>
}
backgroundColor="transparent"
size={Button.sizes.small}
/>
</View>
) : (
<Text style={{ color: item.bought ? "green" : "red" }}>
{item.approved ? <AntDesign
name="check"
size={24}
color={'green'}
/> : "X"}
</Text>
)}
</ListItem.Part>
</ListItem>
);