Skip to content

Commit

Permalink
Add Categories tab
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Mar 22, 2023
1 parent eeeab14 commit 740be83
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 7 deletions.
4 changes: 1 addition & 3 deletions app/_layout.tsx
@@ -1,5 +1,3 @@
import { Stack } from "expo-router/stack";

export default function Layout() {
return <Stack />;
}
export default Stack;
30 changes: 30 additions & 0 deletions app/accounts/[id]/_layout.tsx
@@ -0,0 +1,30 @@
import { Stack, Tabs, useSearchParams } from "expo-router";
import React from "react";
import MaterialCommunityIcons from "@expo/vector-icons/MaterialCommunityIcons";

export default function AccountLayout() {
const params = useSearchParams();
return (
<>
<Stack.Screen options={{ title: `${params.id}` }} />
<Tabs initialRouteName="transactions">
<Tabs.Screen
name="transactions"
options={{
headerShown: false,
tabBarIcon: () => <MaterialCommunityIcons name="cash" size={24} />,
tabBarLabel: "Transactions",
}}
/>
<Tabs.Screen
name="categories"
options={{
headerShown: false,
tabBarIcon: () => <MaterialCommunityIcons name="shape" size={24} />,
tabBarLabel: "Categories",
}}
/>
</Tabs>
</>
);
}
9 changes: 9 additions & 0 deletions app/accounts/[id]/categories.tsx
@@ -0,0 +1,9 @@
import { Text, View } from "react-native";

export default function Categories(): JSX.Element {
return (
<View style={{ flex: 1 }}>
<Text>Categories</Text>
</View>
);
}
8 changes: 4 additions & 4 deletions app/accounts/[id].tsx → app/accounts/[id]/transactions.tsx
@@ -1,4 +1,4 @@
import { Stack, useSearchParams } from "expo-router";
import { Stack, Tabs, useSearchParams } from "expo-router";
import {
addDoc,
collection,
Expand All @@ -16,7 +16,7 @@ import {
Provider,
TextInput,
} from "react-native-paper";
import { db } from "../../firebase";
import { db } from "../../../firebase";
import {
AccountEvent,
createTransaction,
Expand All @@ -25,7 +25,7 @@ import {
restoreTransactions,
Transactions,
updateTransaction,
} from "../../lib/transactions";
} from "../../../lib/transactions";

// API

Expand Down Expand Up @@ -155,7 +155,7 @@ function EditTransactionDialog({
);
}

export default function Account(): JSX.Element {
export default function TransactionsRoot(): JSX.Element {
const params = useSearchParams();
const accountId = `${params.id}`;
const [deleteModalVisible, setDeleteModalVisible] = useState<boolean>(false);
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -9,6 +9,7 @@
"web": "expo start --web"
},
"dependencies": {
"@expo/vector-icons": "^13.0.0",
"@react-native-async-storage/async-storage": "^1.17.12",
"expo": "~48.0.6",
"expo-constants": "~14.2.1",
Expand Down

0 comments on commit 740be83

Please sign in to comment.