From 667e882e9c571f1958f62a7c8e0e62a760521fd8 Mon Sep 17 00:00:00 2001 From: dtun Date: Tue, 13 Aug 2024 20:29:10 -0700 Subject: [PATCH] Use meta on MyMenuView --- components/MyMenuView.tsx | 3 ++- components/MyMenuViewItem.tsx | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/components/MyMenuView.tsx b/components/MyMenuView.tsx index e00c310..3d8b999 100644 --- a/components/MyMenuView.tsx +++ b/components/MyMenuView.tsx @@ -1,6 +1,7 @@ import { Link } from "expo-router"; import { StyleSheet, FlatList } from "react-native"; +import { getItemData } from "@/utils"; import { Text, View } from "@/components/Themed"; import { ItemSeparator } from "@/components/ItemSeparator"; import { MyMenuViewItem } from "@/components/MyMenuViewItem"; @@ -23,7 +24,7 @@ export function MyMenuView({ menuData }: { menuData: MenuItem[] }) { } renderItem={({ item }) => ( - + )} style={styles.list} /> diff --git a/components/MyMenuViewItem.tsx b/components/MyMenuViewItem.tsx index b3c4614..3a75595 100644 --- a/components/MyMenuViewItem.tsx +++ b/components/MyMenuViewItem.tsx @@ -1,19 +1,16 @@ import { StyleSheet } from "react-native"; -import { getItemData } from "@/utils"; import { Text, View, Icon } from "@/components/Themed"; -import type { MenuData, MenuItem } from "@/types"; +import type { MenuItemMeta, MenuItem } from "@/types"; export function MyMenuViewItem({ - item: { icon, id, title }, - menuData, + item: { icon, title }, + meta: { isFirst, isLast }, }: { item: MenuItem; - menuData: MenuData; + meta: MenuItemMeta; }) { - let { isFirst, isLast } = getItemData(id, menuData); - return (