Skip to content

Commit

Permalink
Use meta on MyMenuView
Browse files Browse the repository at this point in the history
  • Loading branch information
dtun committed Aug 14, 2024
1 parent 4eb3736 commit 667e882
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion components/MyMenuView.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -23,7 +24,7 @@ export function MyMenuView({ menuData }: { menuData: MenuItem[] }) {
</View>
}
renderItem={({ item }) => (
<MyMenuViewItem item={item} menuData={menuData} />
<MyMenuViewItem item={item} meta={getItemData(item.id, menuData)} />
)}
style={styles.list}
/>
Expand Down
11 changes: 4 additions & 7 deletions components/MyMenuViewItem.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<View
accessible
Expand Down

0 comments on commit 667e882

Please sign in to comment.