-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
92 lines (86 loc) · 2.88 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import 'react-native-gesture-handler';
import React from 'react';
import { View } from 'react-native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import type { BottomTabsParamList, RootStackParamList } from './types';
import { createMaterialBottomTabNavigator } from 'react-native-paper/react-navigation';
import Register from './src/screens/Register';
import Login from './src/screens/Login';
import Home from './src/screens/Home';
import Search from './src/screens/Search';
import AddItem from './src/screens/AddItem';
import Item from './src/screens/Item';
import Camera from './src/screens/Camera';
import CreateItem from './src/screens/CreateItem';
import ColorSchemeProvider from './src/components/ColorScheme';
import { useAuthUser } from './src/hooks';
import CreateStorage from './src/screens/CreateStorage';
import Storages from './src/screens/Storages';
import DataFetcher from './src/components/DataFetcher';
import InvoiceViewer from './src/screens/InvoiceViewer';
const Stack = createNativeStackNavigator<RootStackParamList>();
const Tab = createMaterialBottomTabNavigator<BottomTabsParamList>();
function App(): JSX.Element {
const user = useAuthUser();
return (
<View className="flex-1">
{!!user && <DataFetcher />}
<ColorSchemeProvider>
<Stack.Navigator screenOptions={{ headerShown: false }}>
{!user ? (
<>
<Stack.Screen name="Register" component={Register} />
<Stack.Screen name="Login" component={Login} />
</>
) : (
<>
<Stack.Screen name="BottomTabs" component={BottomTabs} />
<Stack.Screen name="Item" component={Item} />
<Stack.Screen name="Camera" component={Camera} />
<Stack.Screen name="CreateItem" component={CreateItem} />
<Stack.Screen name="CreateStorage" component={CreateStorage} />
<Stack.Screen
name="InvoiceViewer"
component={InvoiceViewer}
options={{ presentation: 'transparentModal' }}
/>
</>
)}
</Stack.Navigator>
</ColorSchemeProvider>
</View>
);
}
export default App;
const BottomTabs = () => {
return (
<Tab.Navigator>
<Tab.Screen
name="Home"
component={Home}
options={{ tabBarIcon: 'home' }}
/>
<Tab.Screen
name="Search"
component={Search}
options={{ tabBarIcon: 'magnify' }}
/>
<Tab.Screen
name="AddItem"
component={AddItem}
options={{ tabBarIcon: 'camera-plus-outline', title: 'Add Item' }}
/>
<Tab.Screen
name="Storages"
component={Storages}
options={{ tabBarIcon: 'package-variant' }}
/>
</Tab.Navigator>
);
};