mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +00:00
grocery icon changes
This commit is contained in:
@ -1,7 +1,9 @@
|
|||||||
import { FlatList } from "react-native";
|
import { FlatList } from "react-native";
|
||||||
import React, { useState } from "react";
|
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 MaterialCommunityIcons from "@expo/vector-icons/MaterialCommunityIcons";
|
||||||
|
import { ProfileType, useAuthContext } from "@/contexts/AuthContext";
|
||||||
|
import AntDesign from "@expo/vector-icons/AntDesign";
|
||||||
|
|
||||||
export interface IGrocery {
|
export interface IGrocery {
|
||||||
title: String;
|
title: String;
|
||||||
@ -66,7 +68,7 @@ const GroceryList = () => {
|
|||||||
bought: false,
|
bought: false,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
const { user, profileType } = useAuthContext();
|
||||||
const renderItem = ({ item }: { item: IGrocery }) => (
|
const renderItem = ({ item }: { item: IGrocery }) => (
|
||||||
<ListItem backgroundColor="white">
|
<ListItem backgroundColor="white">
|
||||||
<ListItem.Part left containerStyle={{ flex: 1, paddingStart: 15 }}>
|
<ListItem.Part left containerStyle={{ flex: 1, paddingStart: 15 }}>
|
||||||
@ -90,9 +92,42 @@ const GroceryList = () => {
|
|||||||
</View>
|
</View>
|
||||||
</ListItem.Part>
|
</ListItem.Part>
|
||||||
<ListItem.Part right containerStyle={{ paddingEnd: 15 }}>
|
<ListItem.Part right containerStyle={{ paddingEnd: 15 }}>
|
||||||
<Text style={{ color: item.approved ? "green" : "red" }}>
|
{profileType == ProfileType.PARENT ? (
|
||||||
{item.approved ? "+" : "X"}
|
<View row>
|
||||||
</Text>
|
<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.Part>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user