From a513f8dccf110a8ca66b6ada5c5025b380941703 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Fri, 22 Sep 2023 20:25:11 +0800 Subject: [PATCH 1/4] Consolidate navigator --- .../AppNavigator/ModalStackNavigators.js | 814 +++--------------- .../ReimbursementAccountPage.js | 2 +- 2 files changed, 112 insertions(+), 704 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index f3939eabe6f7..09efc3b230c8 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -32,760 +32,168 @@ function createModalStackNavigator(screens) { ); } +/** + * Returns an object used by the stack navigator to link a route to a rendering component + * + * @param {String} name of the screen in linkingConfig + * @param {Function} getComponent returns a component that is require()'d + * @returns {Object} + */ +const createRouteRenderingComponent = (name, getComponent) => ({ + // require() syntax is used here so that the file used by a screen are loaded only when the route is accessed + getComponent, + name, +}); + // We use getComponent/require syntax so that file used by screens are not loaded until we need them. const MoneyRequestModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const MoneyRequestSelectorPage = require('../../../pages/iou/MoneyRequestSelectorPage').default; - return MoneyRequestSelectorPage; - }, - name: 'Money_Request', - }, - { - getComponent: () => { - const MoneyRequestEditAmountPage = require('../../../pages/iou/steps/NewRequestAmountPage').default; - return MoneyRequestEditAmountPage; - }, - name: 'Money_Request_Amount', - }, - { - getComponent: () => { - const MoneyRequestParticipantsPage = require('../../../pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage').default; - return MoneyRequestParticipantsPage; - }, - name: 'Money_Request_Participants', - }, - { - getComponent: () => { - const MoneyRequestConfirmPage = require('../../../pages/iou/steps/MoneyRequestConfirmPage').default; - return MoneyRequestConfirmPage; - }, - name: 'Money_Request_Confirmation', - }, - { - getComponent: () => { - const IOUCurrencySelection = require('../../../pages/iou/IOUCurrencySelection').default; - return IOUCurrencySelection; - }, - name: 'Money_Request_Currency', - }, - { - getComponent: () => { - const MoneyRequestDatePage = require('../../../pages/iou/MoneyRequestDatePage').default; - return MoneyRequestDatePage; - }, - name: 'Money_Request_Date', - }, - { - getComponent: () => { - const MoneyRequestDescriptionPage = require('../../../pages/iou/MoneyRequestDescriptionPage').default; - return MoneyRequestDescriptionPage; - }, - name: 'Money_Request_Description', - }, - { - getComponent: () => { - const MoneyRequestCategoryPage = require('../../../pages/iou/MoneyRequestCategoryPage').default; - return MoneyRequestCategoryPage; - }, - name: 'Money_Request_Category', - }, - { - getComponent: () => { - const MoneyRequestTagPage = require('../../../pages/iou/MoneyRequestTagPage').default; - return MoneyRequestTagPage; - }, - name: 'Money_Request_Tag', - }, - { - getComponent: () => { - const MoneyRequestMerchantPage = require('../../../pages/iou/MoneyRequestMerchantPage').default; - return MoneyRequestMerchantPage; - }, - name: 'Money_Request_Merchant', - }, - { - getComponent: () => { - const AddPersonalBankAccountPage = require('../../../pages/AddPersonalBankAccountPage').default; - return AddPersonalBankAccountPage; - }, - name: 'IOU_Send_Add_Bank_Account', - }, - { - getComponent: () => { - const AddDebitCardPage = require('../../../pages/settings/Wallet/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', - }, - { - getComponent: () => { - const WaypointEditorPage = require('../../../pages/iou/WaypointEditorPage').default; - return WaypointEditorPage; - }, - name: 'Money_Request_Waypoint', - }, - { - getComponent: () => { - const DistanceRequestEditPage = require('../../../pages/iou/DistanceRequestPage').default; - return DistanceRequestEditPage; - }, - name: 'Money_Request_Address', - }, + createRouteRenderingComponent('Money_Request', () => require('../../../pages/iou/MoneyRequestSelectorPage').default), + createRouteRenderingComponent('Money_Request_Amount', () => require('../../../pages/iou/steps/NewRequestAmountPage').default), + createRouteRenderingComponent('Money_Request_Participants', () => require('../../../pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage').default), + createRouteRenderingComponent('Money_Request_Confirmation', () => require('../../../pages/iou/steps/MoneyRequestConfirmPage').default), + createRouteRenderingComponent('Money_Request_Currency', () => require('../../../pages/iou/IOUCurrencySelection').default), + createRouteRenderingComponent('Money_Request_Date', () => require('../../../pages/iou/MoneyRequestDatePage').default), + createRouteRenderingComponent('Money_Request_Description', () => require('../../../pages/iou/MoneyRequestDescriptionPage').default), + createRouteRenderingComponent('Money_Request_Category', () => require('../../../pages/iou/MoneyRequestCategoryPage').default), + createRouteRenderingComponent('Money_Request_Tag', () => require('../../../pages/iou/MoneyRequestTagPage').default), + createRouteRenderingComponent('Money_Request_Merchant', () => require('../../../pages/iou/MoneyRequestMerchantPage').default), + createRouteRenderingComponent('IOU_Send_Add_Bank_Account', () => require('../../../pages/AddPersonalBankAccountPage').default), + createRouteRenderingComponent('IOU_Send_Add_Debit_Card', () => require('../../../pages/settings/Wallet/AddDebitCardPage').default), + createRouteRenderingComponent('IOU_Send_Enable_Payments', () => require('../../../pages/EnablePayments/EnablePaymentsPage').default), + createRouteRenderingComponent('Money_Request_Waypoint', () => require('../../../pages/iou/WaypointEditorPage').default), + createRouteRenderingComponent('Money_Request_Address', () => require('../../../pages/iou/DistanceRequestPage').default), ]); -const SplitDetailsModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const SplitBillDetailsPage = require('../../../pages/iou/SplitBillDetailsPage').default; - return SplitBillDetailsPage; - }, - name: 'SplitDetails_Root', - }, -]); +const SplitDetailsModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('SplitDetails_Root', () => require('../../../pages/iou/SplitBillDetailsPage').default)]); -const DetailsModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const DetailsPage = require('../../../pages/DetailsPage').default; - return DetailsPage; - }, - name: 'Details_Root', - }, -]); +const DetailsModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('Details_Root', () => require('../../../pages/DetailsPage').default)]); -const ProfileModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const ProfilePage = require('../../../pages/ProfilePage').default; - return ProfilePage; - }, - name: 'Profile_Root', - }, -]); +const ProfileModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('Profile_Root', () => require('../../../pages/ProfilePage').default)]); const ReportDetailsModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const ReportDetailsPage = require('../../../pages/ReportDetailsPage').default; - return ReportDetailsPage; - }, - name: 'Report_Details_Root', - }, - { - getComponent: () => { - const ShareCodePage = require('../../../pages/home/report/ReportDetailsShareCodePage').default; - return ShareCodePage; - }, - name: 'Report_Details_Share_Code', - }, + createRouteRenderingComponent('Report_Details_Root', () => require('../../../pages/ReportDetailsPage').default), + createRouteRenderingComponent('Report_Details_Share_Code', () => require('../../../pages/home/report/ReportDetailsShareCodePage').default), ]); const ReportSettingsModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const ReportSettingsPage = require('../../../pages/settings/Report/ReportSettingsPage').default; - return ReportSettingsPage; - }, - name: 'Report_Settings_Root', - }, - { - getComponent: () => { - const RoomNamePage = require('../../../pages/settings/Report/RoomNamePage').default; - return RoomNamePage; - }, - name: 'Report_Settings_Room_Name', - }, - { - getComponent: () => { - const NotificationPreferencesPage = require('../../../pages/settings/Report/NotificationPreferencePage').default; - return NotificationPreferencesPage; - }, - name: 'Report_Settings_Notification_Preferences', - }, - { - getComponent: () => { - const WriteCapabilityPage = require('../../../pages/settings/Report/WriteCapabilityPage').default; - return WriteCapabilityPage; - }, - name: 'Report_Settings_Write_Capability', - }, + createRouteRenderingComponent('Report_Settings_Root', () => require('../../../pages/settings/Report/ReportSettingsPage').default), + createRouteRenderingComponent('Report_Settings_Room_Name', () => require('../../../pages/settings/Report/RoomNamePage').default), + createRouteRenderingComponent('Report_Settings_Notification_Preferences', () => require('../../../pages/settings/Report/NotificationPreferencePage').default), + createRouteRenderingComponent('Report_Settings_Write_Capability', () => require('../../../pages/settings/Report/WriteCapabilityPage').default), ]); const TaskModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const TaskTitlePage = require('../../../pages/tasks/TaskTitlePage').default; - return TaskTitlePage; - }, - name: 'Task_Title', - }, - { - getComponent: () => { - const TaskDescriptionPage = require('../../../pages/tasks/TaskDescriptionPage').default; - return TaskDescriptionPage; - }, - name: 'Task_Description', - }, - { - getComponent: () => { - const TaskAssigneeSelectorPage = require('../../../pages/tasks/TaskAssigneeSelectorModal').default; - return TaskAssigneeSelectorPage; - }, - name: 'Task_Assignee', - }, + createRouteRenderingComponent('Task_Title', () => require('../../../pages/tasks/TaskTitlePage').default), + createRouteRenderingComponent('Task_Description', () => require('../../../pages/tasks/TaskDescriptionPage').default), + createRouteRenderingComponent('Task_Assignee', () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default), ]); const ReportWelcomeMessageModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const ReportWelcomeMessagePage = require('../../../pages/ReportWelcomeMessagePage').default; - return ReportWelcomeMessagePage; - }, - name: 'Report_WelcomeMessage_Root', - }, + createRouteRenderingComponent('Report_WelcomeMessage_Root', () => require('../../../pages/ReportWelcomeMessagePage').default), ]); const ReportParticipantsModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const ReportParticipantsPage = require('../../../pages/ReportParticipantsPage').default; - return ReportParticipantsPage; - }, - name: 'ReportParticipants_Root', - }, + createRouteRenderingComponent('ReportParticipants_Root', () => require('../../../pages/ReportParticipantsPage').default), ]); -const SearchModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const SearchPage = require('../../../pages/SearchPage').default; - return SearchPage; - }, - name: 'Search_Root', - }, -]); +const SearchModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('Search_Root', () => require('../../../pages/SearchPage').default)]); -const NewChatModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const NewChatSelectorPage = require('../../../pages/NewChatSelectorPage').default; - return NewChatSelectorPage; - }, - name: 'NewChat_Root', - }, -]); +const NewChatModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('NewChat_Root', () => require('../../../pages/NewChatSelectorPage').default)]); const NewTaskModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const NewTaskPage = require('../../../pages/tasks/NewTaskPage').default; - return NewTaskPage; - }, - name: 'NewTask_Root', - }, - { - getComponent: () => { - const NewTaskAssigneeSelectorPage = require('../../../pages/tasks/TaskAssigneeSelectorModal').default; - return NewTaskAssigneeSelectorPage; - }, - name: 'NewTask_TaskAssigneeSelector', - }, - { - getComponent: () => { - const NewTaskTaskShareDestinationPage = require('../../../pages/tasks/TaskShareDestinationSelectorModal').default; - return NewTaskTaskShareDestinationPage; - }, - name: 'NewTask_TaskShareDestinationSelector', - }, - { - getComponent: () => { - const NewTaskDetailsPage = require('../../../pages/tasks/NewTaskDetailsPage').default; - return NewTaskDetailsPage; - }, - name: 'NewTask_Details', - }, - { - getComponent: () => { - const NewTaskTitlePage = require('../../../pages/tasks/NewTaskTitlePage').default; - return NewTaskTitlePage; - }, - name: 'NewTask_Title', - }, - { - getComponent: () => { - const NewTaskDescriptionPage = require('../../../pages/tasks/NewTaskDescriptionPage').default; - return NewTaskDescriptionPage; - }, - name: 'NewTask_Description', - }, + createRouteRenderingComponent('NewTask_Root', () => require('../../../pages/tasks/NewTaskPage').default), + createRouteRenderingComponent('NewTask_TaskAssigneeSelector', () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default), + createRouteRenderingComponent('NewTask_TaskShareDestinationSelector', () => require('../../../pages/tasks/TaskShareDestinationSelectorModal').default), + createRouteRenderingComponent('NewTask_Details', () => require('../../../pages/tasks/NewTaskDetailsPage').default), + createRouteRenderingComponent('NewTask_Title', () => require('../../../pages/tasks/NewTaskTitlePage').default), + createRouteRenderingComponent('NewTask_Description', () => require('../../../pages/tasks/NewTaskDescriptionPage').default), ]); const NewTeachersUniteNavigator = createModalStackNavigator([ - { - getComponent: () => { - const SaveTheWorldPage = require('../../../pages/TeachersUnite/SaveTheWorldPage').default; - return SaveTheWorldPage; - }, - name: SCREENS.SAVE_THE_WORLD.ROOT, - }, - { - getComponent: () => { - const KnowATeacherPage = require('../../../pages/TeachersUnite/KnowATeacherPage').default; - return KnowATeacherPage; - }, - name: 'I_Know_A_Teacher', - }, - { - getComponent: () => { - const IntroSchoolPrincipalPage = require('../../../pages/TeachersUnite/ImTeacherPage').default; - return IntroSchoolPrincipalPage; - }, - name: 'Intro_School_Principal', - }, - { - getComponent: () => { - const ImTeacherPage = require('../../../pages/TeachersUnite/ImTeacherPage').default; - return ImTeacherPage; - }, - name: 'I_Am_A_Teacher', - }, + createRouteRenderingComponent(SCREENS.SAVE_THE_WORLD.ROOT, () => require('../../../pages/TeachersUnite/SaveTheWorldPage').default), + createRouteRenderingComponent('I_Know_A_Teacher', () => require('../../../pages/TeachersUnite/KnowATeacherPage').default), + createRouteRenderingComponent('Intro_School_Principal', () => require('../../../pages/TeachersUnite/ImTeacherPage').default), + createRouteRenderingComponent('I_Am_A_Teacher', () => require('../../../pages/TeachersUnite/ImTeacherPage').default), ]); const SettingsModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const SettingsInitialPage = require('../../../pages/settings/InitialSettingsPage').default; - return SettingsInitialPage; - }, - name: SCREENS.SETTINGS.ROOT, - }, - { - getComponent: () => { - const ShareCodePage = require('../../../pages/ShareCodePage').default; - return ShareCodePage; - }, - name: 'Settings_Share_Code', - }, - { - getComponent: () => { - const SettingsWorkspacesPage = require('../../../pages/workspace/WorkspacesListPage').default; - return SettingsWorkspacesPage; - }, - name: SCREENS.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 SettingsTimezoneInitialPage = require('../../../pages/settings/Profile/TimezoneInitialPage').default; - return SettingsTimezoneInitialPage; - }, - name: 'Settings_Timezone', - }, - { - getComponent: () => { - const SettingsTimezoneSelectPage = require('../../../pages/settings/Profile/TimezoneSelectPage').default; - return SettingsTimezoneSelectPage; - }, - name: 'Settings_Timezone_Select', - }, - { - getComponent: () => { - const SettingsPersonalDetailsInitialPage = require('../../../pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage').default; - return SettingsPersonalDetailsInitialPage; - }, - name: 'Settings_PersonalDetails_Initial', - }, - { - getComponent: () => { - const SettingsLegalNamePage = require('../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default; - return SettingsLegalNamePage; - }, - name: 'Settings_PersonalDetails_LegalName', - }, - { - getComponent: () => { - const SettingsDateOfBirthPage = require('../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default; - return SettingsDateOfBirthPage; - }, - name: 'Settings_PersonalDetails_DateOfBirth', - }, - { - getComponent: () => { - const SettingsAddressPage = require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default; - return SettingsAddressPage; - }, - name: 'Settings_PersonalDetails_Address', - }, - { - getComponent: () => { - const SettingsContactMethodsPage = require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default; - return SettingsContactMethodsPage; - }, - name: 'Settings_ContactMethods', - }, - { - getComponent: () => { - const SettingsContactMethodDetailsPage = require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default; - return SettingsContactMethodDetailsPage; - }, - name: 'Settings_ContactMethodDetails', - }, - { - getComponent: () => { - const SettingsNewContactMethodPage = require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default; - return SettingsNewContactMethodPage; - }, - name: 'Settings_NewContactMethod', - }, - { - getComponent: () => { - const SettingsPreferencesPage = require('../../../pages/settings/Preferences/PreferencesPage').default; - return SettingsPreferencesPage; - }, - name: SCREENS.SETTINGS.PREFERENCES, - }, - { - getComponent: () => { - const SettingsPreferencesPriorityModePage = require('../../../pages/settings/Preferences/PriorityModePage').default; - return SettingsPreferencesPriorityModePage; - }, - name: 'Settings_Preferences_PriorityMode', - }, - { - getComponent: () => { - const SettingsPreferencesLanguagePage = require('../../../pages/settings/Preferences/LanguagePage').default; - return SettingsPreferencesLanguagePage; - }, - name: 'Settings_Preferences_Language', - }, + createRouteRenderingComponent(SCREENS.SETTINGS.ROOT, () => require('../../../pages/settings/InitialSettingsPage').default), + createRouteRenderingComponent('Settings_Share_Code', () => require('../../../pages/ShareCodePage').default), + createRouteRenderingComponent(SCREENS.SETTINGS.WORKSPACES, () => require('../../../pages/workspace/WorkspacesListPage').default), + createRouteRenderingComponent('Settings_Profile', () => require('../../../pages/settings/Profile/ProfilePage').default), + createRouteRenderingComponent('Settings_Pronouns', () => require('../../../pages/settings/Profile/PronounsPage').default), + createRouteRenderingComponent('Settings_Display_Name', () => require('../../../pages/settings/Profile/DisplayNamePage').default), + createRouteRenderingComponent('Settings_Timezone', () => require('../../../pages/settings/Profile/TimezoneInitialPage').default), + createRouteRenderingComponent('Settings_Timezone_Select', () => require('../../../pages/settings/Profile/TimezoneSelectPage').default), + createRouteRenderingComponent('Settings_PersonalDetails_Initial', () => require('../../../pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage').default), + createRouteRenderingComponent('Settings_PersonalDetails_LegalName', () => require('../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default), + createRouteRenderingComponent('Settings_PersonalDetails_DateOfBirth', () => require('../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default), + createRouteRenderingComponent('Settings_PersonalDetails_Address', () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default), + createRouteRenderingComponent('Settings_ContactMethods', () => require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default), + createRouteRenderingComponent('Settings_ContactMethodDetails', () => require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default), + createRouteRenderingComponent('Settings_NewContactMethod', () => require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default), + createRouteRenderingComponent(SCREENS.SETTINGS.PREFERENCES, () => require('../../../pages/settings/Preferences/PreferencesPage').default), + createRouteRenderingComponent('Settings_Preferences_PriorityMode', () => require('../../../pages/settings/Preferences/PriorityModePage').default), + createRouteRenderingComponent('Settings_Preferences_Language', () => require('../../../pages/settings/Preferences/LanguagePage').default), // Will be uncommented as part of https://github.com/Expensify/App/issues/21670 - // { - // getComponent: () => { - // const SettingsPreferencesThemePage = require('../../../pages/settings/Preferences/ThemePage').default; - // return SettingsPreferencesThemePage; - // }, - // name: 'Settings_Preferences_Theme', - // }, - { - 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: SCREENS.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 SettingsLoungeAccessPage = require('../../../pages/settings/Profile/LoungeAccessPage').default; - return SettingsLoungeAccessPage; - }, - name: 'Settings_Lounge_Access', - }, - { - getComponent: () => { - const SettingsWalletPage = require('../../../pages/settings/Wallet/WalletPage').default; - return SettingsWalletPage; - }, - name: 'Settings_Wallet', - }, - { - getComponent: () => { - const TransferBalancePage = require('../../../pages/settings/Wallet/TransferBalancePage').default; - return TransferBalancePage; - }, - name: 'Settings_Wallet_Transfer_Balance', - }, - { - getComponent: () => { - const ChooseTransferAccountPage = require('../../../pages/settings/Wallet/ChooseTransferAccountPage').default; - return ChooseTransferAccountPage; - }, - name: 'Settings_Wallet_Choose_Transfer_Account', - }, - { - getComponent: () => { - const EnablePaymentsPage = require('../../../pages/EnablePayments/EnablePaymentsPage').default; - return EnablePaymentsPage; - }, - name: 'Settings_Wallet_EnablePayments', - }, - { - getComponent: () => { - const AddDebitCardPage = require('../../../pages/settings/Wallet/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 SettingsStatus = require('../../../pages/settings/Profile/CustomStatus/StatusPage').default; - return SettingsStatus; - }, - name: SCREENS.SETTINGS.STATUS, - }, - { - getComponent: () => { - const SettingsStatusSet = require('../../../pages/settings/Profile/CustomStatus/StatusSetPage').default; - return SettingsStatusSet; - }, - name: 'Settings_Status_Set', - }, - { - 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 WorkspaceRateAndUnitPage = require('../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage').default; - return WorkspaceRateAndUnitPage; - }, - name: 'Workspace_RateAndUnit', - }, - { - 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 WorkspaceInviteMessagePage = require('../../../pages/workspace/WorkspaceInviteMessagePage').default; - return WorkspaceInviteMessagePage; - }, - name: 'Workspace_Invite_Message', - }, - { - getComponent: () => { - const ReimbursementAccountPage = require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default; - return ReimbursementAccountPage; - }, - name: 'ReimbursementAccount', - initialParams: {stepToOpen: ''}, - }, - { - getComponent: () => { - const GetAssistancePage = require('../../../pages/GetAssistancePage').default; - return GetAssistancePage; - }, - name: 'GetAssistance', - }, - { - getComponent: () => { - const SettingsTwoFactorAuth = require('../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default; - return SettingsTwoFactorAuth; - }, - name: 'Settings_TwoFactorAuth', - }, + createRouteRenderingComponent('Settings_Preferences_Theme', () => require('../../../pages/settings/Preferences/ThemePage').default), + createRouteRenderingComponent('Settings_Close', () => require('../../../pages/settings/Security/CloseAccountPage').default), + createRouteRenderingComponent(SCREENS.SETTINGS.SECURITY, () => require('../../../pages/settings/Security/SecuritySettingsPage').default), + createRouteRenderingComponent('Settings_About', () => require('../../../pages/settings/AboutPage/AboutPage').default), + createRouteRenderingComponent('Settings_App_Download_Links', () => require('../../../pages/settings/AppDownloadLinks').default), + createRouteRenderingComponent('Settings_Lounge_Access', () => require('../../../pages/settings/Profile/LoungeAccessPage').default), + createRouteRenderingComponent('Settings_Wallet', () => require('../../../pages/settings/Wallet/WalletPage').default), + createRouteRenderingComponent('Settings_Wallet_Transfer_Balance', () => require('../../../pages/settings/Wallet/TransferBalancePage').default), + createRouteRenderingComponent('Settings_Wallet_Choose_Transfer_Account', () => require('../../../pages/settings/Wallet/ChooseTransferAccountPage').default), + createRouteRenderingComponent('Settings_Wallet_EnablePayments', () => require('../../../pages/EnablePayments/EnablePaymentsPage').default), + createRouteRenderingComponent('Settings_Add_Debit_Card', () => require('../../../pages/settings/Wallet/AddDebitCardPage').default), + createRouteRenderingComponent('Settings_Add_Bank_Account', () => require('../../../pages/AddPersonalBankAccountPage').default), + createRouteRenderingComponent(SCREENS.SETTINGS.STATUS, () => require('../../../pages/settings/Profile/CustomStatus/StatusPage').default), + createRouteRenderingComponent('Settings_Status_Set', () => require('../../../pages/settings/Profile/CustomStatus/StatusSetPage').default), + createRouteRenderingComponent('Workspace_Initial', () => require('../../../pages/workspace/WorkspaceInitialPage').default), + createRouteRenderingComponent('Workspace_Settings', () => require('../../../pages/workspace/WorkspaceSettingsPage').default), + createRouteRenderingComponent('Workspace_Card', () => require('../../../pages/workspace/card/WorkspaceCardPage').default), + createRouteRenderingComponent('Workspace_Reimburse', () => require('../../../pages/workspace/reimburse/WorkspaceReimbursePage').default), + createRouteRenderingComponent('Workspace_RateAndUnit', () => require('../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage').default), + createRouteRenderingComponent('Workspace_Bills', () => require('../../../pages/workspace/bills/WorkspaceBillsPage').default), + createRouteRenderingComponent('Workspace_Invoices', () => require('../../../pages/workspace/invoices/WorkspaceInvoicesPage').default), + createRouteRenderingComponent('Workspace_Travel', () => require('../../../pages/workspace/travel/WorkspaceTravelPage').default), + createRouteRenderingComponent('Workspace_Members', () => require('../../../pages/workspace/WorkspaceMembersPage').default), + createRouteRenderingComponent('Workspace_Invite', () => require('../../../pages/workspace/WorkspaceInvitePage').default), + createRouteRenderingComponent('Workspace_Invite_Message', () => require('../../../pages/workspace/WorkspaceInviteMessagePage').default), + createRouteRenderingComponent('ReimbursementAccount', () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default), + createRouteRenderingComponent('GetAssistance', () => require('../../../pages/GetAssistancePage').default), + createRouteRenderingComponent('Settings_TwoFactorAuth', () => require('../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default), ]); const EnablePaymentsStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const EnablePaymentsPage = require('../../../pages/EnablePayments/EnablePaymentsPage').default; - return EnablePaymentsPage; - }, - name: 'EnablePayments_Root', - }, + createRouteRenderingComponent('EnablePayments_Root', () => require('../../../pages/EnablePayments/EnablePaymentsPage').default), ]); const AddPersonalBankAccountModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const AddPersonalBankAccountPage = require('../../../pages/AddPersonalBankAccountPage').default; - return AddPersonalBankAccountPage; - }, - name: 'AddPersonalBankAccount_Root', - }, + createRouteRenderingComponent('AddPersonalBankAccount_Root', () => require('../../../pages/AddPersonalBankAccountPage').default), ]); const ReimbursementAccountModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const ReimbursementAccountPage = require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default; - return ReimbursementAccountPage; - }, - name: 'ReimbursementAccount_Root', - }, + createRouteRenderingComponent('ReimbursementAccount_Root', () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default), ]); -const WalletStatementStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const WalletStatementPage = require('../../../pages/wallet/WalletStatementPage').default; - return WalletStatementPage; - }, - name: 'WalletStatement_Root', - }, -]); +const WalletStatementStackNavigator = createModalStackNavigator([createRouteRenderingComponent('WalletStatement_Root', () => require('../../../pages/wallet/WalletStatementPage').default)]); -const FlagCommentStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const FlagCommentPage = require('../../../pages/FlagCommentPage').default; - return FlagCommentPage; - }, - name: 'FlagComment_Root', - }, -]); +const FlagCommentStackNavigator = createModalStackNavigator([createRouteRenderingComponent('FlagComment_Root', () => require('../../../pages/FlagCommentPage').default)]); const EditRequestStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const EditRequestPage = require('../../../pages/EditRequestPage').default; - return EditRequestPage; - }, - name: 'EditRequest_Root', - }, - { - getComponent: () => { - const IOUCurrencySelection = require('../../../pages/iou/IOUCurrencySelection').default; - return IOUCurrencySelection; - }, - name: 'EditRequest_Currency', - }, + createRouteRenderingComponent('EditRequest_Root', () => require('../../../pages/EditRequestPage').default), + createRouteRenderingComponent('EditRequest_Currency', () => require('../../../pages/iou/IOUCurrencySelection').default), ]); const PrivateNotesModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const PrivateNotesPage = require('../../../pages/PrivateNotes/PrivateNotesViewPage').default; - return PrivateNotesPage; - }, - name: 'PrivateNotes_View', - }, - { - getComponent: () => { - const PrivateNotesListPage = require('../../../pages/PrivateNotes/PrivateNotesListPage').default; - return PrivateNotesListPage; - }, - name: 'PrivateNotes_List', - }, - { - getComponent: () => { - const PrivateNotesEditPage = require('../../../pages/PrivateNotes/PrivateNotesEditPage').default; - return PrivateNotesEditPage; - }, - name: 'PrivateNotes_Edit', - }, + createRouteRenderingComponent('PrivateNotes_View', () => require('../../../pages/PrivateNotes/PrivateNotesViewPage').default), + createRouteRenderingComponent('PrivateNotes_List', () => require('../../../pages/PrivateNotes/PrivateNotesListPage').default), + createRouteRenderingComponent('PrivateNotes_Edit', () => require('../../../pages/PrivateNotes/PrivateNotesEditPage').default), ]); -const SignInModalStackNavigator = createModalStackNavigator([ - { - getComponent: () => { - const SignInModal = require('../../../pages/signin/SignInModal').default; - return SignInModal; - }, - name: 'SignIn_Root', - }, -]); +const SignInModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('SignIn_Root', () => require('../../../pages/signin/SignInModal').default)]); export { MoneyRequestModalStackNavigator, diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js index e24e12c639bd..027c62cfe980 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js @@ -206,7 +206,7 @@ class ReimbursementAccountPage extends React.Component { * @returns {String} */ getStepToOpenFromRouteParams() { - switch (lodashGet(this.props.route, ['params', 'stepToOpen'])) { + switch (lodashGet(this.props.route, ['params', 'stepToOpen'], '')) { case 'new': return CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT; case 'company': From dda8f2314485634c7017693828c5c2fb873c16ea Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Fri, 22 Sep 2023 20:58:49 +0800 Subject: [PATCH 2/4] Use object notation --- .../AppNavigator/ModalStackNavigators.js | 332 +++++++++--------- 1 file changed, 167 insertions(+), 165 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index 09efc3b230c8..529cc6e1b4b7 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -12,7 +12,7 @@ const defaultSubRouteOptions = { /** * Create a modal stack navigator with an array of sub-screens. - * + *] * @param {Object[]} screens array of screen config objects * @returns {Function} */ @@ -20,180 +20,182 @@ function createModalStackNavigator(screens) { const ModalStackNavigator = createStackNavigator(); return () => ( - {_.map(screens, (screen) => ( + {_.map(screens, (getComponent, name) => ( ))} ); } -/** - * Returns an object used by the stack navigator to link a route to a rendering component - * - * @param {String} name of the screen in linkingConfig - * @param {Function} getComponent returns a component that is require()'d - * @returns {Object} - */ -const createRouteRenderingComponent = (name, getComponent) => ({ - // require() syntax is used here so that the file used by a screen are loaded only when the route is accessed - getComponent, - name, +// We use getComponent/require syntax so that file used by screens are not loaded until we need them. +const MoneyRequestModalStackNavigator = createModalStackNavigator({ + Money_Request: () => require('../../../pages/iou/MoneyRequestSelectorPage').default, + Money_Request_Amount: () => require('../../../pages/iou/steps/NewRequestAmountPage').default, + Money_Request_Participants: () => require('../../../pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage').default, + Money_Request_Confirmation: () => require('../../../pages/iou/steps/MoneyRequestConfirmPage').default, + Money_Request_Currency: () => require('../../../pages/iou/IOUCurrencySelection').default, + Money_Request_Date: () => require('../../../pages/iou/MoneyRequestDatePage').default, + Money_Request_Description: () => require('../../../pages/iou/MoneyRequestDescriptionPage').default, + Money_Request_Category: () => require('../../../pages/iou/MoneyRequestCategoryPage').default, + Money_Request_Tag: () => require('../../../pages/iou/MoneyRequestTagPage').default, + Money_Request_Merchant: () => require('../../../pages/iou/MoneyRequestMerchantPage').default, + IOU_Send_Add_Bank_Account: () => require('../../../pages/AddPersonalBankAccountPage').default, + IOU_Send_Add_Debit_Card: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default, + IOU_Send_Enable_Payments: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, + Money_Request_Waypoint: () => require('../../../pages/iou/WaypointEditorPage').default, + Money_Request_Address: () => require('../../../pages/iou/DistanceRequestPage').default, }); -// We use getComponent/require syntax so that file used by screens are not loaded until we need them. -const MoneyRequestModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('Money_Request', () => require('../../../pages/iou/MoneyRequestSelectorPage').default), - createRouteRenderingComponent('Money_Request_Amount', () => require('../../../pages/iou/steps/NewRequestAmountPage').default), - createRouteRenderingComponent('Money_Request_Participants', () => require('../../../pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage').default), - createRouteRenderingComponent('Money_Request_Confirmation', () => require('../../../pages/iou/steps/MoneyRequestConfirmPage').default), - createRouteRenderingComponent('Money_Request_Currency', () => require('../../../pages/iou/IOUCurrencySelection').default), - createRouteRenderingComponent('Money_Request_Date', () => require('../../../pages/iou/MoneyRequestDatePage').default), - createRouteRenderingComponent('Money_Request_Description', () => require('../../../pages/iou/MoneyRequestDescriptionPage').default), - createRouteRenderingComponent('Money_Request_Category', () => require('../../../pages/iou/MoneyRequestCategoryPage').default), - createRouteRenderingComponent('Money_Request_Tag', () => require('../../../pages/iou/MoneyRequestTagPage').default), - createRouteRenderingComponent('Money_Request_Merchant', () => require('../../../pages/iou/MoneyRequestMerchantPage').default), - createRouteRenderingComponent('IOU_Send_Add_Bank_Account', () => require('../../../pages/AddPersonalBankAccountPage').default), - createRouteRenderingComponent('IOU_Send_Add_Debit_Card', () => require('../../../pages/settings/Wallet/AddDebitCardPage').default), - createRouteRenderingComponent('IOU_Send_Enable_Payments', () => require('../../../pages/EnablePayments/EnablePaymentsPage').default), - createRouteRenderingComponent('Money_Request_Waypoint', () => require('../../../pages/iou/WaypointEditorPage').default), - createRouteRenderingComponent('Money_Request_Address', () => require('../../../pages/iou/DistanceRequestPage').default), -]); - -const SplitDetailsModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('SplitDetails_Root', () => require('../../../pages/iou/SplitBillDetailsPage').default)]); - -const DetailsModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('Details_Root', () => require('../../../pages/DetailsPage').default)]); - -const ProfileModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('Profile_Root', () => require('../../../pages/ProfilePage').default)]); - -const ReportDetailsModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('Report_Details_Root', () => require('../../../pages/ReportDetailsPage').default), - createRouteRenderingComponent('Report_Details_Share_Code', () => require('../../../pages/home/report/ReportDetailsShareCodePage').default), -]); - -const ReportSettingsModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('Report_Settings_Root', () => require('../../../pages/settings/Report/ReportSettingsPage').default), - createRouteRenderingComponent('Report_Settings_Room_Name', () => require('../../../pages/settings/Report/RoomNamePage').default), - createRouteRenderingComponent('Report_Settings_Notification_Preferences', () => require('../../../pages/settings/Report/NotificationPreferencePage').default), - createRouteRenderingComponent('Report_Settings_Write_Capability', () => require('../../../pages/settings/Report/WriteCapabilityPage').default), -]); - -const TaskModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('Task_Title', () => require('../../../pages/tasks/TaskTitlePage').default), - createRouteRenderingComponent('Task_Description', () => require('../../../pages/tasks/TaskDescriptionPage').default), - createRouteRenderingComponent('Task_Assignee', () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default), -]); - -const ReportWelcomeMessageModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('Report_WelcomeMessage_Root', () => require('../../../pages/ReportWelcomeMessagePage').default), -]); - -const ReportParticipantsModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('ReportParticipants_Root', () => require('../../../pages/ReportParticipantsPage').default), -]); - -const SearchModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('Search_Root', () => require('../../../pages/SearchPage').default)]); - -const NewChatModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('NewChat_Root', () => require('../../../pages/NewChatSelectorPage').default)]); - -const NewTaskModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('NewTask_Root', () => require('../../../pages/tasks/NewTaskPage').default), - createRouteRenderingComponent('NewTask_TaskAssigneeSelector', () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default), - createRouteRenderingComponent('NewTask_TaskShareDestinationSelector', () => require('../../../pages/tasks/TaskShareDestinationSelectorModal').default), - createRouteRenderingComponent('NewTask_Details', () => require('../../../pages/tasks/NewTaskDetailsPage').default), - createRouteRenderingComponent('NewTask_Title', () => require('../../../pages/tasks/NewTaskTitlePage').default), - createRouteRenderingComponent('NewTask_Description', () => require('../../../pages/tasks/NewTaskDescriptionPage').default), -]); - -const NewTeachersUniteNavigator = createModalStackNavigator([ - createRouteRenderingComponent(SCREENS.SAVE_THE_WORLD.ROOT, () => require('../../../pages/TeachersUnite/SaveTheWorldPage').default), - createRouteRenderingComponent('I_Know_A_Teacher', () => require('../../../pages/TeachersUnite/KnowATeacherPage').default), - createRouteRenderingComponent('Intro_School_Principal', () => require('../../../pages/TeachersUnite/ImTeacherPage').default), - createRouteRenderingComponent('I_Am_A_Teacher', () => require('../../../pages/TeachersUnite/ImTeacherPage').default), -]); - -const SettingsModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent(SCREENS.SETTINGS.ROOT, () => require('../../../pages/settings/InitialSettingsPage').default), - createRouteRenderingComponent('Settings_Share_Code', () => require('../../../pages/ShareCodePage').default), - createRouteRenderingComponent(SCREENS.SETTINGS.WORKSPACES, () => require('../../../pages/workspace/WorkspacesListPage').default), - createRouteRenderingComponent('Settings_Profile', () => require('../../../pages/settings/Profile/ProfilePage').default), - createRouteRenderingComponent('Settings_Pronouns', () => require('../../../pages/settings/Profile/PronounsPage').default), - createRouteRenderingComponent('Settings_Display_Name', () => require('../../../pages/settings/Profile/DisplayNamePage').default), - createRouteRenderingComponent('Settings_Timezone', () => require('../../../pages/settings/Profile/TimezoneInitialPage').default), - createRouteRenderingComponent('Settings_Timezone_Select', () => require('../../../pages/settings/Profile/TimezoneSelectPage').default), - createRouteRenderingComponent('Settings_PersonalDetails_Initial', () => require('../../../pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage').default), - createRouteRenderingComponent('Settings_PersonalDetails_LegalName', () => require('../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default), - createRouteRenderingComponent('Settings_PersonalDetails_DateOfBirth', () => require('../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default), - createRouteRenderingComponent('Settings_PersonalDetails_Address', () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default), - createRouteRenderingComponent('Settings_ContactMethods', () => require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default), - createRouteRenderingComponent('Settings_ContactMethodDetails', () => require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default), - createRouteRenderingComponent('Settings_NewContactMethod', () => require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default), - createRouteRenderingComponent(SCREENS.SETTINGS.PREFERENCES, () => require('../../../pages/settings/Preferences/PreferencesPage').default), - createRouteRenderingComponent('Settings_Preferences_PriorityMode', () => require('../../../pages/settings/Preferences/PriorityModePage').default), - createRouteRenderingComponent('Settings_Preferences_Language', () => require('../../../pages/settings/Preferences/LanguagePage').default), +const SplitDetailsModalStackNavigator = createModalStackNavigator({ + SplitDetails_Root: () => require('../../../pages/iou/SplitBillDetailsPage').default, +}); + +const DetailsModalStackNavigator = createModalStackNavigator({ + Details_Root: () => require('../../../pages/DetailsPage').default, +}); + +const ProfileModalStackNavigator = createModalStackNavigator({ + Profile_Root: () => require('../../../pages/ProfilePage').default, +}); + +const ReportDetailsModalStackNavigator = createModalStackNavigator({ + Report_Details_Root: () => require('../../../pages/ReportDetailsPage').default, + Report_Details_Share_Code: () => require('../../../pages/home/report/ReportDetailsShareCodePage').default, +}); + +const ReportSettingsModalStackNavigator = createModalStackNavigator({ + Report_Settings_Root: () => require('../../../pages/settings/Report/ReportSettingsPage').default, + Report_Settings_Room_Name: () => require('../../../pages/settings/Report/RoomNamePage').default, + Report_Settings_Notification_Preferences: () => require('../../../pages/settings/Report/NotificationPreferencePage').default, + Report_Settings_Write_Capability: () => require('../../../pages/settings/Report/WriteCapabilityPage').default, +}); + +const TaskModalStackNavigator = createModalStackNavigator({ + Task_Title: () => require('../../../pages/tasks/TaskTitlePage').default, + Task_Description: () => require('../../../pages/tasks/TaskDescriptionPage').default, + Task_Assignee: () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default, +}); + +const ReportWelcomeMessageModalStackNavigator = createModalStackNavigator({ + Report_WelcomeMessage_Root: () => require('../../../pages/ReportWelcomeMessagePage').default, +}); + +const ReportParticipantsModalStackNavigator = createModalStackNavigator({ + ReportParticipants_Root: () => require('../../../pages/ReportParticipantsPage').default, +}); + +const SearchModalStackNavigator = createModalStackNavigator({ + Search_Root: () => require('../../../pages/SearchPage').default, +}); + +const NewChatModalStackNavigator = createModalStackNavigator({ + NewChat_Root: () => require('../../../pages/NewChatSelectorPage').default, +}); + +const NewTaskModalStackNavigator = createModalStackNavigator({ + NewTask_Root: () => require('../../../pages/tasks/NewTaskPage').default, + NewTask_TaskAssigneeSelector: () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default, + NewTask_TaskShareDestinationSelector: () => require('../../../pages/tasks/TaskShareDestinationSelectorModal').default, + NewTask_Details: () => require('../../../pages/tasks/NewTaskDetailsPage').default, + NewTask_Title: () => require('../../../pages/tasks/NewTaskTitlePage').default, + NewTask_Description: () => require('../../../pages/tasks/NewTaskDescriptionPage').default, +}); + +const NewTeachersUniteNavigator = createModalStackNavigator({ + [SCREENS.SAVE_THE_WORLD.ROOT]: () => require('../../../pages/TeachersUnite/SaveTheWorldPage').default, + I_Know_A_Teacher: () => require('../../../pages/TeachersUnite/KnowATeacherPage').default, + Intro_School_Principal: () => require('../../../pages/TeachersUnite/ImTeacherPage').default, + I_Am_A_Teacher: () => require('../../../pages/TeachersUnite/ImTeacherPage').default, +}); + +const SettingsModalStackNavigator = createModalStackNavigator({ + [SCREENS.SETTINGS.ROOT]: () => require('../../../pages/settings/InitialSettingsPage').default, + Settings_Share_Code: () => require('../../../pages/ShareCodePage').default, + [SCREENS.SETTINGS.WORKSPACES]: () => require('../../../pages/workspace/WorkspacesListPage').default, + Settings_Profile: () => require('../../../pages/settings/Profile/ProfilePage').default, + Settings_Pronouns: () => require('../../../pages/settings/Profile/PronounsPage').default, + Settings_Display_Name: () => require('../../../pages/settings/Profile/DisplayNamePage').default, + Settings_Timezone: () => require('../../../pages/settings/Profile/TimezoneInitialPage').default, + Settings_Timezone_Select: () => require('../../../pages/settings/Profile/TimezoneSelectPage').default, + Settings_PersonalDetails_Initial: () => require('../../../pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage').default, + Settings_PersonalDetails_LegalName: () => require('../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default, + Settings_PersonalDetails_DateOfBirth: () => require('../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default, + Settings_PersonalDetails_Address: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + Settings_ContactMethods: () => require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default, + Settings_ContactMethodDetails: () => require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default, + Settings_NewContactMethod: () => require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default, + [SCREENS.SETTINGS.PREFERENCES]: () => require('../../../pages/settings/Preferences/PreferencesPage').default, + Settings_Preferences_PriorityMode: () => require('../../../pages/settings/Preferences/PriorityModePage').default, + Settings_Preferences_Language: () => require('../../../pages/settings/Preferences/LanguagePage').default, // Will be uncommented as part of https://github.com/Expensify/App/issues/21670 - createRouteRenderingComponent('Settings_Preferences_Theme', () => require('../../../pages/settings/Preferences/ThemePage').default), - createRouteRenderingComponent('Settings_Close', () => require('../../../pages/settings/Security/CloseAccountPage').default), - createRouteRenderingComponent(SCREENS.SETTINGS.SECURITY, () => require('../../../pages/settings/Security/SecuritySettingsPage').default), - createRouteRenderingComponent('Settings_About', () => require('../../../pages/settings/AboutPage/AboutPage').default), - createRouteRenderingComponent('Settings_App_Download_Links', () => require('../../../pages/settings/AppDownloadLinks').default), - createRouteRenderingComponent('Settings_Lounge_Access', () => require('../../../pages/settings/Profile/LoungeAccessPage').default), - createRouteRenderingComponent('Settings_Wallet', () => require('../../../pages/settings/Wallet/WalletPage').default), - createRouteRenderingComponent('Settings_Wallet_Transfer_Balance', () => require('../../../pages/settings/Wallet/TransferBalancePage').default), - createRouteRenderingComponent('Settings_Wallet_Choose_Transfer_Account', () => require('../../../pages/settings/Wallet/ChooseTransferAccountPage').default), - createRouteRenderingComponent('Settings_Wallet_EnablePayments', () => require('../../../pages/EnablePayments/EnablePaymentsPage').default), - createRouteRenderingComponent('Settings_Add_Debit_Card', () => require('../../../pages/settings/Wallet/AddDebitCardPage').default), - createRouteRenderingComponent('Settings_Add_Bank_Account', () => require('../../../pages/AddPersonalBankAccountPage').default), - createRouteRenderingComponent(SCREENS.SETTINGS.STATUS, () => require('../../../pages/settings/Profile/CustomStatus/StatusPage').default), - createRouteRenderingComponent('Settings_Status_Set', () => require('../../../pages/settings/Profile/CustomStatus/StatusSetPage').default), - createRouteRenderingComponent('Workspace_Initial', () => require('../../../pages/workspace/WorkspaceInitialPage').default), - createRouteRenderingComponent('Workspace_Settings', () => require('../../../pages/workspace/WorkspaceSettingsPage').default), - createRouteRenderingComponent('Workspace_Card', () => require('../../../pages/workspace/card/WorkspaceCardPage').default), - createRouteRenderingComponent('Workspace_Reimburse', () => require('../../../pages/workspace/reimburse/WorkspaceReimbursePage').default), - createRouteRenderingComponent('Workspace_RateAndUnit', () => require('../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage').default), - createRouteRenderingComponent('Workspace_Bills', () => require('../../../pages/workspace/bills/WorkspaceBillsPage').default), - createRouteRenderingComponent('Workspace_Invoices', () => require('../../../pages/workspace/invoices/WorkspaceInvoicesPage').default), - createRouteRenderingComponent('Workspace_Travel', () => require('../../../pages/workspace/travel/WorkspaceTravelPage').default), - createRouteRenderingComponent('Workspace_Members', () => require('../../../pages/workspace/WorkspaceMembersPage').default), - createRouteRenderingComponent('Workspace_Invite', () => require('../../../pages/workspace/WorkspaceInvitePage').default), - createRouteRenderingComponent('Workspace_Invite_Message', () => require('../../../pages/workspace/WorkspaceInviteMessagePage').default), - createRouteRenderingComponent('ReimbursementAccount', () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default), - createRouteRenderingComponent('GetAssistance', () => require('../../../pages/GetAssistancePage').default), - createRouteRenderingComponent('Settings_TwoFactorAuth', () => require('../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default), -]); - -const EnablePaymentsStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('EnablePayments_Root', () => require('../../../pages/EnablePayments/EnablePaymentsPage').default), -]); - -const AddPersonalBankAccountModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('AddPersonalBankAccount_Root', () => require('../../../pages/AddPersonalBankAccountPage').default), -]); - -const ReimbursementAccountModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('ReimbursementAccount_Root', () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default), -]); - -const WalletStatementStackNavigator = createModalStackNavigator([createRouteRenderingComponent('WalletStatement_Root', () => require('../../../pages/wallet/WalletStatementPage').default)]); - -const FlagCommentStackNavigator = createModalStackNavigator([createRouteRenderingComponent('FlagComment_Root', () => require('../../../pages/FlagCommentPage').default)]); - -const EditRequestStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('EditRequest_Root', () => require('../../../pages/EditRequestPage').default), - createRouteRenderingComponent('EditRequest_Currency', () => require('../../../pages/iou/IOUCurrencySelection').default), -]); - -const PrivateNotesModalStackNavigator = createModalStackNavigator([ - createRouteRenderingComponent('PrivateNotes_View', () => require('../../../pages/PrivateNotes/PrivateNotesViewPage').default), - createRouteRenderingComponent('PrivateNotes_List', () => require('../../../pages/PrivateNotes/PrivateNotesListPage').default), - createRouteRenderingComponent('PrivateNotes_Edit', () => require('../../../pages/PrivateNotes/PrivateNotesEditPage').default), -]); - -const SignInModalStackNavigator = createModalStackNavigator([createRouteRenderingComponent('SignIn_Root', () => require('../../../pages/signin/SignInModal').default)]); + // Settings_Preferences_Theme: () => require('../../../pages/settings/Preferences/ThemePage').default, + Settings_Close: () => require('../../../pages/settings/Security/CloseAccountPage').default, + [SCREENS.SETTINGS.SECURITY]: () => require('../../../pages/settings/Security/SecuritySettingsPage').default, + Settings_About: () => require('../../../pages/settings/AboutPage/AboutPage').default, + Settings_App_Download_Links: () => require('../../../pages/settings/AppDownloadLinks').default, + Settings_Lounge_Access: () => require('../../../pages/settings/Profile/LoungeAccessPage').default, + Settings_Wallet: () => require('../../../pages/settings/Wallet/WalletPage').default, + Settings_Wallet_Transfer_Balance: () => require('../../../pages/settings/Wallet/TransferBalancePage').default, + Settings_Wallet_Choose_Transfer_Account: () => require('../../../pages/settings/Wallet/ChooseTransferAccountPage').default, + Settings_Wallet_EnablePayments: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, + Settings_Add_Debit_Card: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default, + Settings_Add_Bank_Account: () => require('../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.SETTINGS.STATUS]: () => require('../../../pages/settings/Profile/CustomStatus/StatusPage').default, + Settings_Status_Set: () => require('../../../pages/settings/Profile/CustomStatus/StatusSetPage').default, + Workspace_Initial: () => require('../../../pages/workspace/WorkspaceInitialPage').default, + Workspace_Settings: () => require('../../../pages/workspace/WorkspaceSettingsPage').default, + Workspace_Card: () => require('../../../pages/workspace/card/WorkspaceCardPage').default, + Workspace_Reimburse: () => require('../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, + Workspace_RateAndUnit: () => require('../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage').default, + Workspace_Bills: () => require('../../../pages/workspace/bills/WorkspaceBillsPage').default, + Workspace_Invoices: () => require('../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, + Workspace_Travel: () => require('../../../pages/workspace/travel/WorkspaceTravelPage').default, + Workspace_Members: () => require('../../../pages/workspace/WorkspaceMembersPage').default, + Workspace_Invite: () => require('../../../pages/workspace/WorkspaceInvitePage').default, + Workspace_Invite_Message: () => require('../../../pages/workspace/WorkspaceInviteMessagePage').default, + ReimbursementAccount: () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, + GetAssistance: () => require('../../../pages/GetAssistancePage').default, + Settings_TwoFactorAuth: () => require('../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, +}); + +const EnablePaymentsStackNavigator = createModalStackNavigator({ + EnablePayments_Root: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, +}); + +const AddPersonalBankAccountModalStackNavigator = createModalStackNavigator({ + AddPersonalBankAccount_Root: () => require('../../../pages/AddPersonalBankAccountPage').default, +}); + +const ReimbursementAccountModalStackNavigator = createModalStackNavigator({ + ReimbursementAccount_Root: () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, +}); + +const WalletStatementStackNavigator = createModalStackNavigator({ + WalletStatement_Root: () => require('../../../pages/wallet/WalletStatementPage').default, +}); + +const FlagCommentStackNavigator = createModalStackNavigator({ + FlagComment_Root: () => require('../../../pages/FlagCommentPage').default, +}); + +const EditRequestStackNavigator = createModalStackNavigator({ + EditRequest_Root: () => require('../../../pages/EditRequestPage').default, + EditRequest_Currency: () => require('../../../pages/iou/IOUCurrencySelection').default, +}); + +const PrivateNotesModalStackNavigator = createModalStackNavigator({ + PrivateNotes_View: () => require('../../../pages/PrivateNotes/PrivateNotesViewPage').default, + PrivateNotes_List: () => require('../../../pages/PrivateNotes/PrivateNotesListPage').default, + PrivateNotes_Edit: () => require('../../../pages/PrivateNotes/PrivateNotesEditPage').default, +}); + +const SignInModalStackNavigator = createModalStackNavigator({ + SignIn_Root: () => require('../../../pages/signin/SignInModal').default, +}); export { MoneyRequestModalStackNavigator, From b559812590cbd45bca7f09ebf1ae4a08c6ce0fca Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Fri, 22 Sep 2023 21:14:09 +0800 Subject: [PATCH 3/4] Remove extra character --- src/libs/Navigation/AppNavigator/ModalStackNavigators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index 529cc6e1b4b7..92467e4f78ff 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -12,7 +12,7 @@ const defaultSubRouteOptions = { /** * Create a modal stack navigator with an array of sub-screens. - *] + * * @param {Object[]} screens array of screen config objects * @returns {Function} */ From 925b003e6a7db6925eacc0f1000b023dab3fb22b Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Fri, 22 Sep 2023 21:15:31 +0800 Subject: [PATCH 4/4] Correct comment --- src/libs/Navigation/AppNavigator/ModalStackNavigators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index 92467e4f78ff..5a622852e2ef 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -13,7 +13,7 @@ const defaultSubRouteOptions = { /** * Create a modal stack navigator with an array of sub-screens. * - * @param {Object[]} screens array of screen config objects + * @param {Object} screens key/value pairs where the key is the name of the screen and the value is a functon that returns the lazy-loaded component * @returns {Function} */ function createModalStackNavigator(screens) {