forked from djunicode/inventory-management-rn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
183 lines (175 loc) · 5.24 KB
/
App.js
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
import React from 'react';
import {StatusBar,UIManager} from 'react-native';
import FlashMessage from "react-native-flash-message";
import {
NavigationContainer,
DarkTheme,
DefaultTheme,
} from '@react-navigation/native';
import {createStackNavigator, HeaderTitle} from '@react-navigation/stack';
import Icon_Feather from 'react-native-vector-icons/Feather';
import Icon_MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import {TouchableOpacity} from 'react-native';
import {createDrawerNavigator} from '@react-navigation/drawer';
import AddEmployee from './src/screens/AddEmployee';
import LoginScreen from './src/screens/LoginScreen';
import HomeScreen from './src/screens/HomeScreen';
import InventoryScreen from './src/screens/InventoryScreen';
import DrawerScreen2 from './src/screens/TransactionsScreen';
import EmployeeListScreen from './src/screens/EmployeeListScreen';
import SplashScreen from './src/screens/SplashScreen';
import CustomDrawer from './src/components/CustomDrawer';
import ProfilePage from './src/screens/ProfilePage';
import {appTheme} from './src/constants/colors';
import {spacing} from './src/constants/dimension';
import fontSizes from './src/constants/fontSizes';
import RegisterScreen from './src/screens/RegisterScreen';
const AppStack = createStackNavigator();
const Drawer = createDrawerNavigator();
const EmployeeStack = createStackNavigator();
if (Platform.OS === 'android') {
if (UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
}
const App = ({navigation}) => {
return (
<NavigationContainer theme={MyTheme}>
<AppStack.Navigator headerMode={null} initialRouteName="SplashScreen">
<AppStack.Screen
name="LoginScreen"
component={LoginScreen}
options={{title: 'Inventory Management', headerTitleAlign: 'center'}}
/>
<AppStack.Screen name="SplashScreen" component={SplashScreen} />
<AppStack.Screen name="RegisterScreen" component={RegisterScreen} />
<AppStack.Screen
name="ProfilePage"
component={ProfilePage}
options={{title: 'Employee', headerTitleAlign: 'center'}}
/>
<AppStack.Screen
name="Drawer"
component={BurgerBtn}
options={{
headerLeft: () => {
return (
<TouchableOpacity onPress={() => {}}>
<Icon_Feather
name="menu"
color={appTheme.textPrimary}
size={35}
/>
</TouchableOpacity>
);
},
headerRight: () => {
return (
<TouchableOpacity onPress={() => {}}>
<Icon_Feather
name="user"
color={appTheme.textPrimary}
size={35}
/>
</TouchableOpacity>
);
},
}}
/>
</AppStack.Navigator>
<FlashMessage position="top" floating={true}
titleStyle={{fontSize: fontSizes.h2}} />
</NavigationContainer>
);
};
function StackFn() {
return (
<EmployeeStack.Navigator initialRouteName="EmployeeList" headerMode="none">
<EmployeeStack.Screen
name="EmployeeList"
component={EmployeeListScreen}
/>
<EmployeeStack.Screen name="AddEmployee" component={AddEmployee} />
</EmployeeStack.Navigator>
);
}
function BurgerBtn() {
return (
<Drawer.Navigator
initialRouteName="Home"
drawerContent={props => <CustomDrawer {...props} />}>
<Drawer.Screen
name="Home"
component={HomeScreen}
options={
({title: 'Home'},
{
drawerIcon: () => (
<Icon_MaterialIcons
name="home"
size={24}
color={appTheme.appBlue}
/>
),
})
}
/>
<Drawer.Screen
name="Inventory"
component={InventoryScreen}
options={
({title: 'Inventory'},
{
drawerIcon: () => (
<Icon_Feather name="list" size={24} color={appTheme.appBlue} />
),
})
}
/>
<Drawer.Screen
name="Employee"
component={StackFn}
options={
({title: 'Employee'},
{
drawerIcon: () => (
<Icon_MaterialIcons
name="person"
size={24}
color={appTheme.appBlue}
/>
),
})
}
/>
<Drawer.Screen
name="Transactions"
component={DrawerScreen2}
options={
({title: 'Transactions'},
{labelStyle: {fontSize: 55}},
{
drawerIcon: () => (
<Icon_MaterialIcons
name="attach-money"
size={24}
color={appTheme.appBlue}
/>
),
})
}
/>
</Drawer.Navigator>
);
}
export default App;
const MyTheme = {
dark: false,
colors: {
primary: '#5c5e61',
background: appTheme.appgreyBackground,
card: appTheme.textPrimary,
text: '#000',
border: 'rgb(199, 199, 204)',
},
};