-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
166 lines (164 loc) · 7.98 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
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
import React from 'react';
import { KeyboardAvoidingView, Platform } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { RootStack } from './src/router';
import HomePage from './src/pages/home-page';
import PlaygroundPage from './src/pages/playground-page';
import { Provider as PaperProvider } from 'react-native-paper';
import { paperTheme } from './src/theme/paper-theme';
import AppBar, { AppBarBackgroundColor } from './src/components/app-bar';
import FindTaskPage from './src/pages/find-task-page';
import Settings from './src/pages/settings';
import CreateTask from './src/pages/create-task';
import TasksPage from './src/pages/tasks-page';
import TaskCompleted from './src/pages/task-completed';
import HelpDetails from './src/pages/help-details-page';
import Register from './src/pages/register-page';
import { Provider as ReduxProvider, Provider } from 'react-redux';
import store from './src/model/redux/store';
import TaskAccepted from './src/pages/task-accepted';
import TaskCreated from './src/pages/task-created';
console.disableYellowBox = true;
/*
store.subscribe(() => {
console.groupCollapsed("State change");
console.log(store.getState());
console.groupEnd();
});
*/
export default function App() {
return (
<Provider store={store}>
<PaperProvider theme={paperTheme}>
<NavigationContainer>
<KeyboardAvoidingView
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
style={{ flex: 1 }}
>
{/* If you want to add a new page, you must first add the page name in router.tsx */}
<RootStack.Navigator
initialRouteName='Register'
headerMode='screen'
screenOptions={{
header: (headerProps) => (
<AppBar headerProps={headerProps} />
),
}}>
<RootStack.Screen
name='Register'
options={{
title: '',
header: (headerProps) => (
<AppBar
headerProps={headerProps}
disableBackAction
backgroundColor={AppBarBackgroundColor.CANVAS} />
),
}}
component={Register} />
<RootStack.Screen
name='Home'
options={{
headerTitle: '',
header: (headerProps) => (
<AppBar
disableBackAction
backgroundColor={AppBarBackgroundColor.CANVAS}
headerProps={headerProps}
actionIcon={'settings'}/>
),
}}
component={HomePage} />
<RootStack.Screen
name='FindTask'
component={FindTaskPage}
options={{
title: 'Find Task',
header: (headerProps) => (
<AppBar headerProps={headerProps} actionIcon={'folder'} />
),
}}
/>
<RootStack.Screen
name='Playground'
options={{
header: (headerProps) => (
<AppBar headerProps={headerProps} actionIcon={'hospital'} />
),
}}
component={PlaygroundPage} />
<RootStack.Screen
name='CreateTask'
options={{
title: 'Receive Help',
header: (headerProps) => (
<AppBar
headerProps={headerProps}
actionIcon={'send'}/>
),
}}
component={CreateTask} />
<RootStack.Screen
name='TaskCreated'
options={{
title: 'Task Created',
header: (headerProps) => (
<AppBar headerProps={headerProps} />
),
}}
component={TaskCreated} />
<RootStack.Screen
name='Tasks'
options={{
title: 'Tasks',
header: (headerProps) => (
<AppBar headerProps={headerProps} />
),
}}
component={TasksPage} />
<RootStack.Screen
name='TaskCompleted'
options={{
title: '',
header: (headerProps) => (
<AppBar
disableBackAction
headerProps={headerProps}
actionIcon={'window-close'}/>
),
}}
component={TaskCompleted} />
<RootStack.Screen
name="HelpDetails"
options={{
title: "Task Details",
header: (headerProps) => (
<AppBar headerProps={headerProps} />
),
}}
component={HelpDetails} />
<RootStack.Screen
name='Settings'
options={{
title: 'Settings',
header: (headerProps) => (
<AppBar headerProps={headerProps} />
),
}}
component={Settings} />
<RootStack.Screen
name="TaskAccepted"
options={{
title: "Your task",
header: (headerProps) => (
<AppBar headerProps={headerProps} />
),
}}
component={TaskAccepted} />
</RootStack.Navigator>
</KeyboardAvoidingView>
</NavigationContainer>
</PaperProvider>
</Provider>
);
}