-
Notifications
You must be signed in to change notification settings - Fork 3k
/
ModalStackNavigators.js
477 lines (457 loc) · 15.5 KB
/
ModalStackNavigators.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
import _ from 'underscore';
import React from 'react';
import {createStackNavigator, CardStyleInterpolators} from '@react-navigation/stack';
import styles from '../../../styles/styles';
import CONST from '../../../CONST';
const defaultSubRouteOptions = {
cardStyle: styles.navigationScreenCardStyle,
headerShown: false,
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS,
};
/**
* Create a modal stack navigator with an array of sub-screens.
*
* @param {Object[]} screens array of screen config objects
* @returns {Function}
*/
function createModalStackNavigator(screens) {
const ModalStackNavigator = createStackNavigator();
return () => (
<ModalStackNavigator.Navigator
screenOptions={defaultSubRouteOptions}
>
{_.map(screens, screen => (
<ModalStackNavigator.Screen
key={screen.name}
name={screen.name}
getComponent={screen.getComponent}
initialParams={screen.initialParams}
/>
))}
</ModalStackNavigator.Navigator>
);
}
// We use getComponent/require syntax so that file used by screens are not loaded until we need them.
const IOUBillStackNavigator = createModalStackNavigator([{
getComponent: () => {
const IOUBillPage = require('../../../pages/iou/IOUBillPage').default;
return IOUBillPage;
},
name: 'IOU_Bill_Root',
},
{
getComponent: () => {
const IOUCurrencySelection = require('../../../pages/iou/IOUCurrencySelection').default;
return IOUCurrencySelection;
},
name: 'IOU_Bill_Currency',
}]);
const IOURequestModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const IOURequestPage = require('../../../pages/iou/IOURequestPage').default;
return IOURequestPage;
},
name: 'IOU_Request_Root',
},
{
getComponent: () => {
const IOUCurrencySelection = require('../../../pages/iou/IOUCurrencySelection').default;
return IOUCurrencySelection;
},
name: 'IOU_Request_Currency',
}]);
const IOUSendModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const IOUSendPage = require('../../../pages/iou/IOUSendPage').default;
return IOUSendPage;
},
name: 'IOU_Send_Root',
},
{
getComponent: () => {
const IOUCurrencySelection = require('../../../pages/iou/IOUCurrencySelection').default;
return IOUCurrencySelection;
},
name: 'IOU_Send_Currency',
},
{
getComponent: () => {
const AddPersonalBankAccountPage = require('../../../pages/AddPersonalBankAccountPage').default;
return AddPersonalBankAccountPage;
},
name: 'IOU_Send_Add_Bank_Account',
},
{
getComponent: () => {
const AddDebitCardPage = require('../../../pages/settings/Payments/AddDebitCardPage').default;
return AddDebitCardPage;
},
name: 'IOU_Send_Add_Debit_Card',
},
{
getComponent: () => {
const EnablePaymentsPage = require('../../../pages/EnablePayments/EnablePaymentsPage').default;
return EnablePaymentsPage;
},
name: 'IOU_Send_Enable_Payments',
}]);
const IOUDetailsModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const IOUDetailsModal = require('../../../pages/iou/IOUDetailsModal').default;
return IOUDetailsModal;
},
name: 'IOU_Details_Root',
},
{
getComponent: () => {
const AddPersonalBankAccountPage = require('../../../pages/AddPersonalBankAccountPage').default;
return AddPersonalBankAccountPage;
},
name: 'IOU_Details_Add_Bank_Account',
},
{
getComponent: () => {
const AddDebitCardPage = require('../../../pages/settings/Payments/AddDebitCardPage').default;
return AddDebitCardPage;
},
name: 'IOU_Details_Add_Debit_Card',
},
{
getComponent: () => {
const EnablePaymentsPage = require('../../../pages/EnablePayments/EnablePaymentsPage').default;
return EnablePaymentsPage;
},
name: 'IOU_Details_Enable_Payments',
}]);
const DetailsModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const DetailsPage = require('../../../pages/DetailsPage').default;
return DetailsPage;
},
name: 'Details_Root',
}]);
const ReportDetailsModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const ReportDetailsPage = require('../../../pages/ReportDetailsPage').default;
return ReportDetailsPage;
},
name: 'Report_Details_Root',
}]);
const ReportSettingsModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const ReportSettingsPage = require('../../../pages/ReportSettingsPage').default;
return ReportSettingsPage;
},
name: 'Report_Settings_Root',
}]);
const ReportParticipantsModalStackNavigator = createModalStackNavigator([
{
getComponent: () => {
const ReportParticipantsPage = require('../../../pages/ReportParticipantsPage').default;
return ReportParticipantsPage;
},
name: 'ReportParticipants_Root',
},
{
getComponent: () => {
const DetailsPage = require('../../../pages/DetailsPage').default;
return DetailsPage;
},
name: 'ReportParticipants_Details',
},
]);
const SearchModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const SearchPage = require('../../../pages/SearchPage').default;
return SearchPage;
},
name: 'Search_Root',
}]);
const NewGroupModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const NewGroupPage = require('../../../pages/NewGroupPage').default;
return NewGroupPage;
},
name: 'NewGroup_Root',
}]);
const NewChatModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const NewChatPage = require('../../../pages/NewChatPage').default;
return NewChatPage;
},
name: 'NewChat_Root',
}]);
const SettingsModalStackNavigator = createModalStackNavigator([
{
getComponent: () => {
const SettingsInitialPage = require('../../../pages/settings/InitialSettingsPage').default;
return SettingsInitialPage;
},
name: 'Settings_Root',
},
{
getComponent: () => {
const SettingsWorkspacesPage = require('../../../pages/workspace/WorkspacesListPage').default;
return SettingsWorkspacesPage;
},
name: 'Settings_Workspaces',
},
{
getComponent: () => {
const SettingsProfilePage = require('../../../pages/settings/Profile/ProfilePage').default;
return SettingsProfilePage;
},
name: 'Settings_Profile',
},
{
getComponent: () => {
const SettingsPronounsPage = require('../../../pages/settings/Profile/PronounsPage').default;
return SettingsPronounsPage;
},
name: 'Settings_Pronouns',
},
{
getComponent: () => {
const SettingsDisplayNamePage = require('../../../pages/settings/Profile/DisplayNamePage').default;
return SettingsDisplayNamePage;
},
name: 'Settings_Display_Name',
},
{
getComponent: () => {
const SettingsAddSecondaryLoginPage = require('../../../pages/settings/AddSecondaryLoginPage').default;
return SettingsAddSecondaryLoginPage;
},
name: 'Settings_Add_Secondary_Login',
},
{
getComponent: () => {
const SettingsPreferencesPage = require('../../../pages/settings/PreferencesPage').default;
return SettingsPreferencesPage;
},
name: 'Settings_Preferences',
},
{
getComponent: () => {
const SettingsPasswordPage = require('../../../pages/settings/PasswordPage').default;
return SettingsPasswordPage;
},
name: 'Settings_Password',
},
{
getComponent: () => {
const SettingsCloseAccountPage = require('../../../pages/settings/Security/CloseAccountPage').default;
return SettingsCloseAccountPage;
},
name: 'Settings_Close',
},
{
getComponent: () => {
const SettingsSecurityPage = require('../../../pages/settings/Security/SecuritySettingsPage').default;
return SettingsSecurityPage;
},
name: 'Settings_Security',
},
{
getComponent: () => {
const SettingsAboutPage = require('../../../pages/settings/AboutPage/AboutPage').default;
return SettingsAboutPage;
},
name: 'Settings_About',
},
{
getComponent: () => {
const SettingsAppDownloadLinks = require('../../../pages/settings/AppDownloadLinks').default;
return SettingsAppDownloadLinks;
},
name: 'Settings_App_Download_Links',
},
{
getComponent: () => {
const SettingsPaymentsPage = require('../../../pages/settings/Payments/PaymentsPage').default;
return SettingsPaymentsPage;
},
name: 'Settings_Payments',
},
{
getComponent: () => {
const TransferBalancePage = require('../../../pages/settings/Payments/TransferBalancePage').default;
return TransferBalancePage;
},
name: 'Settings_Payments_Transfer_Balance',
},
{
getComponent: () => {
const ChooseTransferAccountPage = require('../../../pages/settings/Payments/ChooseTransferAccountPage').default;
return ChooseTransferAccountPage;
},
name: 'Settings_Payments_Choose_Transfer_Account',
},
{
getComponent: () => {
const SettingsAddPayPalMePage = require('../../../pages/settings/Payments/AddPayPalMePage').default;
return SettingsAddPayPalMePage;
},
name: 'Settings_Add_Paypal_Me',
},
{
getComponent: () => {
const EnablePaymentsPage = require('../../../pages/EnablePayments/EnablePaymentsPage').default;
return EnablePaymentsPage;
},
name: 'Settings_Payments_EnablePayments',
},
{
getComponent: () => {
const AddDebitCardPage = require('../../../pages/settings/Payments/AddDebitCardPage').default;
return AddDebitCardPage;
},
name: 'Settings_Add_Debit_Card',
},
{
getComponent: () => {
const AddPersonalBankAccountPage = require('../../../pages/AddPersonalBankAccountPage').default;
return AddPersonalBankAccountPage;
},
name: 'Settings_Add_Bank_Account',
},
{
getComponent: () => {
const WorkspaceInitialPage = require('../../../pages/workspace/WorkspaceInitialPage').default;
return WorkspaceInitialPage;
},
name: 'Workspace_Initial',
},
{
getComponent: () => {
const WorkspaceSettingsPage = require('../../../pages/workspace/WorkspaceSettingsPage').default;
return WorkspaceSettingsPage;
},
name: 'Workspace_Settings',
},
{
getComponent: () => {
const WorkspaceCardPage = require('../../../pages/workspace/card/WorkspaceCardPage').default;
return WorkspaceCardPage;
},
name: 'Workspace_Card',
},
{
getComponent: () => {
const WorkspaceReimbursePage = require('../../../pages/workspace/reimburse/WorkspaceReimbursePage').default;
return WorkspaceReimbursePage;
},
name: 'Workspace_Reimburse',
},
{
getComponent: () => {
const WorkspaceBillsPage = require('../../../pages/workspace/bills/WorkspaceBillsPage').default;
return WorkspaceBillsPage;
},
name: 'Workspace_Bills',
},
{
getComponent: () => {
const WorkspaceInvoicesPage = require('../../../pages/workspace/invoices/WorkspaceInvoicesPage').default;
return WorkspaceInvoicesPage;
},
name: 'Workspace_Invoices',
},
{
getComponent: () => {
const WorkspaceTravelPage = require('../../../pages/workspace/travel/WorkspaceTravelPage').default;
return WorkspaceTravelPage;
},
name: 'Workspace_Travel',
},
{
getComponent: () => {
const WorkspaceMembersPage = require('../../../pages/workspace/WorkspaceMembersPage').default;
return WorkspaceMembersPage;
},
name: 'Workspace_Members',
},
{
getComponent: () => {
const WorkspaceInvitePage = require('../../../pages/workspace/WorkspaceInvitePage').default;
return WorkspaceInvitePage;
},
name: 'Workspace_Invite',
},
{
getComponent: () => {
const WorkspaceNewRoomPage = require('../../../pages/workspace/WorkspaceNewRoomPage').default;
return WorkspaceNewRoomPage;
},
name: 'Workspace_NewRoom',
},
{
getComponent: () => {
const ReimbursementAccountPage = require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default;
return ReimbursementAccountPage;
},
name: 'ReimbursementAccount',
initialParams: {stepToOpen: CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT},
},
{
getComponent: () => {
const GetAssistancePage = require('../../../pages/GetAssistancePage').default;
return GetAssistancePage;
},
name: 'GetAssistance',
},
]);
const EnablePaymentsStackNavigator = createModalStackNavigator([{
getComponent: () => {
const EnablePaymentsPage = require('../../../pages/EnablePayments/EnablePaymentsPage').default;
return EnablePaymentsPage;
},
name: 'EnablePayments_Root',
}]);
const AddPersonalBankAccountModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const AddPersonalBankAccountPage = require('../../../pages/AddPersonalBankAccountPage').default;
return AddPersonalBankAccountPage;
},
name: 'AddPersonalBankAccount_Root',
}]);
const ReimbursementAccountModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const ReimbursementAccountPage = require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default;
return ReimbursementAccountPage;
},
name: 'ReimbursementAccount_Root',
}]);
const RequestCallModalStackNavigator = createModalStackNavigator([{
getComponent: () => {
const RequestCallPage = require('../../../pages/RequestCallPage').default;
return RequestCallPage;
},
name: 'RequestCall_Root',
}]);
const WalletStatementStackNavigator = createModalStackNavigator([{
getComponent: () => {
const WalletStatementPage = require('../../../pages/wallet/WalletStatementPage').default;
return WalletStatementPage;
},
name: 'WalletStatement_Root',
}]);
export {
IOUBillStackNavigator,
IOURequestModalStackNavigator,
IOUSendModalStackNavigator,
IOUDetailsModalStackNavigator,
DetailsModalStackNavigator,
ReportDetailsModalStackNavigator,
ReportSettingsModalStackNavigator,
ReportParticipantsModalStackNavigator,
SearchModalStackNavigator,
NewGroupModalStackNavigator,
NewChatModalStackNavigator,
SettingsModalStackNavigator,
EnablePaymentsStackNavigator,
AddPersonalBankAccountModalStackNavigator,
ReimbursementAccountModalStackNavigator,
RequestCallModalStackNavigator,
WalletStatementStackNavigator,
};