2024-08-10 19:06:25 +02:00
|
|
|
import { Tabs } from "expo-router";
|
2024-06-26 04:20:08 +02:00
|
|
|
|
2024-08-15 23:07:19 +02:00
|
|
|
import { SvgUri } from "react-native-svg";
|
2024-08-10 19:06:25 +02:00
|
|
|
import { Colors } from "@/constants/Colors";
|
|
|
|
import { useColorScheme } from "@/hooks/useColorScheme";
|
|
|
|
import { TabBarIcon } from "@/components/navigation/TabBarIcon";
|
|
|
|
import { Provider } from "react-redux";
|
|
|
|
import fixtures from "@/__fixtures__/initialProducts";
|
|
|
|
import { setupStore } from "../store";
|
2024-08-15 23:07:19 +02:00
|
|
|
|
|
|
|
const CARPET_ROLL_SVG = "/assets/images/icons/icon-carpet-roll-raw.svg";
|
|
|
|
const CARPET_ROLL_SELECTED_SVG =
|
|
|
|
"/assets/images/icons/icon-carpet-roll-selected-raw.svg";
|
2024-08-10 19:06:25 +02:00
|
|
|
|
|
|
|
const CarpetRollIcon = ({ selected }: { selected: boolean }) => {
|
2024-08-15 23:07:19 +02:00
|
|
|
const uri = selected ? CARPET_ROLL_SELECTED_SVG : CARPET_ROLL_SVG;
|
|
|
|
return <SvgUri width="2em" height="2em" uri={uri} />;
|
2024-08-10 19:06:25 +02:00
|
|
|
};
|
2024-06-26 04:20:08 +02:00
|
|
|
|
|
|
|
export default function TabLayout() {
|
|
|
|
const colorScheme = useColorScheme();
|
2024-06-29 02:04:30 +02:00
|
|
|
const store = setupStore({
|
2024-07-31 19:01:45 +02:00
|
|
|
products: fixtures,
|
2024-06-29 02:04:30 +02:00
|
|
|
});
|
2024-06-26 04:20:08 +02:00
|
|
|
return (
|
2024-06-29 02:04:30 +02:00
|
|
|
<Provider store={store}>
|
|
|
|
<Tabs
|
|
|
|
screenOptions={{
|
2024-08-10 19:06:25 +02:00
|
|
|
tabBarActiveTintColor: Colors[colorScheme ?? "light"].tint,
|
2024-06-29 02:04:30 +02:00
|
|
|
headerShown: false,
|
2024-08-10 19:06:25 +02:00
|
|
|
}}
|
|
|
|
>
|
2024-06-29 02:04:30 +02:00
|
|
|
<Tabs.Screen
|
|
|
|
name="index"
|
|
|
|
options={{
|
2024-08-10 19:06:25 +02:00
|
|
|
title: "Plywood",
|
|
|
|
tabBarIcon: ({ color, focused }) => (
|
|
|
|
<TabBarIcon
|
|
|
|
name={focused ? "scale" : "scale-outline"}
|
|
|
|
color={color}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Tabs.Screen
|
2024-08-15 23:07:19 +02:00
|
|
|
name="carpet-roll-calculator"
|
2024-08-10 19:06:25 +02:00
|
|
|
options={{
|
|
|
|
title: "Carpet Roll Calculator",
|
2024-06-29 02:04:30 +02:00
|
|
|
tabBarIcon: ({ color, focused }) => (
|
2024-08-10 19:06:25 +02:00
|
|
|
<CarpetRollIcon selected={focused} />
|
2024-06-29 02:04:30 +02:00
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Tabs.Screen
|
|
|
|
name="product-editor"
|
|
|
|
options={{
|
2024-08-10 19:06:25 +02:00
|
|
|
title: "Edit Products",
|
2024-06-29 02:04:30 +02:00
|
|
|
tabBarIcon: ({ color, focused }) => (
|
2024-08-10 19:06:25 +02:00
|
|
|
<TabBarIcon
|
|
|
|
name={focused ? "list" : "list-outline"}
|
|
|
|
color={color}
|
|
|
|
/>
|
2024-06-29 02:04:30 +02:00
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Tabs>
|
|
|
|
</Provider>
|
2024-06-26 04:20:08 +02:00
|
|
|
);
|
|
|
|
}
|