Files
cally/components/pages/grocery/CategoryDropdown.tsx
2024-10-17 19:57:41 +02:00

36 lines
982 B
TypeScript

import React from "react";
import { View, Text, TouchableOpacity } from "react-native-ui-lib";
import { GroceryCategory, useGroceryContext } from "@/contexts/GroceryContext";
import { ScrollView } from "react-native-gesture-handler";
const CategoryDropdown = (props: {
setSelectedCategory: (category: GroceryCategory) => void;
}) => {
const groceryCategories = Object.values(GroceryCategory);
return (
<View height={100}>
<ScrollView>
{groceryCategories.map((category) => (
<TouchableOpacity
onPress={() => {
props.setSelectedCategory(category);
}}
>
<View
key={category}
style={{
padding: 10,
}}
>
<Text style={{fontFamily: "Manrope_400Regular"}}>{category}</Text>
</View>
</TouchableOpacity>
))}
</ScrollView>
</View>
);
};
export default CategoryDropdown;