From 1408a2d316f6f8bd4381eb55719a7a20acaa5bfe Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 11 Oct 2024 10:38:50 +0200 Subject: [PATCH 001/145] feat: native-stack (initial changes) --- .../MoneyRequestPreviewContent.tsx | 4 +- src/components/ScreenWrapper.tsx | 6 +- .../ScrollOffsetContextProvider.tsx | 9 +- src/components/Search/index.tsx | 4 +- .../withNavigationTransitionEnd.tsx | 4 +- .../Navigation/AppNavigator/AuthScreens.tsx | 51 +++--- .../ModalNavigatorScreenOptions.ts | 19 --- .../ModalStackNavigators/index.tsx | 9 +- .../useModalScreenOptions.ts | 30 ++-- .../Navigators/BottomTabNavigator.tsx | 5 +- .../Navigators/ExplanationModalNavigator.tsx | 7 +- .../FeatureTrainingModalNavigator.tsx | 7 +- .../Navigators/FullScreenNavigator.tsx | 10 +- .../Navigators/LeftModalNavigator.tsx | 14 +- .../Navigators/OnboardingModalNavigator.tsx | 4 +- .../Navigators/Overlay/index.native.tsx | 14 +- .../Navigators/RightModalNavigator.tsx | 34 ++-- .../Navigators/WelcomeVideoModalNavigator.tsx | 6 +- .../OnboardingModalNavigatorScreenOptions.ts | 9 +- .../Navigation/AppNavigator/PublicScreens.tsx | 13 +- .../BottomTabNavigationContentWrapper.tsx | 22 +++ .../createCustomBottomTabNavigator/index.tsx | 88 +++------- .../useCustomState/index.ts | 20 +++ .../CustomFullScreenRouter.tsx | 13 +- .../index.native.tsx | 36 ---- .../createCustomFullScreenNavigator/index.tsx | 59 ++----- .../createCustomFullScreenNavigator/types.ts | 8 - .../CustomRouter.ts | 144 ---------------- .../createCustomStackNavigator/index.tsx | 122 -------------- .../createCustomStackNavigator/types.ts | 13 -- .../createModalCardStyleInterpolator.ts | 49 ------ .../AppNavigator/defaultScreenOptions.ts | 14 +- .../getRootNavigatorScreenOptions.ts | 141 ---------------- .../useModalCardStyleInterpolator.ts | 66 ++++++++ .../AppNavigator/useModalNavigatorOptions.ts | 35 ++++ .../AppNavigator/useRootNavigatorOptions.ts | 155 ++++++++++++++++++ .../index.android.ts | 4 +- src/libs/Navigation/types.ts | 26 ++- src/pages/ConciergePage.tsx | 4 +- .../Debug/DebugDetailsConstantPickerPage.tsx | 4 +- .../Debug/DebugDetailsDateTimePickerPage.tsx | 4 +- src/pages/Debug/Report/DebugReportPage.tsx | 4 +- .../DebugReportActionCreatePage.tsx | 4 +- .../ReportAction/DebugReportActionPage.tsx | 4 +- src/pages/EditReportFieldPage.tsx | 4 +- src/pages/FlagCommentPage.tsx | 4 +- src/pages/GetAssistancePage.tsx | 4 +- src/pages/GroupChatNameEditPage.tsx | 4 +- src/pages/InviteReportParticipantsPage.tsx | 4 +- .../LogInWithShortLivedAuthTokenPage.tsx | 4 +- src/pages/LogOutPreviousUserPage.tsx | 4 +- src/pages/OnboardingEmployees/types.ts | 4 +- src/pages/OnboardingPersonalDetails/types.ts | 16 +- src/pages/OnboardingPurpose/types.ts | 4 +- .../PrivateNotes/PrivateNotesEditPage.tsx | 4 +- .../PrivateNotes/PrivateNotesListPage.tsx | 4 +- src/pages/ProfilePage.tsx | 4 +- src/pages/ReferralDetailsPage.tsx | 4 +- .../ReimbursementAccountPage.tsx | 7 +- src/pages/ReportAvatar.tsx | 4 +- src/pages/ReportDescriptionPage.tsx | 4 +- src/pages/ReportDetailsPage.tsx | 4 +- src/pages/ReportParticipantDetailsPage.tsx | 4 +- .../ReportParticipantRoleSelectionPage.tsx | 4 +- src/pages/ReportParticipantsPage.tsx | 4 +- .../WorkspaceRestrictedActionPage.tsx | 4 +- src/pages/RoomDescriptionPage.tsx | 4 +- src/pages/RoomInvitePage.tsx | 4 +- src/pages/RoomMemberDetailsPage.tsx | 4 +- src/pages/RoomMembersPage.tsx | 7 +- src/pages/Search/SearchHoldReasonPage.tsx | 4 +- src/pages/Search/SearchPage.tsx | 4 +- .../TransactionDuplicate/Confirmation.tsx | 4 +- src/pages/TransactionDuplicate/Review.tsx | 4 +- .../TransactionDuplicate/ReviewBillable.tsx | 4 +- .../TransactionDuplicate/ReviewCategory.tsx | 4 +- .../ReviewDescription.tsx | 4 +- .../TransactionDuplicate/ReviewMerchant.tsx | 4 +- .../ReviewReimbursable.tsx | 4 +- src/pages/TransactionDuplicate/ReviewTag.tsx | 4 +- .../TransactionDuplicate/ReviewTaxCode.tsx | 4 +- src/pages/TransactionReceiptPage.tsx | 4 +- src/pages/UnlinkLoginPage.tsx | 4 +- src/pages/ValidateLoginPage/types.ts | 4 +- src/pages/home/ReportScreen.tsx | 4 +- .../ReportActionCompose/SuggestionEmoji.tsx | 2 +- src/pages/home/report/ReportActionsList.tsx | 4 +- src/pages/home/report/ReportActionsView.tsx | 4 +- src/pages/home/report/ReportAttachments.tsx | 4 +- .../home/report/ReportDetailsExportPage.tsx | 4 +- .../report/ReportDetailsShareCodePage.tsx | 4 +- .../home/report/UserTypingEventListener.tsx | 4 +- .../withReportAndReportActionOrNotFound.tsx | 6 +- .../home/report/withReportOrNotFound.tsx | 42 +++-- src/pages/iou/HoldReasonPage.tsx | 25 +-- src/pages/iou/SplitBillDetailsPage.tsx | 4 +- src/pages/iou/request/IOURequestStartPage.tsx | 13 +- .../step/withFullTransactionOrNotFound.tsx | 7 +- .../step/withWritableReportOrNotFound.tsx | 6 +- src/pages/settings/AboutPage/ConsolePage.tsx | 4 +- src/pages/settings/AboutPage/ShareLogPage.tsx | 4 +- .../ExitSurvey/ExitSurveyConfirmPage.tsx | 4 +- .../ExitSurvey/ExitSurveyResponsePage.tsx | 4 +- .../Contacts/ContactMethodDetailsPage.tsx | 4 +- .../Profile/Contacts/ContactMethodsPage.tsx | 4 +- .../Profile/Contacts/NewContactMethodPage.tsx | 9 +- .../PersonalDetails/CountrySelectionPage.tsx | 4 +- .../PersonalDetails/PersonalAddressPage.tsx | 4 +- src/pages/settings/Profile/ProfileAvatar.tsx | 4 +- src/pages/settings/Report/NamePage.tsx | 4 +- .../Report/NotificationPreferencePage.tsx | 7 +- .../settings/Report/ReportSettingsPage.tsx | 4 +- src/pages/settings/Report/RoomNamePage.tsx | 4 +- src/pages/settings/Report/VisibilityPage.tsx | 7 +- .../settings/Report/WriteCapabilityPage.tsx | 7 +- .../AddDelegate/ConfirmDelegatePage.tsx | 4 +- .../AddDelegate/DelegateMagicCodePage.tsx | 4 +- .../AddDelegate/SelectDelegateRolePage.tsx | 4 +- .../settings/Security/CloseAccountPage.tsx | 4 +- .../TwoFactorAuth/Steps/CodesStep.tsx | 4 +- .../TwoFactorAuth/TwoFactorAuthSteps.tsx | 4 +- .../Subscription/SubscriptionSize/index.tsx | 4 +- .../Wallet/ActivatePhysicalCardPage.tsx | 4 +- .../Wallet/Card/GetPhysicalCardAddress.tsx | 4 +- .../Wallet/Card/GetPhysicalCardConfirm.tsx | 4 +- .../Wallet/Card/GetPhysicalCardName.tsx | 4 +- .../Wallet/Card/GetPhysicalCardPhone.tsx | 4 +- .../settings/Wallet/ExpensifyCardPage.tsx | 4 +- .../settings/Wallet/ReportCardLostPage.tsx | 4 +- .../Wallet/ReportVirtualCardFraudPage.tsx | 4 +- .../settings/Wallet/VerifyAccountPage.tsx | 4 +- src/pages/tasks/NewTaskDescriptionPage.tsx | 4 +- src/pages/tasks/NewTaskDetailsPage.tsx | 4 +- src/pages/tasks/NewTaskPage.tsx | 4 +- src/pages/tasks/NewTaskTitlePage.tsx | 4 +- src/pages/tasks/TaskAssigneeSelectorModal.tsx | 4 +- src/pages/tasks/TaskDescriptionPage.tsx | 4 +- src/pages/tasks/TaskTitlePage.tsx | 4 +- src/pages/wallet/WalletStatementPage.tsx | 4 +- src/pages/workspace/WorkspaceAvatar.tsx | 4 +- src/pages/workspace/WorkspaceInitialPage.tsx | 4 +- .../workspace/WorkspaceInviteMessagePage.tsx | 4 +- src/pages/workspace/WorkspaceInvitePage.tsx | 4 +- src/pages/workspace/WorkspaceJoinUserPage.tsx | 4 +- src/pages/workspace/WorkspaceMembersPage.tsx | 6 +- .../workspace/WorkspaceMoreFeaturesPage.tsx | 4 +- .../workspace/WorkspaceProfileAddressPage.tsx | 4 +- src/pages/workspace/WorkspaceProfilePage.tsx | 4 +- .../EnterSageIntacctCredentialsPage.tsx | 4 +- .../intacct/ExistingConnectionsPage.tsx | 4 +- .../intacct/SageIntacctPrerequisitesPage.tsx | 4 +- .../export/SageIntacctDefaultVendorPage.tsx | 4 +- .../SageIntacctEditUserDimensionsPage.tsx | 4 +- .../import/SageIntacctMappingsTypePage.tsx | 4 +- .../import/SageIntacctToggleMappingsPage.tsx | 4 +- .../NetSuiteExistingConnectionsPage.tsx | 4 +- .../qbd/QuickBooksDesktopSetupPage.tsx | 4 +- .../qbd/RequireQuickBooksDesktopPage.tsx | 4 +- .../reconciliation/CardReconciliationPage.tsx | 4 +- .../ReconciliationAccountSettingsPage.tsx | 4 +- .../XeroOrganizationConfigurationPage.tsx | 4 +- .../categories/CategoryApproverPage.tsx | 4 +- .../categories/CategoryDefaultTaxRatePage.tsx | 4 +- .../CategoryDescriptionHintPage.tsx | 4 +- .../CategoryFlagAmountsOverPage.tsx | 4 +- .../categories/CategoryGLCodePage.tsx | 4 +- .../categories/CategoryPayrollCodePage.tsx | 4 +- .../CategoryRequireReceiptsOverPage.tsx | 4 +- .../categories/CategorySettingsPage.tsx | 4 +- .../categories/CreateCategoryPage.tsx | 4 +- .../workspace/categories/EditCategoryPage.tsx | 4 +- .../categories/ImportCategoriesPage.tsx | 4 +- .../categories/ImportedCategoriesPage.tsx | 4 +- .../categories/WorkspaceCategoriesPage.tsx | 4 +- ...kspaceCompanyCardAccountSelectCardPage.tsx | 4 +- .../WorkspaceCompanyCardDetailsPage.tsx | 4 +- .../WorkspaceCompanyCardEditCardNamePage.tsx | 4 +- .../WorkspaceCompanyCardFeedSelectorPage.tsx | 4 +- .../WorkspaceCompanyCardsPage.tsx | 4 +- ...kspaceCompanyCardsSettingsFeedNamePage.tsx | 4 +- .../WorkspaceCompanyCardsSettingsPage.tsx | 4 +- .../distanceRates/CreateDistanceRatePage.tsx | 4 +- .../PolicyDistanceRateDetailsPage.tsx | 4 +- .../PolicyDistanceRateEditPage.tsx | 4 +- .../PolicyDistanceRateTaxRateEditPage.tsx | 4 +- ...licyDistanceRateTaxReclaimableEditPage.tsx | 5 +- .../distanceRates/PolicyDistanceRatesPage.tsx | 4 +- .../PolicyDistanceRatesSettingsPage.tsx | 4 +- .../WorkspaceCardSettingsPage.tsx | 4 +- .../expensifyCard/WorkspaceCardsListLabel.tsx | 4 +- .../WorkspaceEditCardLimitPage.tsx | 4 +- .../WorkspaceEditCardLimitTypePage.tsx | 4 +- .../WorkspaceEditCardNamePage.tsx | 4 +- .../WorkspaceExpensifyCardBankAccounts.tsx | 4 +- .../WorkspaceExpensifyCardDetailsPage.tsx | 4 +- .../WorkspaceExpensifyCardListPage.tsx | 4 +- .../WorkspaceExpensifyCardPage.tsx | 4 +- .../WorkspaceExpensifyCardPageEmptyState.tsx | 4 +- .../WorkspaceSettlementAccountPage.tsx | 4 +- .../WorkspaceSettlementFrequencyPage.tsx | 7 +- .../issueNew/IssueNewCardPage.tsx | 4 +- .../invoices/WorkspaceInvoicesPage.tsx | 4 +- .../WorkspaceInvoicingDetailsName.tsx | 4 +- .../WorkspaceInvoicingDetailsWebsite.tsx | 4 +- .../workspace/members/ImportMembersPage.tsx | 4 +- .../workspace/members/ImportedMembersPage.tsx | 4 +- .../members/WorkspaceMemberDetailsPage.tsx | 4 +- .../members/WorkspaceMemberNewCardPage.tsx | 4 +- .../members/WorkspaceOwnerChangeErrorPage.tsx | 4 +- .../WorkspaceOwnerChangeSuccessPage.tsx | 4 +- .../WorkspaceOwnerChangeWrapperPage.tsx | 4 +- .../reportFields/CreateReportFieldsPage.tsx | 4 +- .../ReportFieldsAddListValuePage.tsx | 4 +- .../ReportFieldsEditValuePage.tsx | 4 +- .../ReportFieldsInitialValuePage.tsx | 5 +- .../ReportFieldsListValuesPage.tsx | 4 +- .../reportFields/ReportFieldsSettingsPage.tsx | 4 +- .../ReportFieldsValueSettingsPage.tsx | 4 +- .../WorkspaceReportFieldsPage.tsx | 4 +- src/pages/workspace/rules/PolicyRulesPage.tsx | 4 +- .../RulesAutoApproveReportsUnderPage.tsx | 4 +- .../rules/RulesAutoPayReportsUnderPage.tsx | 4 +- .../rules/RulesBillableDefaultPage.tsx | 4 +- .../workspace/rules/RulesCustomNamePage.tsx | 4 +- .../rules/RulesMaxExpenseAgePage.tsx | 4 +- .../rules/RulesMaxExpenseAmountPage.tsx | 4 +- .../rules/RulesRandomReportAuditPage.tsx | 4 +- .../rules/RulesReceiptRequiredAmountPage.tsx | 4 +- src/pages/workspace/tags/EditTagPage.tsx | 4 +- src/pages/workspace/tags/ImportTagsPage.tsx | 4 +- src/pages/workspace/tags/ImportedTagsPage.tsx | 4 +- src/pages/workspace/tags/TagApproverPage.tsx | 4 +- src/pages/workspace/tags/TagGLCodePage.tsx | 4 +- src/pages/workspace/tags/TagSettingsPage.tsx | 4 +- .../workspace/tags/WorkspaceCreateTagPage.tsx | 4 +- .../workspace/tags/WorkspaceEditTagsPage.tsx | 4 +- .../workspace/tags/WorkspaceTagsPage.tsx | 4 +- .../tags/WorkspaceTagsSettingsPage.tsx | 4 +- .../workspace/tags/WorkspaceViewTagsPage.tsx | 4 +- src/pages/workspace/taxes/NamePage.tsx | 4 +- src/pages/workspace/taxes/ValuePage.tsx | 4 +- .../taxes/WorkspaceCreateTaxPage.tsx | 4 +- .../workspace/taxes/WorkspaceEditTaxPage.tsx | 4 +- .../workspace/taxes/WorkspaceTaxCodePage.tsx | 4 +- .../workspace/taxes/WorkspaceTaxesPage.tsx | 4 +- .../WorkspaceTaxesSettingsCustomTaxName.tsx | 5 +- .../WorkspaceTaxesSettingsForeignCurrency.tsx | 4 +- .../taxes/WorkspaceTaxesSettingsPage.tsx | 4 +- ...orkspaceTaxesSettingsWorkspaceCurrency.tsx | 4 +- .../upgrade/WorkspaceUpgradePage.tsx | 4 +- src/pages/workspace/withPolicy.tsx | 4 +- .../WorkspaceAutoReportingFrequencyPage.tsx | 4 +- ...orkspaceAutoReportingMonthlyOffsetPage.tsx | 5 +- .../workflows/WorkspaceWorkflowsPage.tsx | 4 +- .../workflows/WorkspaceWorkflowsPayerPage.tsx | 4 +- ...orkspaceWorkflowsApprovalsApproverPage.tsx | 4 +- .../WorkspaceWorkflowsApprovalsCreatePage.tsx | 5 +- .../WorkspaceWorkflowsApprovalsEditPage.tsx | 5 +- ...paceWorkflowsApprovalsExpensesFromPage.tsx | 4 +- tests/perf-test/ReportScreen.perf-test.tsx | 10 +- tests/unit/NextStepUtilsTest.ts | 4 + 261 files changed, 1000 insertions(+), 1288 deletions(-) delete mode 100644 src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts create mode 100644 src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabNavigationContentWrapper.tsx create mode 100644 src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/useCustomState/index.ts delete mode 100644 src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.native.tsx delete mode 100644 src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/types.ts delete mode 100644 src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts delete mode 100644 src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx delete mode 100644 src/libs/Navigation/AppNavigator/createCustomStackNavigator/types.ts delete mode 100644 src/libs/Navigation/AppNavigator/createModalCardStyleInterpolator.ts delete mode 100644 src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts create mode 100644 src/libs/Navigation/AppNavigator/useModalCardStyleInterpolator.ts create mode 100644 src/libs/Navigation/AppNavigator/useModalNavigatorOptions.ts create mode 100644 src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts diff --git a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx index 9329558d6531..a41779a34e3b 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import lodashSortBy from 'lodash/sortBy'; import truncate from 'lodash/truncate'; @@ -29,6 +28,7 @@ import * as CurrencyUtils from '@libs/CurrencyUtils'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as IOUUtils from '@libs/IOUUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReceiptUtils from '@libs/ReceiptUtils'; @@ -70,7 +70,7 @@ function MoneyRequestPreviewContent({ const StyleUtils = useStyleUtils(); const {translate} = useLocalize(); const {windowWidth} = useWindowDimensions(); - const route = useRoute>(); + const route = useRoute>(); const {shouldUseNarrowLayout} = useResponsiveLayout(); const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || '-1'}`); diff --git a/src/components/ScreenWrapper.tsx b/src/components/ScreenWrapper.tsx index 9a85e1d3af24..9740acf1d266 100644 --- a/src/components/ScreenWrapper.tsx +++ b/src/components/ScreenWrapper.tsx @@ -1,5 +1,4 @@ import {useIsFocused, useNavigation} from '@react-navigation/native'; -import type {StackNavigationProp} from '@react-navigation/stack'; import type {ForwardedRef, ReactNode} from 'react'; import React, {createContext, forwardRef, useEffect, useMemo, useRef, useState} from 'react'; import type {StyleProp, ViewStyle} from 'react-native'; @@ -15,6 +14,7 @@ import useTackInputFocus from '@hooks/useTackInputFocus'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as Browser from '@libs/Browser'; +import type {PlatformStackNavigationProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, RootStackParamList} from '@libs/Navigation/types'; import toggleTestToolsModal from '@userActions/TestTool'; import CONST from '@src/CONST'; @@ -97,7 +97,7 @@ type ScreenWrapperProps = { * * This is required because transitionEnd event doesn't trigger in the testing environment. */ - navigation?: StackNavigationProp | StackNavigationProp; + navigation?: PlatformStackNavigationProp | PlatformStackNavigationProp; /** Whether to show offline indicator on wide screens */ shouldShowOfflineIndicatorInWideScreen?: boolean; @@ -142,7 +142,7 @@ function ScreenWrapper( * so in other places where ScreenWrapper is used, we need to * fallback to useNavigation. */ - const navigationFallback = useNavigation>(); + const navigationFallback = useNavigation>(); const navigation = navigationProp ?? navigationFallback; const isFocused = useIsFocused(); const {windowHeight} = useWindowDimensions(shouldUseCachedViewportHeight); diff --git a/src/components/ScrollOffsetContextProvider.tsx b/src/components/ScrollOffsetContextProvider.tsx index d7815d7a65a0..78d8c5ed61fb 100644 --- a/src/components/ScrollOffsetContextProvider.tsx +++ b/src/components/ScrollOffsetContextProvider.tsx @@ -1,7 +1,8 @@ -import type {ParamListBase, RouteProp} from '@react-navigation/native'; +import type {ParamListBase} from '@react-navigation/native'; import React, {createContext, useCallback, useEffect, useMemo, useRef} from 'react'; import {withOnyx} from 'react-native-onyx'; import usePrevious from '@hooks/usePrevious'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {NavigationPartialRoute, State} from '@libs/Navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -10,10 +11,10 @@ import type {PriorityMode} from '@src/types/onyx'; type ScrollOffsetContextValue = { /** Save scroll offset of flashlist on given screen */ - saveScrollOffset: (route: RouteProp, scrollOffset: number) => void; + saveScrollOffset: (route: PlatformStackRouteProp, scrollOffset: number) => void; /** Get scroll offset value for given screen */ - getScrollOffset: (route: RouteProp) => number | undefined; + getScrollOffset: (route: PlatformStackRouteProp) => number | undefined; /** Clean scroll offsets of screen that aren't anymore in the state */ cleanStaleScrollOffsets: (state: State) => void; @@ -38,7 +39,7 @@ const defaultValue: ScrollOffsetContextValue = { const ScrollOffsetContext = createContext(defaultValue); /** This function is prepared to work with HOME screens. May need modification if we want to handle other types of screens. */ -function getKey(route: RouteProp | NavigationPartialRoute): string { +function getKey(route: PlatformStackRouteProp | NavigationPartialRoute): string { if (route.params && 'policyID' in route.params && typeof route.params.policyID === 'string') { return `${route.name}-${route.params.policyID}`; } diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 670cfef54df8..c61d6a241df5 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -1,5 +1,4 @@ import {useNavigation} from '@react-navigation/native'; -import type {StackNavigationProp} from '@react-navigation/stack'; import React, {useCallback, useEffect, useRef, useState} from 'react'; import {View} from 'react-native'; import type {NativeScrollEvent, NativeSyntheticEvent, StyleProp, ViewStyle} from 'react-native'; @@ -21,6 +20,7 @@ import * as SearchActions from '@libs/actions/Search'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import memoize from '@libs/memoize'; +import type {PlatformStackNavigationProp} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import * as SearchUtils from '@libs/SearchUtils'; import Navigation from '@navigation/Navigation'; @@ -89,7 +89,7 @@ function Search({queryJSON, onSearchListScroll, contentContainerStyle}: SearchPr const {shouldUseNarrowLayout} = useResponsiveLayout(); const styles = useThemeStyles(); const {isSmallScreenWidth, isLargeScreenWidth} = useResponsiveLayout(); - const navigation = useNavigation>(); + const navigation = useNavigation>(); const lastSearchResultsRef = useRef>(); const {setCurrentSearchHash, setSelectedTransactions, selectedTransactions, clearSelectedTransactions, setShouldShowStatusBarLoading, lastSearchType, setLastSearchType} = useSearchContext(); diff --git a/src/components/withNavigationTransitionEnd.tsx b/src/components/withNavigationTransitionEnd.tsx index 83f14a1d58ef..69e04ff22e35 100644 --- a/src/components/withNavigationTransitionEnd.tsx +++ b/src/components/withNavigationTransitionEnd.tsx @@ -1,8 +1,8 @@ import {useNavigation} from '@react-navigation/native'; -import type {StackNavigationProp} from '@react-navigation/stack'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {useEffect, useState} from 'react'; import getComponentDisplayName from '@libs/getComponentDisplayName'; +import type {PlatformStackNavigationProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {RootStackParamList} from '@libs/Navigation/types'; type WithNavigationTransitionEndProps = {didScreenTransitionEnd: boolean}; @@ -10,7 +10,7 @@ type WithNavigationTransitionEndProps = {didScreenTransitionEnd: boolean}; export default function (WrappedComponent: ComponentType>): React.ComponentType> { function WithNavigationTransitionEnd(props: TProps, ref: ForwardedRef) { const [didScreenTransitionEnd, setDidScreenTransitionEnd] = useState(false); - const navigation = useNavigation>(); + const navigation = useNavigation>(); useEffect(() => { const unsubscribeTransitionEnd = navigation.addListener('transitionEnd', () => { diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 7b8589c81e7f..94846c04e334 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -1,4 +1,4 @@ -import React, {memo, useEffect, useMemo, useRef, useState} from 'react'; +import React, {memo, useEffect, useRef, useState} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import Onyx, {withOnyx} from 'react-native-onyx'; @@ -13,14 +13,13 @@ import useActiveWorkspace from '@hooks/useActiveWorkspace'; import useOnboardingFlowRouter from '@hooks/useOnboardingFlow'; import usePermissions from '@hooks/usePermissions'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as Welcome from '@libs/actions/Welcome'; import {READ_COMMANDS} from '@libs/API/types'; import HttpUtils from '@libs/HttpUtils'; import KeyboardShortcut from '@libs/KeyboardShortcut'; import Log from '@libs/Log'; import getCurrentUrl from '@libs/Navigation/currentUrl'; -import getOnboardingModalScreenOptions from '@libs/Navigation/getOnboardingModalScreenOptions'; import Navigation from '@libs/Navigation/Navigation'; import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom'; import type {AuthScreensParamList, CentralPaneName, CentralPaneScreensParamList} from '@libs/Navigation/types'; @@ -56,9 +55,8 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import beforeRemoveReportOpenedFromSearchRHP from './beforeRemoveReportOpenedFromSearchRHP'; import CENTRAL_PANE_SCREENS from './CENTRAL_PANE_SCREENS'; -import createCustomStackNavigator from './createCustomStackNavigator'; +import createResponsiveStackNavigator from './createResponsiveStackNavigator'; import defaultScreenOptions from './defaultScreenOptions'; -import getRootNavigatorScreenOptions from './getRootNavigatorScreenOptions'; import BottomTabNavigator from './Navigators/BottomTabNavigator'; import ExplanationModalNavigator from './Navigators/ExplanationModalNavigator'; import FeatureTrainingModalNavigator from './Navigators/FeatureTrainingModalNavigator'; @@ -67,6 +65,7 @@ import LeftModalNavigator from './Navigators/LeftModalNavigator'; import OnboardingModalNavigator from './Navigators/OnboardingModalNavigator'; import RightModalNavigator from './Navigators/RightModalNavigator'; import WelcomeVideoModalNavigator from './Navigators/WelcomeVideoModalNavigator'; +import useRootNavigatorOptions from './useRootNavigatorOptions'; type AuthScreensProps = { /** Session of currently logged in user */ @@ -194,7 +193,7 @@ function handleNetworkReconnect() { } } -const RootStack = createCustomStackNavigator(); +const RootStack = createResponsiveStackNavigator(); // We want to delay the re-rendering for components(e.g. ReportActionCompose) // that depends on modal visibility until Modal is completely closed and its focused // When modal screen is focused, update modal visibility in Onyx @@ -224,18 +223,12 @@ const modalScreenListenersWithCancelSearch = { function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDAppliedToClient}: AuthScreensProps) { const styles = useThemeStyles(); - const StyleUtils = useStyleUtils(); - const {shouldUseNarrowLayout, onboardingIsMediumOrLargerScreenWidth, isSmallScreenWidth} = useResponsiveLayout(); - const screenOptions = getRootNavigatorScreenOptions(shouldUseNarrowLayout, styles, StyleUtils); + const {shouldUseNarrowLayout} = useResponsiveLayout(); + const rootNavigatorOptions = useRootNavigatorOptions(); const {canUseDefaultRooms} = usePermissions(); const {activeWorkspaceID} = useActiveWorkspace(); const {toggleSearchRouter} = useSearchRouterContext(); - const onboardingModalScreenOptions = useMemo(() => screenOptions.onboardingModalNavigator(onboardingIsMediumOrLargerScreenWidth), [screenOptions, onboardingIsMediumOrLargerScreenWidth]); - const onboardingScreenOptions = useMemo( - () => getOnboardingModalScreenOptions(shouldUseNarrowLayout, styles, StyleUtils, onboardingIsMediumOrLargerScreenWidth), - [StyleUtils, shouldUseNarrowLayout, onboardingIsMediumOrLargerScreenWidth, styles], - ); const modal = useRef({}); const [didPusherInit, setDidPusherInit] = useState(false); const {isOnboardingCompleted} = useOnboardingFlowRouter(); @@ -409,19 +402,16 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie return ( - + {isOnboardingCompleted === false && ( { @@ -559,7 +550,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie /> {Object.entries(CENTRAL_PANE_SCREENS).map(([screenName, componentGetter]) => { diff --git a/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts b/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts deleted file mode 100644 index 9dcbe8143b4a..000000000000 --- a/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type {StackNavigationOptions} from '@react-navigation/stack'; -import {CardStyleInterpolators} from '@react-navigation/stack'; -import type {GestureDirection} from '@react-navigation/stack/lib/typescript/src/types'; -import type {ThemeStyles} from '@styles/index'; - -/** - * Modal stack navigator screen options generator function - * @param themeStyles - The styles object - * @returns The screen options object - */ -const ModalNavigatorScreenOptions = (themeStyles: ThemeStyles, gestureDirection: GestureDirection = 'horizontal'): StackNavigationOptions => ({ - headerShown: false, - animationEnabled: true, - gestureDirection, - cardStyle: themeStyles.navigationScreenCardStyle, - cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, -}); - -export default ModalNavigatorScreenOptions; diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index fabf7fb78591..1e9a11fff115 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -1,7 +1,6 @@ import type {ParamListBase} from '@react-navigation/routers'; -import type {StackNavigationOptions} from '@react-navigation/stack'; -import {createStackNavigator} from '@react-navigation/stack'; import React from 'react'; +import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type { AddPersonalBankAccountNavigatorParamList, DebugParamList, @@ -33,10 +32,10 @@ import type { TravelNavigatorParamList, WalletStatementNavigatorParamList, } from '@navigation/types'; -import type {ThemeStyles} from '@styles/index'; import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; +import type {GetModalStackScreenOptions} from './useModalScreenOptions'; import useModalScreenOptions from './useModalScreenOptions'; type Screens = Partial React.ComponentType>>; @@ -47,8 +46,8 @@ type Screens = Partial React.ComponentType>>; * @param 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 * @param getScreenOptions optional function that returns the screen options, override the default options */ -function createModalStackNavigator(screens: Screens, getScreenOptions?: (styles: ThemeStyles) => StackNavigationOptions): React.ComponentType { - const ModalStackNavigator = createStackNavigator(); +function createModalStackNavigator(screens: Screens, getScreenOptions?: GetModalStackScreenOptions): React.ComponentType { + const ModalStackNavigator = createPlatformStackNavigator(); function ModalStack() { const screenOptions = useModalScreenOptions(getScreenOptions); diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalScreenOptions.ts b/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalScreenOptions.ts index 2193dcb2bf6b..e7549cc3f8b7 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalScreenOptions.ts @@ -1,35 +1,39 @@ -import type {StackCardInterpolationProps, StackNavigationOptions} from '@react-navigation/stack'; +import type {StackCardInterpolationProps} from '@react-navigation/stack'; import {CardStyleInterpolators} from '@react-navigation/stack'; import {useMemo} from 'react'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import {isSafari} from '@libs/Browser'; -import createModalCardStyleInterpolator from '@navigation/AppNavigator/createModalCardStyleInterpolator'; +import hideKeyboardOnSwipe from '@libs/Navigation/AppNavigator/hideKeyboardOnSwipe'; +import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; +import useModalCardStyleInterpolator from '@navigation/AppNavigator/useModalCardStyleInterpolator'; import type {ThemeStyles} from '@src/styles'; -function useModalScreenOptions(getScreenOptions?: (styles: ThemeStyles) => StackNavigationOptions) { +type GetModalStackScreenOptions = (styles: ThemeStyles) => PlatformStackNavigationOptions; + +function useModalScreenOptions(getScreenOptions?: GetModalStackScreenOptions) { const styles = useThemeStyles(); - const styleUtils = useStyleUtils(); - const {shouldUseNarrowLayout} = useResponsiveLayout(); + const customInterpolator = useModalCardStyleInterpolator(); let cardStyleInterpolator = CardStyleInterpolators.forHorizontalIOS; if (isSafari()) { - const customInterpolator = createModalCardStyleInterpolator(styleUtils); - cardStyleInterpolator = (props: StackCardInterpolationProps) => customInterpolator(shouldUseNarrowLayout, false, false, props); + cardStyleInterpolator = (props: StackCardInterpolationProps) => customInterpolator({props}); } const defaultSubRouteOptions = useMemo( - (): StackNavigationOptions => ({ - cardStyle: styles.navigationScreenCardStyle, + (): PlatformStackNavigationOptions => ({ + ...hideKeyboardOnSwipe, headerShown: false, - cardStyleInterpolator, + web: { + cardStyle: styles.navigationScreenCardStyle, + cardStyleInterpolator, + }, }), - [styles, cardStyleInterpolator], + [cardStyleInterpolator, styles.navigationScreenCardStyle], ); return getScreenOptions?.(styles) ?? defaultSubRouteOptions; } export default useModalScreenOptions; +export type {GetModalStackScreenOptions}; diff --git a/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx index 30e8d4c668c6..62cceee9f400 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx @@ -1,8 +1,8 @@ import {useNavigationState} from '@react-navigation/native'; -import type {StackNavigationOptions} from '@react-navigation/stack'; import React from 'react'; import createCustomBottomTabNavigator from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator'; import getTopmostCentralPaneRoute from '@libs/Navigation/getTopmostCentralPaneRoute'; +import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; import type {BottomTabNavigatorParamList, CentralPaneName, NavigationPartialRoute, RootStackParamList} from '@libs/Navigation/types'; import SidebarScreen from '@pages/home/sidebar/SidebarScreen'; import SearchPageBottomTab from '@pages/Search/SearchPageBottomTab'; @@ -13,9 +13,8 @@ import ActiveCentralPaneRouteContext from './ActiveCentralPaneRouteContext'; const loadInitialSettingsPage = () => require('../../../../pages/settings/InitialSettingsPage').default; const Tab = createCustomBottomTabNavigator(); -const screenOptions: StackNavigationOptions = { +const screenOptions: PlatformStackNavigationOptions = { headerShown: false, - animationEnabled: false, }; function BottomTabNavigator() { diff --git a/src/libs/Navigation/AppNavigator/Navigators/ExplanationModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/ExplanationModalNavigator.tsx index f4136bb8783a..b4626072538f 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/ExplanationModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/ExplanationModalNavigator.tsx @@ -1,18 +1,19 @@ -import {createStackNavigator} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; import ExplanationModal from '@components/ExplanationModal'; +import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type {ExplanationModalNavigatorParamList} from '@libs/Navigation/types'; import SCREENS from '@src/SCREENS'; +import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; -const Stack = createStackNavigator(); +const Stack = createPlatformStackNavigator(); function ExplanationModalNavigator() { return ( - + (); +const Stack = createPlatformStackNavigator(); function FeatureTrainingModalNavigator() { return ( - + - + {Object.entries(CENTRAL_PANE_WORKSPACE_SCREENS).map(([screenName, componentGetter]) => ( diff --git a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx index 50439c19845e..a269b4c35270 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx @@ -1,27 +1,27 @@ -import type {StackScreenProps} from '@react-navigation/stack'; -import {createStackNavigator} from '@react-navigation/stack'; -import React, {useMemo} from 'react'; +import React from 'react'; import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; -import ModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/ModalNavigatorScreenOptions'; +import useModalNavigatorOptions from '@libs/Navigation/AppNavigator/useModalNavigatorOptions'; +import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, LeftModalNavigatorParamList} from '@libs/Navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import Overlay from './Overlay'; -type LeftModalNavigatorProps = StackScreenProps; +type LeftModalNavigatorProps = PlatformStackScreenProps; const loadWorkspaceSwitcherPage = () => require('../../../../pages/WorkspaceSwitcherPage').default; -const Stack = createStackNavigator(); +const Stack = createPlatformStackNavigator(); function LeftModalNavigator({navigation}: LeftModalNavigatorProps) { const styles = useThemeStyles(); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const screenOptions = useMemo(() => ModalNavigatorScreenOptions(styles, 'horizontal-inverted'), [styles]); + const screenOptions = useModalNavigatorOptions('horizontal-inverted'); return ( diff --git a/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx index 4aae43987797..dbe7f70e9628 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx @@ -1,4 +1,3 @@ -import {createStackNavigator} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; @@ -7,6 +6,7 @@ import useKeyboardShortcut from '@hooks/useKeyboardShortcut'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import OnboardingModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/OnboardingModalNavigatorScreenOptions'; +import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types'; import OnboardingRefManager from '@libs/OnboardingRefManager'; import OnboardingAccounting from '@pages/OnboardingAccounting'; @@ -17,7 +17,7 @@ import CONST from '@src/CONST'; import SCREENS from '@src/SCREENS'; import Overlay from './Overlay'; -const Stack = createStackNavigator(); +const Stack = createPlatformStackNavigator(); function OnboardingModalNavigator() { const styles = useThemeStyles(); diff --git a/src/libs/Navigation/AppNavigator/Navigators/Overlay/index.native.tsx b/src/libs/Navigation/AppNavigator/Navigators/Overlay/index.native.tsx index 0dd9e203c46b..cde195fca561 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/Overlay/index.native.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/Overlay/index.native.tsx @@ -1,15 +1,5 @@ -import React from 'react'; -import type {BaseOverlayProps} from './BaseOverlay'; -import BaseOverlay from './BaseOverlay'; - -function Overlay({...rest}: Omit) { - return ( - - ); +function Overlay() { + return null; } Overlay.displayName = 'Overlay'; diff --git a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx index 0df3ae3f4b92..726a5305e3ab 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx @@ -1,40 +1,47 @@ -import type {StackCardInterpolationProps, StackScreenProps} from '@react-navigation/stack'; -import {createStackNavigator} from '@react-navigation/stack'; +import type {StackCardInterpolationProps} from '@react-navigation/stack'; import React, {useMemo, useRef} from 'react'; import {InteractionManager, View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import {abandonReviewDuplicateTransactions} from '@libs/actions/Transaction'; import {isSafari} from '@libs/Browser'; -import ModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/ModalNavigatorScreenOptions'; +import hideKeyboardOnSwipe from '@libs/Navigation/AppNavigator/hideKeyboardOnSwipe'; import * as ModalStackNavigators from '@libs/Navigation/AppNavigator/ModalStackNavigators'; -import createModalCardStyleInterpolator from '@navigation/AppNavigator/createModalCardStyleInterpolator'; +import useModalCardStyleInterpolator from '@libs/Navigation/AppNavigator/useModalCardStyleInterpolator'; +import useModalNavigatorOptions from '@libs/Navigation/AppNavigator/useModalNavigatorOptions'; +import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, RightModalNavigatorParamList} from '@navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; import Overlay from './Overlay'; -type RightModalNavigatorProps = StackScreenProps; +type RightModalNavigatorProps = PlatformStackScreenProps; -const Stack = createStackNavigator(); +const Stack = createPlatformStackNavigator(); function RightModalNavigator({navigation, route}: RightModalNavigatorProps) { const styles = useThemeStyles(); - const styleUtils = useStyleUtils(); const {shouldUseNarrowLayout} = useResponsiveLayout(); const isExecutingRef = useRef(false); + const customInterpolator = useModalCardStyleInterpolator(); + const modalNavigatorOptions = useModalNavigatorOptions(); + const screenOptions = useMemo(() => { - const options = ModalNavigatorScreenOptions(styles); // The .forHorizontalIOS interpolator from `@react-navigation` is misbehaving on Safari, so we override it with Expensify custom interpolator if (isSafari()) { - const customInterpolator = createModalCardStyleInterpolator(styleUtils); - options.cardStyleInterpolator = (props: StackCardInterpolationProps) => customInterpolator(shouldUseNarrowLayout, false, false, props); + return { + ...modalNavigatorOptions, + web: { + ...modalNavigatorOptions.web, + cardStyleInterpolator: (props: StackCardInterpolationProps) => customInterpolator({props}), + }, + }; } - return options; - }, [shouldUseNarrowLayout, styleUtils, styles]); + return modalNavigatorOptions; + }, [customInterpolator, modalNavigatorOptions]); return ( @@ -170,6 +177,7 @@ function RightModalNavigator({navigation, route}: RightModalNavigatorProps) { (); +const Stack = createPlatformStackNavigator(); function WelcomeVideoModalNavigator() { return ( - + ({ +const OnboardingModalNavigatorScreenOptions = (): PlatformStackNavigationOptions => ({ headerShown: false, - animationEnabled: true, gestureDirection: 'horizontal', - cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, presentation: 'transparentModal', + web: { + cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, + }, }); export default OnboardingModalNavigatorScreenOptions; diff --git a/src/libs/Navigation/AppNavigator/PublicScreens.tsx b/src/libs/Navigation/AppNavigator/PublicScreens.tsx index cfd41a4b1fa0..dbbb11c978d5 100644 --- a/src/libs/Navigation/AppNavigator/PublicScreens.tsx +++ b/src/libs/Navigation/AppNavigator/PublicScreens.tsx @@ -1,6 +1,6 @@ -import {createStackNavigator} from '@react-navigation/stack'; import React from 'react'; import {NativeModules} from 'react-native'; +import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type {PublicScreensParamList} from '@navigation/types'; import ConnectionCompletePage from '@pages/ConnectionCompletePage'; import SessionExpiredPage from '@pages/ErrorPage/SessionExpiredPage'; @@ -15,20 +15,18 @@ import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; import defaultScreenOptions from './defaultScreenOptions'; -const RootStack = createStackNavigator(); +const RootStack = createPlatformStackNavigator(); function PublicScreens() { return ( - + {/* The structure for the HOME route has to be the same in public and auth screens. That's why the name for SignInPage is BOTTOM_TAB_NAVIGATOR. */} diff --git a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabNavigationContentWrapper.tsx b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabNavigationContentWrapper.tsx new file mode 100644 index 000000000000..dd93a6df7b1e --- /dev/null +++ b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabNavigationContentWrapper.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import {View} from 'react-native'; +import ScreenWrapper from '@components/ScreenWrapper'; +import useThemeStyles from '@hooks/useThemeStyles'; +import type {NavigationContentWrapperProps} from '@libs/Navigation/PlatformStackNavigation/types'; + +function BottomTabNavigationContentWrapper({children, displayName}: NavigationContentWrapperProps) { + const styles = useThemeStyles(); + + return ( + + {children} + + ); +} + +export default BottomTabNavigationContentWrapper; diff --git a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/index.tsx b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/index.tsx index 7401c3368124..a4e50aeb6516 100644 --- a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/index.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/index.tsx @@ -1,74 +1,32 @@ -import type {DefaultNavigatorOptions, ParamListBase, StackActionHelpers, StackNavigationState, StackRouterOptions} from '@react-navigation/native'; -import {createNavigatorFactory, StackRouter, useNavigationBuilder} from '@react-navigation/native'; -import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; -import {StackView} from '@react-navigation/stack'; +import type {ParamListBase} from '@react-navigation/native'; +import {createNavigatorFactory} from '@react-navigation/native'; import React from 'react'; -import {View} from 'react-native'; -import ScreenWrapper from '@components/ScreenWrapper'; -import useThemeStyles from '@hooks/useThemeStyles'; -import type {NavigationStateRoute} from '@libs/Navigation/types'; -import SCREENS from '@src/SCREENS'; +import createPlatformStackNavigatorComponent from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent'; +import type {ExtraContentProps, PlatformStackNavigationEventMap, PlatformStackNavigationOptions, PlatformStackNavigationState} from '@libs/Navigation/PlatformStackNavigation/types'; import BottomTabBar from './BottomTabBar'; +import BottomTabNavigationContentWrapper from './BottomTabNavigationContentWrapper'; +import useCustomState from './useCustomState'; -type CustomNavigatorProps = DefaultNavigatorOptions, StackNavigationOptions, StackNavigationEventMap> & { - initialRouteName: string; +const defaultScreenOptions: PlatformStackNavigationOptions = { + animation: 'none', }; -function getStateToRender(state: StackNavigationState): StackNavigationState { - const routesToRender = [state.routes.at(-1)] as NavigationStateRoute[]; - - // We need to render at least one HOME screen to make sure everything load properly. This may be not necessary after changing how IS_SIDEBAR_LOADED is handled. - // Currently this value will be switched only after the first HOME screen is rendered. - if (routesToRender.at(0)?.name !== SCREENS.HOME) { - const routeToRender = state.routes.find((route) => route.name === SCREENS.HOME); - if (routeToRender) { - routesToRender.unshift(routeToRender); - } - } - - return {...state, routes: routesToRender, index: routesToRender.length - 1}; +function ExtraContent({state}: ExtraContentProps) { + const selectedTab = state.routes.at(-1)?.name; + return ; } -function CustomBottomTabNavigator({initialRouteName, children, screenOptions, ...props}: CustomNavigatorProps) { - const {state, navigation, descriptors, NavigationContent} = useNavigationBuilder< - StackNavigationState, - StackRouterOptions, - StackActionHelpers, - StackNavigationOptions, - StackNavigationEventMap - >(StackRouter, { - children, - screenOptions, - initialRouteName, - }); - - const styles = useThemeStyles(); - const stateToRender = getStateToRender(state); - const selectedTab = stateToRender.routes.at(-1)?.name; - - return ( - - - - - - - - - ); +const CustomBottomTabNavigatorComponent = createPlatformStackNavigatorComponent('CustomBottomTabNavigator', { + useCustomState, + defaultScreenOptions, + NavigationContentWrapper: BottomTabNavigationContentWrapper, + ExtraContent, +}); + +function createCustomBottomTabNavigator() { + return createNavigatorFactory, PlatformStackNavigationOptions, PlatformStackNavigationEventMap, typeof CustomBottomTabNavigatorComponent>( + CustomBottomTabNavigatorComponent, + )(); } -CustomBottomTabNavigator.displayName = 'CustomBottomTabNavigator'; - -export default createNavigatorFactory(CustomBottomTabNavigator); +export default createCustomBottomTabNavigator; diff --git a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/useCustomState/index.ts b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/useCustomState/index.ts new file mode 100644 index 000000000000..e95c6c292dbc --- /dev/null +++ b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/useCustomState/index.ts @@ -0,0 +1,20 @@ +import type {CustomStateHookProps} from '@libs/Navigation/PlatformStackNavigation/types'; +import type {NavigationStateRoute} from '@libs/Navigation/types'; +import SCREENS from '@src/SCREENS'; + +function useCustomState({state}: CustomStateHookProps) { + const routesToRender = [state.routes.at(-1)] as NavigationStateRoute[]; + + // We need to render at least one HOME screen to make sure everything load properly. This may be not necessary after changing how IS_SIDEBAR_LOADED is handled. + // Currently this value will be switched only after the first HOME screen is rendered. + if (routesToRender.at(0)?.name !== SCREENS.HOME) { + const routeToRender = state.routes.find((route) => route.name === SCREENS.HOME); + if (routeToRender) { + routesToRender.unshift(routeToRender); + } + } + + return {stateToRender: {...state, routes: routesToRender, index: routesToRender.length - 1}}; +} + +export default useCustomState; diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx index 18cb758c5703..5c837fc93a5b 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx @@ -1,10 +1,10 @@ -import type {ParamListBase, PartialState, RouterConfigOptions, StackNavigationState} from '@react-navigation/native'; +import type {ParamListBase, PartialState, Router, RouterConfigOptions} from '@react-navigation/native'; import {StackRouter} from '@react-navigation/native'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; +import type {PlatformStackNavigationState, PlatformStackRouterOptions} from '@libs/Navigation/PlatformStackNavigation/types'; import SCREENS from '@src/SCREENS'; -import type {FullScreenNavigatorRouterOptions} from './types'; -type StackState = StackNavigationState | PartialState>; +type StackState = PlatformStackNavigationState | PartialState>; const isAtLeastOneInState = (state: StackState, screenName: string): boolean => state.routes.some((route) => route.name === screenName); @@ -49,8 +49,9 @@ function adaptStateIfNecessary(state: StackState) { } } -function CustomFullScreenRouter(options: FullScreenNavigatorRouterOptions) { - const stackRouter = StackRouter(options); +function CustomFullScreenRouter(options: PlatformStackRouterOptions) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const stackRouter = StackRouter(options) as Router, any>; return { ...stackRouter, @@ -65,7 +66,7 @@ function CustomFullScreenRouter(options: FullScreenNavigatorRouterOptions) { return initialState; }, - getRehydratedState(partialState: StackState, {routeNames, routeParamList, routeGetIdList}: RouterConfigOptions): StackNavigationState { + getRehydratedState(partialState: StackState, {routeNames, routeParamList, routeGetIdList}: RouterConfigOptions): PlatformStackNavigationState { adaptStateIfNecessary(partialState); const state = stackRouter.getRehydratedState(partialState, {routeNames, routeParamList, routeGetIdList}); return state; diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.native.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.native.tsx deleted file mode 100644 index 2f61f1519df0..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.native.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import type {ParamListBase, StackActionHelpers, StackNavigationState} from '@react-navigation/native'; -import {createNavigatorFactory, useNavigationBuilder} from '@react-navigation/native'; -import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; -import {StackView} from '@react-navigation/stack'; -import CustomFullScreenRouter from './CustomFullScreenRouter'; -import type {FullScreenNavigatorProps, FullScreenNavigatorRouterOptions} from './types'; - -function CustomFullScreenNavigator(props: FullScreenNavigatorProps) { - const {navigation, state, descriptors, NavigationContent} = useNavigationBuilder< - StackNavigationState, - FullScreenNavigatorRouterOptions, - StackActionHelpers, - StackNavigationOptions, - StackNavigationEventMap - >(CustomFullScreenRouter, { - children: props.children, - screenOptions: props.screenOptions, - initialRouteName: props.initialRouteName, - }); - - return ( - - - - ); -} - -CustomFullScreenNavigator.displayName = 'CustomFullScreenNavigator'; - -export default createNavigatorFactory, StackNavigationOptions, StackNavigationEventMap, typeof CustomFullScreenNavigator>(CustomFullScreenNavigator); diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.tsx index ee8dd54c920d..204a9780e7d5 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.tsx @@ -1,50 +1,19 @@ -import type {ParamListBase, StackActionHelpers, StackNavigationState} from '@react-navigation/native'; -import {createNavigatorFactory, useNavigationBuilder} from '@react-navigation/native'; -import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; -import {StackView} from '@react-navigation/stack'; -import React, {useEffect} from 'react'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import navigationRef from '@libs/Navigation/navigationRef'; +import type {ParamListBase} from '@react-navigation/native'; +import {createNavigatorFactory} from '@react-navigation/native'; +import useNavigationResetOnLayoutChange from '@libs/Navigation/AppNavigator/useNavigationResetOnLayoutChange'; +import createPlatformStackNavigatorComponent from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent'; +import type {PlatformStackNavigationEventMap, PlatformStackNavigationOptions, PlatformStackNavigationState} from '@libs/Navigation/PlatformStackNavigation/types'; import CustomFullScreenRouter from './CustomFullScreenRouter'; -import type {FullScreenNavigatorProps, FullScreenNavigatorRouterOptions} from './types'; -function CustomFullScreenNavigator(props: FullScreenNavigatorProps) { - const {navigation, state, descriptors, NavigationContent} = useNavigationBuilder< - StackNavigationState, - FullScreenNavigatorRouterOptions, - StackActionHelpers, - StackNavigationOptions, - StackNavigationEventMap - >(CustomFullScreenRouter, { - children: props.children, - screenOptions: props.screenOptions, - initialRouteName: props.initialRouteName, - }); +const CustomFullScreenNavigatorComponent = createPlatformStackNavigatorComponent('CustomFullScreenNavigator', { + createRouter: CustomFullScreenRouter, + useCustomEffects: useNavigationResetOnLayoutChange, +}); - const {shouldUseNarrowLayout} = useResponsiveLayout(); - - useEffect(() => { - if (!navigationRef.isReady()) { - return; - } - // We need to separately reset state of this navigator to trigger getRehydratedState. - navigation.reset(navigation.getState()); - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, [shouldUseNarrowLayout]); - - return ( - - - - ); +function createCustomFullScreenNavigator() { + return createNavigatorFactory, PlatformStackNavigationOptions, PlatformStackNavigationEventMap, typeof CustomFullScreenNavigatorComponent>( + CustomFullScreenNavigatorComponent, + )(); } -CustomFullScreenNavigator.displayName = 'CustomFullScreenNavigator'; - -export default createNavigatorFactory, StackNavigationOptions, StackNavigationEventMap, typeof CustomFullScreenNavigator>(CustomFullScreenNavigator); +export default createCustomFullScreenNavigator; diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/types.ts b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/types.ts deleted file mode 100644 index 7e7808c003d7..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/types.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type {DefaultNavigatorOptions, ParamListBase, StackNavigationState, StackRouterOptions} from '@react-navigation/native'; -import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; - -type FullScreenNavigatorRouterOptions = StackRouterOptions; - -type FullScreenNavigatorProps = DefaultNavigatorOptions, StackNavigationOptions, StackNavigationEventMap>; - -export type {FullScreenNavigatorProps, FullScreenNavigatorRouterOptions}; diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts deleted file mode 100644 index 8156425fa904..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts +++ /dev/null @@ -1,144 +0,0 @@ -import type {CommonActions, RouterConfigOptions, StackActionType, StackNavigationState} from '@react-navigation/native'; -import {findFocusedRoute, getPathFromState, StackRouter} from '@react-navigation/native'; -import type {ParamListBase} from '@react-navigation/routers'; -import getIsNarrowLayout from '@libs/getIsNarrowLayout'; -import * as Localize from '@libs/Localize'; -import getTopmostBottomTabRoute from '@libs/Navigation/getTopmostBottomTabRoute'; -import getTopmostCentralPaneRoute from '@libs/Navigation/getTopmostCentralPaneRoute'; -import linkingConfig from '@libs/Navigation/linkingConfig'; -import getAdaptedStateFromPath from '@libs/Navigation/linkingConfig/getAdaptedStateFromPath'; -import type {NavigationPartialRoute, RootStackParamList, State} from '@libs/Navigation/types'; -import {isCentralPaneName, isOnboardingFlowName} from '@libs/NavigationUtils'; -import * as Welcome from '@userActions/Welcome'; -import CONST from '@src/CONST'; -import NAVIGATORS from '@src/NAVIGATORS'; -import SCREENS from '@src/SCREENS'; -import syncBrowserHistory from './syncBrowserHistory'; -import type {ResponsiveStackNavigatorRouterOptions} from './types'; - -function insertRootRoute(state: State, routeToInsert: NavigationPartialRoute) { - const nonModalRoutes = state.routes.filter( - (route) => route.name !== NAVIGATORS.RIGHT_MODAL_NAVIGATOR && route.name !== NAVIGATORS.LEFT_MODAL_NAVIGATOR && route.name !== NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR, - ); - const modalRoutes = state.routes.filter( - (route) => route.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR || route.name === NAVIGATORS.LEFT_MODAL_NAVIGATOR || route.name === NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR, - ); - - // It's safe to modify this state before returning in getRehydratedState. - - // @ts-expect-error Updating read only property - // noinspection JSConstantReassignment - state.routes = [...nonModalRoutes, routeToInsert, ...modalRoutes]; // eslint-disable-line - - // @ts-expect-error Updating read only property - // noinspection JSConstantReassignment - state.index = state.routes.length - 1; // eslint-disable-line - - // @ts-expect-error Updating read only property - // noinspection JSConstantReassignment - state.stale = true; // eslint-disable-line -} - -function compareAndAdaptState(state: StackNavigationState) { - // If the state of the last path is not defined the getPathFromState won't work correctly. - if (!state?.routes.at(-1)?.state) { - return; - } - - // We need to be sure that the bottom tab state is defined. - const topmostBottomTabRoute = getTopmostBottomTabRoute(state); - const isNarrowLayout = getIsNarrowLayout(); - - // This solutions is heuristics and will work for our cases. We may need to improve it in the future if we will have more cases to handle. - if (topmostBottomTabRoute && !isNarrowLayout) { - const fullScreenRoute = state.routes.find((route) => route.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR); - - // If there is fullScreenRoute we don't need to add anything. - if (fullScreenRoute) { - return; - } - - // We will generate a template state and compare the current state with it. - // If there is a difference in the screens that should be visible under the overlay, we will add the screen from templateState to the current state. - const pathFromCurrentState = getPathFromState(state, linkingConfig.config); - const {adaptedState: templateState} = getAdaptedStateFromPath(pathFromCurrentState, linkingConfig.config); - - if (!templateState) { - return; - } - - const templateFullScreenRoute = templateState.routes.find((route) => route.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR); - - // If templateFullScreenRoute is defined, and full screen route is not in the state, we need to add it. - if (templateFullScreenRoute) { - insertRootRoute(state, templateFullScreenRoute); - return; - } - - const topmostCentralPaneRoute = state.routes.filter((route) => isCentralPaneName(route.name)).at(-1); - const templateCentralPaneRoute = templateState.routes.find((route) => isCentralPaneName(route.name)); - - const topmostCentralPaneRouteExtracted = getTopmostCentralPaneRoute(state); - const templateCentralPaneRouteExtracted = getTopmostCentralPaneRoute(templateState as State); - - // If there is no templateCentralPaneRoute, we don't have anything to add. - if (!templateCentralPaneRoute) { - return; - } - - // If there is no topmostCentralPaneRoute in the state and template state has one, we need to add it. - if (!topmostCentralPaneRoute) { - insertRootRoute(state, templateCentralPaneRoute); - return; - } - - // If there is central pane route in state and template state has one, we need to check if they are the same. - if (topmostCentralPaneRouteExtracted && templateCentralPaneRouteExtracted && topmostCentralPaneRouteExtracted.name !== templateCentralPaneRouteExtracted.name) { - // Not every RHP screen has matching central pane defined. In that case we use the REPORT screen as default for initial screen. - // But we don't want to override the central pane for those screens as they may be opened with different central panes under the overlay. - // e.g. i-know-a-teacher may be opened with different central panes under the overlay - if (templateCentralPaneRouteExtracted.name === SCREENS.REPORT) { - return; - } - insertRootRoute(state, templateCentralPaneRoute); - } - } -} - -function shouldPreventReset(state: StackNavigationState, action: CommonActions.Action | StackActionType) { - if (action.type !== CONST.NAVIGATION_ACTIONS.RESET || !action?.payload) { - return false; - } - const currentFocusedRoute = findFocusedRoute(state); - const targetFocusedRoute = findFocusedRoute(action?.payload); - - // We want to prevent the user from navigating back to a non-onboarding screen if they are currently on an onboarding screen - if (isOnboardingFlowName(currentFocusedRoute?.name) && !isOnboardingFlowName(targetFocusedRoute?.name)) { - Welcome.setOnboardingErrorMessage(Localize.translateLocal('onboarding.purpose.errorBackButton')); - return true; - } - - return false; -} - -function CustomRouter(options: ResponsiveStackNavigatorRouterOptions) { - const stackRouter = StackRouter(options); - - return { - ...stackRouter, - getRehydratedState(partialState: StackNavigationState, {routeNames, routeParamList, routeGetIdList}: RouterConfigOptions): StackNavigationState { - compareAndAdaptState(partialState); - const state = stackRouter.getRehydratedState(partialState, {routeNames, routeParamList, routeGetIdList}); - return state; - }, - getStateForAction(state: StackNavigationState, action: CommonActions.Action | StackActionType, configOptions: RouterConfigOptions) { - if (shouldPreventReset(state, action)) { - syncBrowserHistory(state); - return state; - } - return stackRouter.getStateForAction(state, action, configOptions); - }, - }; -} - -export default CustomRouter; diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx deleted file mode 100644 index 6c153b1b159e..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import type {ParamListBase, RouteProp, StackActionHelpers, StackNavigationState} from '@react-navigation/native'; -import {createNavigatorFactory, useNavigationBuilder} from '@react-navigation/native'; -import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; -import {StackView} from '@react-navigation/stack'; -import React, {useEffect, useMemo} from 'react'; -import {View} from 'react-native'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useThemeStyles from '@hooks/useThemeStyles'; -import getTopmostCentralPaneRoute from '@libs/Navigation/getTopmostCentralPaneRoute'; -import navigationRef from '@libs/Navigation/navigationRef'; -import type {RootStackParamList, State} from '@libs/Navigation/types'; -import {isCentralPaneName} from '@libs/NavigationUtils'; -import SCREENS from '@src/SCREENS'; -import CustomRouter from './CustomRouter'; -import type {ResponsiveStackNavigatorProps, ResponsiveStackNavigatorRouterOptions} from './types'; - -type Routes = StackNavigationState['routes']; -function reduceCentralPaneRoutes(routes: Routes): Routes { - const result: Routes = []; - let count = 0; - const reverseRoutes = [...routes].reverse(); - - reverseRoutes.forEach((route) => { - if (isCentralPaneName(route.name)) { - // Remove all central pane routes except the last 3. This will improve performance. - if (count < 3) { - result.push(route); - count++; - } - } else { - result.push(route); - } - }); - - return result.reverse(); -} - -function ResponsiveStackNavigator(props: ResponsiveStackNavigatorProps) { - const {shouldUseNarrowLayout} = useResponsiveLayout(); - const styles = useThemeStyles(); - - const {navigation, state, descriptors, NavigationContent} = useNavigationBuilder< - StackNavigationState, - ResponsiveStackNavigatorRouterOptions, - StackActionHelpers, - StackNavigationOptions, - StackNavigationEventMap - >(CustomRouter, { - children: props.children, - screenOptions: props.screenOptions, - initialRouteName: props.initialRouteName, - }); - - useEffect(() => { - if (!navigationRef.isReady()) { - return; - } - navigationRef.resetRoot(navigationRef.getRootState()); - }, [shouldUseNarrowLayout]); - - const {stateToRender, searchRoute} = useMemo(() => { - const routes = reduceCentralPaneRoutes(state.routes); - - if (shouldUseNarrowLayout) { - const isSearchCentralPane = (route: RouteProp) => getTopmostCentralPaneRoute({routes: [route]} as State)?.name === SCREENS.SEARCH.CENTRAL_PANE; - - const lastRoute = routes.at(-1); - const lastSearchCentralPane = lastRoute && isSearchCentralPane(lastRoute) ? lastRoute : undefined; - const filteredRoutes = routes.filter((route) => !isSearchCentralPane(route)); - - // On narrow layout, if we are on /search route we want to hide all central pane routes and show only the bottom tab navigator. - if (lastSearchCentralPane) { - const filteredRoute = filteredRoutes.at(0); - if (filteredRoute) { - return { - stateToRender: { - ...state, - index: 0, - routes: [filteredRoute], - }, - searchRoute: lastSearchCentralPane, - }; - } - } - - return { - stateToRender: { - ...state, - index: filteredRoutes.length - 1, - routes: filteredRoutes, - }, - searchRoute: undefined, - }; - } - - return { - stateToRender: { - ...state, - index: routes.length - 1, - routes: [...routes], - }, - searchRoute: undefined, - }; - }, [state, shouldUseNarrowLayout]); - - return ( - - - {searchRoute && {descriptors[searchRoute.key].render()}} - - ); -} - -ResponsiveStackNavigator.displayName = 'ResponsiveStackNavigator'; - -export default createNavigatorFactory, StackNavigationOptions, StackNavigationEventMap, typeof ResponsiveStackNavigator>(ResponsiveStackNavigator); diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/types.ts b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/types.ts deleted file mode 100644 index 09d35e2a1680..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type {DefaultNavigatorOptions, ParamListBase, StackNavigationState, StackRouterOptions} from '@react-navigation/native'; -import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; - -type ResponsiveStackNavigatorConfig = { - isSmallScreenWidth: boolean; -}; - -type ResponsiveStackNavigatorRouterOptions = StackRouterOptions; - -type ResponsiveStackNavigatorProps = DefaultNavigatorOptions, StackNavigationOptions, StackNavigationEventMap> & - ResponsiveStackNavigatorConfig; - -export type {ResponsiveStackNavigatorRouterOptions, ResponsiveStackNavigatorProps, ResponsiveStackNavigatorConfig}; diff --git a/src/libs/Navigation/AppNavigator/createModalCardStyleInterpolator.ts b/src/libs/Navigation/AppNavigator/createModalCardStyleInterpolator.ts deleted file mode 100644 index 21911ebb56e2..000000000000 --- a/src/libs/Navigation/AppNavigator/createModalCardStyleInterpolator.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type {StackCardInterpolatedStyle, StackCardInterpolationProps} from '@react-navigation/stack'; -import {Animated} from 'react-native'; -import type {StyleUtilsType} from '@styles/utils'; -import variables from '@styles/variables'; - -type ModalCardStyleInterpolator = ( - isSmallScreenWidth: boolean, - isFullScreenModal: boolean, - shouldUseNarrowLayout: boolean, - stackCardInterpolationProps: StackCardInterpolationProps, - outputRangeMultiplier?: number, -) => StackCardInterpolatedStyle; -type CreateModalCardStyleInterpolator = (StyleUtils: StyleUtilsType) => ModalCardStyleInterpolator; - -const createModalCardStyleInterpolator: CreateModalCardStyleInterpolator = - (StyleUtils) => - (isSmallScreenWidth, isFullScreenModal, shouldUseNarrowLayout, {current: {progress}, inverted, layouts: {screen}}, outputRangeMultiplier = 1) => { - if (shouldUseNarrowLayout) { - return { - cardStyle: { - opacity: progress, - }, - }; - } - - const translateX = Animated.multiply( - progress.interpolate({ - inputRange: [0, 1], - outputRange: [outputRangeMultiplier * (isSmallScreenWidth ? screen.width : variables.sideBarWidth), 0], - extrapolate: 'clamp', - }), - inverted, - ); - - const cardStyle = StyleUtils.getCardStyles(screen.width); - - if (!isFullScreenModal || isSmallScreenWidth) { - cardStyle.transform = [{translateX}]; - } - - return { - containerStyle: { - overflow: 'hidden', - }, - cardStyle, - }; - }; - -export default createModalCardStyleInterpolator; diff --git a/src/libs/Navigation/AppNavigator/defaultScreenOptions.ts b/src/libs/Navigation/AppNavigator/defaultScreenOptions.ts index 4015c43c679e..8d941799a81a 100644 --- a/src/libs/Navigation/AppNavigator/defaultScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/defaultScreenOptions.ts @@ -1,12 +1,14 @@ -import type {StackNavigationOptions} from '@react-navigation/stack'; +import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; -const defaultScreenOptions: StackNavigationOptions = { - cardStyle: { - overflow: 'visible', - flex: 1, - }, +const defaultScreenOptions: PlatformStackNavigationOptions = { headerShown: false, animationTypeForReplace: 'push', + web: { + cardStyle: { + overflow: 'visible', + flex: 1, + }, + }, }; export default defaultScreenOptions; diff --git a/src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts b/src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts deleted file mode 100644 index e09f85936385..000000000000 --- a/src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts +++ /dev/null @@ -1,141 +0,0 @@ -import type {StackCardInterpolationProps, StackNavigationOptions} from '@react-navigation/stack'; -import type {ThemeStyles} from '@styles/index'; -import type {StyleUtilsType} from '@styles/utils'; -import variables from '@styles/variables'; -import CONFIG from '@src/CONFIG'; -import createModalCardStyleInterpolator from './createModalCardStyleInterpolator'; -import getModalPresentationStyle from './getModalPresentationStyle'; - -type GetOnboardingModalNavigatorOptions = (shouldUseNarrowLayout: boolean) => StackNavigationOptions; - -type ScreenOptions = { - rightModalNavigator: StackNavigationOptions; - onboardingModalNavigator: GetOnboardingModalNavigatorOptions; - leftModalNavigator: StackNavigationOptions; - homeScreen: StackNavigationOptions; - fullScreen: StackNavigationOptions; - centralPaneNavigator: StackNavigationOptions; - bottomTab: StackNavigationOptions; -}; - -const commonScreenOptions: StackNavigationOptions = { - headerShown: false, - gestureDirection: 'horizontal', - animationEnabled: true, - cardOverlayEnabled: true, - animationTypeForReplace: 'push', -}; - -type GetRootNavigatorScreenOptions = (isSmallScreenWidth: boolean, styles: ThemeStyles, StyleUtils: StyleUtilsType) => ScreenOptions; - -const getRootNavigatorScreenOptions: GetRootNavigatorScreenOptions = (isSmallScreenWidth, themeStyles, StyleUtils) => { - const modalCardStyleInterpolator = createModalCardStyleInterpolator(StyleUtils); - - return { - rightModalNavigator: { - ...commonScreenOptions, - cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator(isSmallScreenWidth, false, false, props), - presentation: getModalPresentationStyle(), - - // We want pop in RHP since there are some flows that would work weird otherwise - animationTypeForReplace: 'pop', - cardStyle: { - ...StyleUtils.getNavigationModalCardStyle(), - - // This is necessary to cover translated sidebar with overlay. - width: isSmallScreenWidth ? '100%' : '200%', - // Excess space should be on the left so we need to position from right. - right: 0, - }, - }, - onboardingModalNavigator: (shouldUseNarrowLayout: boolean) => ({ - cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator(isSmallScreenWidth, false, shouldUseNarrowLayout, props), - headerShown: false, - animationEnabled: true, - cardOverlayEnabled: false, - presentation: 'transparentModal', - cardStyle: { - ...StyleUtils.getNavigationModalCardStyle(), - backgroundColor: 'transparent', - width: '100%', - top: 0, - left: 0, - position: 'fixed', - }, - }), - leftModalNavigator: { - ...commonScreenOptions, - cardStyleInterpolator: (props) => modalCardStyleInterpolator(isSmallScreenWidth, false, false, props), - presentation: getModalPresentationStyle(), - gestureDirection: 'horizontal-inverted', - - // We want pop in LHP since there are some flows that would work weird otherwise - animationTypeForReplace: 'pop', - cardStyle: { - ...StyleUtils.getNavigationModalCardStyle(), - - // This is necessary to cover translated sidebar with overlay. - width: isSmallScreenWidth ? '100%' : '200%', - - // LHP should be displayed in place of the sidebar - left: isSmallScreenWidth ? 0 : -variables.sideBarWidth, - }, - }, - homeScreen: { - title: CONFIG.SITE_TITLE, - ...commonScreenOptions, - cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator(isSmallScreenWidth, false, false, props), - - cardStyle: { - ...StyleUtils.getNavigationModalCardStyle(), - width: isSmallScreenWidth ? '100%' : variables.sideBarWidth, - - // We need to shift the sidebar to not be covered by the StackNavigator so it can be clickable. - marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, - ...(isSmallScreenWidth ? {} : themeStyles.borderRight), - }, - }, - - fullScreen: { - ...commonScreenOptions, - cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator(isSmallScreenWidth, true, false, props), - cardStyle: { - ...StyleUtils.getNavigationModalCardStyle(), - - // This is necessary to cover whole screen. Including translated sidebar. - marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, - }, - - // We need to turn off animation for the full screen to avoid delay when closing screens. - animationEnabled: isSmallScreenWidth, - }, - - centralPaneNavigator: { - title: CONFIG.SITE_TITLE, - ...commonScreenOptions, - animationEnabled: isSmallScreenWidth, - cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator(isSmallScreenWidth, true, false, props), - - cardStyle: { - ...StyleUtils.getNavigationModalCardStyle(), - paddingRight: isSmallScreenWidth ? 0 : variables.sideBarWidth, - }, - }, - - bottomTab: { - ...commonScreenOptions, - cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator(isSmallScreenWidth, false, false, props), - - cardStyle: { - ...StyleUtils.getNavigationModalCardStyle(), - width: isSmallScreenWidth ? '100%' : variables.sideBarWidth, - - // We need to shift the sidebar to not be covered by the StackNavigator so it can be clickable. - marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, - ...(isSmallScreenWidth ? {} : themeStyles.borderRight), - }, - }, - }; -}; - -export default getRootNavigatorScreenOptions; diff --git a/src/libs/Navigation/AppNavigator/useModalCardStyleInterpolator.ts b/src/libs/Navigation/AppNavigator/useModalCardStyleInterpolator.ts new file mode 100644 index 000000000000..f4f6179782cc --- /dev/null +++ b/src/libs/Navigation/AppNavigator/useModalCardStyleInterpolator.ts @@ -0,0 +1,66 @@ +import type {StackCardInterpolatedStyle, StackCardInterpolationProps} from '@react-navigation/stack'; +import {Animated} from 'react-native'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useStyleUtils from '@hooks/useStyleUtils'; +import variables from '@styles/variables'; + +type ModalCardStyleInterpolatorProps = { + isOnboardingModal?: boolean; + isFullScreenModal?: boolean; + shouldFadeScreen?: boolean; + props: StackCardInterpolationProps; + outputRangeMultiplier?: number; +}; + +type ModalCardStyleInterpolator = (props: ModalCardStyleInterpolatorProps) => StackCardInterpolatedStyle; + +const useModalCardStyleInterpolator = (): ModalCardStyleInterpolator => { + const {shouldUseNarrowLayout, onboardingIsMediumOrLargerScreenWidth} = useResponsiveLayout(); + const StyleUtils = useStyleUtils(); + + const modalCardStyleInterpolator: ModalCardStyleInterpolator = ({ + props: { + current: {progress}, + inverted, + layouts: {screen}, + }, + isOnboardingModal = false, + isFullScreenModal = false, + shouldFadeScreen = false, + outputRangeMultiplier = 1, + }) => { + if (isOnboardingModal ? onboardingIsMediumOrLargerScreenWidth : shouldFadeScreen) { + return { + cardStyle: { + opacity: progress, + }, + }; + } + + const translateX = Animated.multiply( + progress.interpolate({ + inputRange: [0, 1], + outputRange: [outputRangeMultiplier * (shouldUseNarrowLayout ? screen.width : variables.sideBarWidth), 0], + extrapolate: 'clamp', + }), + inverted, + ); + + const cardStyle = StyleUtils.getCardStyles(screen.width); + + if (!isFullScreenModal || shouldUseNarrowLayout) { + cardStyle.transform = [{translateX}]; + } + + return { + containerStyle: { + overflow: 'hidden', + }, + cardStyle, + }; + }; + + return modalCardStyleInterpolator; +}; + +export default useModalCardStyleInterpolator; diff --git a/src/libs/Navigation/AppNavigator/useModalNavigatorOptions.ts b/src/libs/Navigation/AppNavigator/useModalNavigatorOptions.ts new file mode 100644 index 000000000000..2102d247b079 --- /dev/null +++ b/src/libs/Navigation/AppNavigator/useModalNavigatorOptions.ts @@ -0,0 +1,35 @@ +import {CardStyleInterpolators} from '@react-navigation/stack'; +import type {GestureDirection} from '@react-navigation/stack/lib/typescript/src/types'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; +import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; + +/** + * Modal stack navigator screen options generator function + * @param gestureDirection - The gesture direction of dismissing the modal + * @returns The screen options object + */ +const useModalNavigatorOptions = (gestureDirection: GestureDirection = 'horizontal'): PlatformStackNavigationOptions => { + const themeStyles = useThemeStyles(); + + let universalGestureDirection: PlatformStackNavigationOptions['gestureDirection'] | undefined; + let webGestureDirection: GestureDirection | undefined; + if (gestureDirection === 'horizontal' || gestureDirection === 'vertical') { + universalGestureDirection = gestureDirection; + } else { + webGestureDirection = gestureDirection; + } + + return { + headerShown: false, + animation: Animations.SLIDE_FROM_RIGHT, + gestureDirection: universalGestureDirection, + web: { + cardStyle: themeStyles.navigationScreenCardStyle, + cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, + ...(webGestureDirection && {gestureDirection: webGestureDirection}), + }, + }; +}; + +export default useModalNavigatorOptions; diff --git a/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts b/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts new file mode 100644 index 000000000000..4490cffa1e2f --- /dev/null +++ b/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts @@ -0,0 +1,155 @@ +import type {StackCardInterpolationProps} from '@react-navigation/stack'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useStyleUtils from '@hooks/useStyleUtils'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; +import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; +import variables from '@styles/variables'; +import CONFIG from '@src/CONFIG'; +import hideKeyboardOnSwipe from './hideKeyboardOnSwipe'; +import useModalCardStyleInterpolator from './useModalCardStyleInterpolator'; + +type RootNavigatorOptions = { + rightModalNavigator: PlatformStackNavigationOptions; + onboardingModalNavigator: PlatformStackNavigationOptions; + leftModalNavigator: PlatformStackNavigationOptions; + homeScreen: PlatformStackNavigationOptions; + fullScreen: PlatformStackNavigationOptions; + centralPaneNavigator: PlatformStackNavigationOptions; + bottomTab: PlatformStackNavigationOptions; +}; + +const commonScreenOptions: PlatformStackNavigationOptions = { + web: { + cardOverlayEnabled: true, + }, +}; + +const useRootNavigatorOptions = () => { + const themeStyles = useThemeStyles(); + const StyleUtils = useStyleUtils(); + const {isSmallScreenWidth} = useResponsiveLayout(); + const modalCardStyleInterpolator = useModalCardStyleInterpolator(); + + return { + rightModalNavigator: { + ...commonScreenOptions, + ...hideKeyboardOnSwipe, + animation: Animations.SLIDE_FROM_RIGHT, + // We want pop in RHP since there are some flows that would work weird otherwise + animationTypeForReplace: 'pop', + web: { + presentation: 'transparentModal', + cardStyle: { + ...StyleUtils.getNavigationModalCardStyle(), + // This is necessary to cover translated sidebar with overlay. + width: isSmallScreenWidth ? '100%' : '200%', + // Excess space should be on the left so we need to position from right. + right: 0, + }, + cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props}), + }, + }, + onboardingModalNavigator: { + web: { + presentation: 'transparentModal', + cardOverlayEnabled: false, + cardStyle: { + ...StyleUtils.getNavigationModalCardStyle(), + backgroundColor: 'transparent', + width: '100%', + top: 0, + left: 0, + position: 'fixed', + }, + cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isOnboardingModal: true}), + }, + }, + leftModalNavigator: { + ...commonScreenOptions, + animation: Animations.SLIDE_FROM_LEFT, + animationTypeForReplace: 'pop', + native: { + customAnimationOnGesture: true, + }, + web: { + presentation: 'transparentModal', + cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props}), + // We want pop in LHP since there are some flows that would work weird otherwise + cardStyle: { + ...StyleUtils.getNavigationModalCardStyle(), + + // This is necessary to cover translated sidebar with overlay. + width: isSmallScreenWidth ? '100%' : '200%', + + // LHP should be displayed in place of the sidebar + left: isSmallScreenWidth ? 0 : -variables.sideBarWidth, + }, + }, + }, + homeScreen: { + ...commonScreenOptions, + title: CONFIG.SITE_TITLE, + headerShown: false, + web: { + // Note: The card* properties won't be applied on mobile platforms, as they use the native defaults. + cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props}), + cardStyle: { + ...StyleUtils.getNavigationModalCardStyle(), + width: isSmallScreenWidth ? '100%' : variables.sideBarWidth, + + // We need to shift the sidebar to not be covered by the StackNavigator so it can be clickable. + marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, + ...(isSmallScreenWidth ? {} : themeStyles.borderRight), + }, + }, + }, + + fullScreen: { + ...commonScreenOptions, + // We need to turn off animation for the full screen to avoid delay when closing screens. + animation: isSmallScreenWidth ? Animations.SLIDE_FROM_RIGHT : Animations.NONE, + web: { + cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isFullScreenModal: true}), + cardStyle: { + ...StyleUtils.getNavigationModalCardStyle(), + + // This is necessary to cover whole screen. Including translated sidebar. + marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, + }, + }, + }, + + centralPaneNavigator: { + ...commonScreenOptions, + ...hideKeyboardOnSwipe, + headerShown: false, + title: CONFIG.SITE_TITLE, + animation: isSmallScreenWidth ? undefined : Animations.NONE, + web: { + cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isFullScreenModal: true}), + cardStyle: { + ...StyleUtils.getNavigationModalCardStyle(), + paddingRight: isSmallScreenWidth ? 0 : variables.sideBarWidth, + }, + }, + }, + + bottomTab: { + ...commonScreenOptions, + web: { + cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props}), + cardStyle: { + ...StyleUtils.getNavigationModalCardStyle(), + width: isSmallScreenWidth ? '100%' : variables.sideBarWidth, + + // We need to shift the sidebar to not be covered by the StackNavigator so it can be clickable. + marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, + ...(isSmallScreenWidth ? {} : themeStyles.borderRight), + }, + }, + }, + } satisfies RootNavigatorOptions; +}; + +export default useRootNavigatorOptions; diff --git a/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts b/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts index f7c2140b1117..d31c3693d495 100644 --- a/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts +++ b/src/libs/Navigation/setupCustomAndroidBackHandler/index.android.ts @@ -1,13 +1,13 @@ import {findFocusedRoute, StackActions} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import {BackHandler, NativeModules} from 'react-native'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import getTopmostCentralPaneRoute from '@navigation/getTopmostCentralPaneRoute'; import navigationRef from '@navigation/navigationRef'; import type {BottomTabNavigatorParamList, RootStackParamList, State} from '@navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; -type SearchPageProps = StackScreenProps; +type SearchPageProps = PlatformStackScreenProps; // We need to do some custom handling for the back button on Android for actions related to the search page. function setupCustomAndroidBackHandler() { diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index ae1621f700d9..99fcc4d0c631 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -17,7 +17,7 @@ import type {SaveSearchParams} from '@libs/API/parameters'; import type CONST from '@src/CONST'; import type {Country, IOUAction, IOUType} from '@src/CONST'; import type NAVIGATORS from '@src/NAVIGATORS'; -import type {HybridAppRoute, Route as Routes} from '@src/ROUTES'; +import type {Route as ExpensifyRoute, HybridAppRoute, Route as Routes} from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type EXIT_SURVEY_REASON_FORM_INPUT_IDS from '@src/types/form/ExitSurveyReasonForm'; import type {ConnectionName, SageIntacctMappingName} from '@src/types/onyx/Policy'; @@ -1130,6 +1130,18 @@ type MoneyRequestNavigatorParamList = { backTo?: Routes; currency?: string; }; + [SCREENS.MONEY_REQUEST.HOLD]: { + /** ID of the transaction the page was opened for */ + transactionID: string; + + /** ID of the report that user is providing hold reason to */ + reportID: string; + + /** Link to previous page */ + backTo: ExpensifyRoute; + + searchHash?: number; + }; }; type NewTaskNavigatorParamList = { @@ -1538,6 +1550,18 @@ type SearchReportParamList = { reportID: string; reportActionID?: string; }; + [SCREENS.SEARCH.TRANSACTION_HOLD_REASON_RHP]: { + /** ID of the transaction the page was opened for */ + transactionID: string; + + /** ID of the report that user is providing hold reason to */ + reportID: string; + + /** Link to previous page */ + backTo: ExpensifyRoute; + + searchHash?: number; + }; }; type SearchAdvancedFiltersParamList = { diff --git a/src/pages/ConciergePage.tsx b/src/pages/ConciergePage.tsx index 46f17e76c083..897d1c429799 100644 --- a/src/pages/ConciergePage.tsx +++ b/src/pages/ConciergePage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useRef} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -10,6 +9,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import * as App from '@userActions/App'; import * as Report from '@userActions/Report'; @@ -22,7 +22,7 @@ type ConciergePageOnyxProps = { session: OnyxEntry; }; -type ConciergePageProps = ConciergePageOnyxProps & StackScreenProps; +type ConciergePageProps = ConciergePageOnyxProps & PlatformStackScreenProps; /* * This is a "utility page", that does this: diff --git a/src/pages/Debug/DebugDetailsConstantPickerPage.tsx b/src/pages/Debug/DebugDetailsConstantPickerPage.tsx index a98ef9963542..e195351cc0a4 100644 --- a/src/pages/Debug/DebugDetailsConstantPickerPage.tsx +++ b/src/pages/Debug/DebugDetailsConstantPickerPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import isObject from 'lodash/isObject'; import React, {useMemo, useState} from 'react'; import {View} from 'react-native'; @@ -10,12 +9,13 @@ import type {ListItem} from '@components/SelectionList/types'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {DebugParamList} from '@libs/Navigation/types'; import {appendParam} from '@libs/Url'; import type SCREENS from '@src/SCREENS'; import {DETAILS_CONSTANT_OPTIONS} from './const'; -type DebugDetailsConstantPickerPageProps = StackScreenProps; +type DebugDetailsConstantPickerPageProps = PlatformStackScreenProps; function DebugDetailsConstantPickerPage({ route: { diff --git a/src/pages/Debug/DebugDetailsDateTimePickerPage.tsx b/src/pages/Debug/DebugDetailsDateTimePickerPage.tsx index 920b5b52076c..b2be1429ee5b 100644 --- a/src/pages/Debug/DebugDetailsDateTimePickerPage.tsx +++ b/src/pages/Debug/DebugDetailsDateTimePickerPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {format} from 'date-fns'; import React, {useState} from 'react'; import {View} from 'react-native'; @@ -12,11 +11,12 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import DateUtils from '@libs/DateUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {DebugParamList} from '@libs/Navigation/types'; import {appendParam} from '@libs/Url'; import type SCREENS from '@src/SCREENS'; -type DebugDetailsDateTimePickerPageProps = StackScreenProps; +type DebugDetailsDateTimePickerPageProps = PlatformStackScreenProps; function DebugDetailsDateTimePickerPage({ route: { diff --git a/src/pages/Debug/Report/DebugReportPage.tsx b/src/pages/Debug/Report/DebugReportPage.tsx index 28f4ddf3dc34..136eba8d7ef1 100644 --- a/src/pages/Debug/Report/DebugReportPage.tsx +++ b/src/pages/Debug/Report/DebugReportPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import DebugUtils from '@libs/DebugUtils'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; import OnyxTabNavigator, {TopTab} from '@libs/Navigation/OnyxTabNavigator'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {DebugParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; @@ -27,7 +27,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import DebugReportActions from './DebugReportActions'; -type DebugReportPageProps = StackScreenProps; +type DebugReportPageProps = PlatformStackScreenProps; type Metadata = { title: string; diff --git a/src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx b/src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx index 0b260a8bc93e..429f42b58dda 100644 --- a/src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx +++ b/src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useState} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import DateUtils from '@libs/DateUtils'; import DebugUtils from '@libs/DebugUtils'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {DebugParamList} from '@libs/Navigation/types'; import * as NumberUtils from '@libs/NumberUtils'; import ReportActionItem from '@pages/home/report/ReportActionItem'; @@ -26,7 +26,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {PersonalDetailsList, ReportAction, Session} from '@src/types/onyx'; -type DebugReportActionCreatePageProps = StackScreenProps; +type DebugReportActionCreatePageProps = PlatformStackScreenProps; const getInitialReportAction = (reportID: string, session: OnyxEntry, personalDetailsList: OnyxEntry) => DebugUtils.stringifyJSON({ diff --git a/src/pages/Debug/ReportAction/DebugReportActionPage.tsx b/src/pages/Debug/ReportAction/DebugReportActionPage.tsx index 89377310571e..621e77360358 100644 --- a/src/pages/Debug/ReportAction/DebugReportActionPage.tsx +++ b/src/pages/Debug/ReportAction/DebugReportActionPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -11,6 +10,7 @@ import DebugUtils from '@libs/DebugUtils'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; import OnyxTabNavigator, {TopTab} from '@libs/Navigation/OnyxTabNavigator'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {DebugParamList} from '@libs/Navigation/types'; import DebugDetails from '@pages/Debug/DebugDetails'; import DebugJSON from '@pages/Debug/DebugJSON'; @@ -20,7 +20,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import DebugReportActionPreview from './DebugReportActionPreview'; -type DebugReportActionPageProps = StackScreenProps; +type DebugReportActionPageProps = PlatformStackScreenProps; function DebugReportActionPage({ route: { diff --git a/src/pages/EditReportFieldPage.tsx b/src/pages/EditReportFieldPage.tsx index d7d359d289f4..25023badbd1e 100644 --- a/src/pages/EditReportFieldPage.tsx +++ b/src/pages/EditReportFieldPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useState} from 'react'; import {useOnyx} from 'react-native-onyx'; @@ -14,6 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import isSearchTopmostCentralPane from '@libs/Navigation/isSearchTopmostCentralPane'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {EditRequestNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; @@ -25,7 +25,7 @@ import EditReportFieldDate from './EditReportFieldDate'; import EditReportFieldDropdown from './EditReportFieldDropdown'; import EditReportFieldText from './EditReportFieldText'; -type EditReportFieldPageProps = StackScreenProps; +type EditReportFieldPageProps = PlatformStackScreenProps; function EditReportFieldPage({route}: EditReportFieldPageProps) { const {windowWidth} = useWindowDimensions(); diff --git a/src/pages/FlagCommentPage.tsx b/src/pages/FlagCommentPage.tsx index 49045c66c72b..fbedd5fc6c39 100644 --- a/src/pages/FlagCommentPage.tsx +++ b/src/pages/FlagCommentPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import type {SvgProps} from 'react-native-svg'; @@ -13,6 +12,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FlagCommentNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import * as Report from '@userActions/Report'; @@ -22,7 +22,7 @@ import type SCREENS from '@src/SCREENS'; import withReportAndReportActionOrNotFound from './home/report/withReportAndReportActionOrNotFound'; import type {WithReportAndReportActionOrNotFoundProps} from './home/report/withReportAndReportActionOrNotFound'; -type FlagCommentPageNavigationProps = StackScreenProps; +type FlagCommentPageNavigationProps = PlatformStackScreenProps; type FlagCommentPageProps = WithReportAndReportActionOrNotFoundProps & FlagCommentPageNavigationProps; diff --git a/src/pages/GetAssistancePage.tsx b/src/pages/GetAssistancePage.tsx index 90b7ccbb28d8..aecb78b76a76 100644 --- a/src/pages/GetAssistancePage.tsx +++ b/src/pages/GetAssistancePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as Link from '@userActions/Link'; import * as Report from '@userActions/Report'; @@ -29,7 +29,7 @@ type GetAssistanceOnyxProps = { account: OnyxEntry; }; -type GetAssistancePageProps = GetAssistanceOnyxProps & StackScreenProps; +type GetAssistancePageProps = GetAssistanceOnyxProps & PlatformStackScreenProps; function GetAssistancePage({route, account}: GetAssistancePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/GroupChatNameEditPage.tsx b/src/pages/GroupChatNameEditPage.tsx index 425e8a421cb2..100efb69cae1 100644 --- a/src/pages/GroupChatNameEditPage.tsx +++ b/src/pages/GroupChatNameEditPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; @@ -12,6 +11,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {NewChatNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; @@ -30,7 +30,7 @@ type GroupChatNameEditPageOnyxProps = { }; type GroupChatNameEditPageProps = GroupChatNameEditPageOnyxProps & - Partial> & { + Partial> & { report?: ReportOnyxType; }; diff --git a/src/pages/InviteReportParticipantsPage.tsx b/src/pages/InviteReportParticipantsPage.tsx index 6a5bf6832fd6..b639d984a132 100644 --- a/src/pages/InviteReportParticipantsPage.tsx +++ b/src/pages/InviteReportParticipantsPage.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import type {SectionListData} from 'react-native'; @@ -20,6 +19,7 @@ import * as UserSearchPhraseActions from '@libs/actions/RoomMembersUserSearchPhr import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ParticipantsNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; @@ -44,7 +44,7 @@ type InviteReportParticipantsPageProps = InviteReportParticipantsPageOnyxProps & type Sections = Array>>; function InviteReportParticipantsPage({betas, personalDetails, report, didScreenTransitionEnd}: InviteReportParticipantsPageProps) { - const route = useRoute>(); + const route = useRoute>(); const {options, areOptionsInitialized} = useOptionsList({ shouldInitialize: didScreenTransitionEnd, }); diff --git a/src/pages/LogInWithShortLivedAuthTokenPage.tsx b/src/pages/LogInWithShortLivedAuthTokenPage.tsx index fcbeadaa4a47..9dcd65537353 100644 --- a/src/pages/LogInWithShortLivedAuthTokenPage.tsx +++ b/src/pages/LogInWithShortLivedAuthTokenPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; import {NativeModules} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -6,6 +5,7 @@ import {withOnyx} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {PublicScreensParamList} from '@libs/Navigation/types'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; @@ -21,7 +21,7 @@ type LogInWithShortLivedAuthTokenPageOnyxProps = { account: OnyxEntry; }; -type LogInWithShortLivedAuthTokenPageProps = LogInWithShortLivedAuthTokenPageOnyxProps & StackScreenProps; +type LogInWithShortLivedAuthTokenPageProps = LogInWithShortLivedAuthTokenPageOnyxProps & PlatformStackScreenProps; function LogInWithShortLivedAuthTokenPage({route, account}: LogInWithShortLivedAuthTokenPageProps) { const {email = '', shortLivedAuthToken = '', shortLivedToken = '', authTokenType, exitTo, error} = route?.params ?? {}; diff --git a/src/pages/LogOutPreviousUserPage.tsx b/src/pages/LogOutPreviousUserPage.tsx index deb95a576c3d..bb381bb156ed 100644 --- a/src/pages/LogOutPreviousUserPage.tsx +++ b/src/pages/LogOutPreviousUserPage.tsx @@ -1,10 +1,10 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useContext, useEffect} from 'react'; import {NativeModules} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import {InitialURLContext} from '@components/InitialURLContextProvider'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as SessionUtils from '@libs/SessionUtils'; import Navigation from '@navigation/Navigation'; import type {AuthScreensParamList} from '@navigation/types'; @@ -24,7 +24,7 @@ type LogOutPreviousUserPageOnyxProps = { isAccountLoading: boolean; }; -type LogOutPreviousUserPageProps = LogOutPreviousUserPageOnyxProps & StackScreenProps; +type LogOutPreviousUserPageProps = LogOutPreviousUserPageOnyxProps & PlatformStackScreenProps; // This page is responsible for handling transitions from OldDot. Specifically, it logs the current user // out if the transition is for another user. diff --git a/src/pages/OnboardingEmployees/types.ts b/src/pages/OnboardingEmployees/types.ts index b4cdafced839..84d93e6152a4 100644 --- a/src/pages/OnboardingEmployees/types.ts +++ b/src/pages/OnboardingEmployees/types.ts @@ -1,8 +1,8 @@ -import type {StackScreenProps} from '@react-navigation/stack'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types'; import type SCREENS from '@src/SCREENS'; -type OnboardingEmployeesProps = StackScreenProps; +type OnboardingEmployeesProps = PlatformStackScreenProps; type BaseOnboardingEmployeesProps = OnboardingEmployeesProps & { /* Whether to use native styles tailored for native devices */ diff --git a/src/pages/OnboardingPersonalDetails/types.ts b/src/pages/OnboardingPersonalDetails/types.ts index 79aca4af4639..e8b99d949fa7 100644 --- a/src/pages/OnboardingPersonalDetails/types.ts +++ b/src/pages/OnboardingPersonalDetails/types.ts @@ -1,16 +1,14 @@ -import type {RouteProp} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types'; import type SCREENS from '@src/SCREENS'; -type OnboardingPersonalDetailsProps = Record & StackScreenProps; +type OnboardingPersonalDetailsProps = Record & PlatformStackScreenProps; -type BaseOnboardingPersonalDetailsProps = WithCurrentUserPersonalDetailsProps & { - /* Whether to use native styles tailored for native devices */ - shouldUseNativeStyles: boolean; - - route: RouteProp; -}; +type BaseOnboardingPersonalDetailsProps = WithCurrentUserPersonalDetailsProps & + PlatformStackScreenProps & { + /* Whether to use native styles tailored for native devices */ + shouldUseNativeStyles: boolean; + }; export type {OnboardingPersonalDetailsProps, BaseOnboardingPersonalDetailsProps}; diff --git a/src/pages/OnboardingPurpose/types.ts b/src/pages/OnboardingPurpose/types.ts index 7a61196fd328..8f2f99b97e56 100644 --- a/src/pages/OnboardingPurpose/types.ts +++ b/src/pages/OnboardingPurpose/types.ts @@ -1,8 +1,8 @@ -import type {StackScreenProps} from '@react-navigation/stack'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types'; import type SCREENS from '@src/SCREENS'; -type OnboardingPurposeProps = Record & StackScreenProps; +type OnboardingPurposeProps = Record & PlatformStackScreenProps; type BaseOnboardingPurposeProps = OnboardingPurposeProps & { /* Whether to use native styles tailored for native devices */ diff --git a/src/pages/PrivateNotes/PrivateNotesEditPage.tsx b/src/pages/PrivateNotes/PrivateNotesEditPage.tsx index ac8eb7f862b6..5dd4275e5fa1 100644 --- a/src/pages/PrivateNotes/PrivateNotesEditPage.tsx +++ b/src/pages/PrivateNotes/PrivateNotesEditPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import lodashDebounce from 'lodash/debounce'; import React, {useCallback, useMemo, useRef, useState} from 'react'; @@ -18,6 +17,7 @@ import useHtmlPaste from '@hooks/useHtmlPaste'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {PrivateNotesNavigatorParamList} from '@libs/Navigation/types'; import Parser from '@libs/Parser'; import * as ReportUtils from '@libs/ReportUtils'; @@ -41,7 +41,7 @@ type PrivateNotesEditPageOnyxProps = { type PrivateNotesEditPageProps = WithReportAndPrivateNotesOrNotFoundProps & PrivateNotesEditPageOnyxProps & - StackScreenProps & { + PlatformStackScreenProps & { /** The report currently being looked at */ report: Report; }; diff --git a/src/pages/PrivateNotes/PrivateNotesListPage.tsx b/src/pages/PrivateNotes/PrivateNotesListPage.tsx index 424cc3e14683..534907a0a79c 100644 --- a/src/pages/PrivateNotes/PrivateNotesListPage.tsx +++ b/src/pages/PrivateNotes/PrivateNotesListPage.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useCallback, useMemo} from 'react'; import {useOnyx} from 'react-native-onyx'; @@ -12,6 +11,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {PrivateNotesNavigatorParamList} from '@libs/Navigation/types'; import type {WithReportAndPrivateNotesOrNotFoundProps} from '@pages/home/report/withReportAndPrivateNotesOrNotFound'; import withReportAndPrivateNotesOrNotFound from '@pages/home/report/withReportAndPrivateNotesOrNotFound'; @@ -37,7 +37,7 @@ type NoteListItem = { }; function PrivateNotesListPage({report, session}: PrivateNotesListPageProps) { - const route = useRoute>(); + const route = useRoute>(); const backTo = route.params.backTo; const [personalDetailsList] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const styles = useThemeStyles(); diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index f54a9c6ec601..c65da331c966 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useEffect, useMemo} from 'react'; import {View} from 'react-native'; @@ -24,6 +23,7 @@ import UserDetailsTooltip from '@components/UserDetailsTooltip'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import {parsePhoneNumber} from '@libs/PhoneNumber'; import * as ReportUtils from '@libs/ReportUtils'; @@ -43,7 +43,7 @@ import type {PersonalDetails, Report} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import mapOnyxCollectionItems from '@src/utils/mapOnyxCollectionItems'; -type ProfilePageProps = StackScreenProps; +type ProfilePageProps = PlatformStackScreenProps; /** * Gets the phone number to display for SMS logins diff --git a/src/pages/ReferralDetailsPage.tsx b/src/pages/ReferralDetailsPage.tsx index d8a27e171933..76dac1aca1a8 100644 --- a/src/pages/ReferralDetailsPage.tsx +++ b/src/pages/ReferralDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useRef} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Clipboard from '@libs/Clipboard'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReferralDetailsNavigatorParamList} from '@libs/Navigation/types'; import * as Link from '@userActions/Link'; import CONST from '@src/CONST'; @@ -29,7 +29,7 @@ type ReferralDetailsPageOnyxProps = { account: OnyxEntry; }; -type ReferralDetailsPageProps = ReferralDetailsPageOnyxProps & StackScreenProps; +type ReferralDetailsPageProps = ReferralDetailsPageOnyxProps & PlatformStackScreenProps; function ReferralDetailsPage({route, account}: ReferralDetailsPageProps) { const theme = useTheme(); diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index 11820cd2c471..4169851dfc3c 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -1,5 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import lodashPick from 'lodash/pick'; import React, {useEffect, useRef, useState} from 'react'; @@ -19,6 +17,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import getPlaidOAuthReceivedRedirectURI from '@libs/getPlaidOAuthReceivedRedirectURI'; import BankAccount from '@libs/models/BankAccount'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp, PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReimbursementAccountNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import shouldReopenOnfido from '@libs/shouldReopenOnfido'; @@ -41,7 +40,7 @@ import ContinueBankAccountSetup from './ContinueBankAccountSetup'; import EnableBankAccount from './EnableBankAccount/EnableBankAccount'; import RequestorStep from './RequestorStep'; -type ReimbursementAccountPageProps = WithPolicyOnyxProps & StackScreenProps; +type ReimbursementAccountPageProps = WithPolicyOnyxProps & PlatformStackScreenProps; const ROUTE_NAMES = { COMPANY: 'company', @@ -57,7 +56,7 @@ const ROUTE_NAMES = { * We can pass stepToOpen in the URL to force which step to show. * Mainly needed when user finished the flow in verifying state, and Ops ask them to modify some fields from a specific step. */ -function getStepToOpenFromRouteParams(route: RouteProp): TBankAccountStep | '' { +function getStepToOpenFromRouteParams(route: PlatformStackRouteProp): TBankAccountStep | '' { switch (route.params.stepToOpen) { case ROUTE_NAMES.NEW: return CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT; diff --git a/src/pages/ReportAvatar.tsx b/src/pages/ReportAvatar.tsx index b9a91705a401..ac139e58a9ff 100644 --- a/src/pages/ReportAvatar.tsx +++ b/src/pages/ReportAvatar.tsx @@ -1,8 +1,8 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {useOnyx} from 'react-native-onyx'; import AttachmentModal from '@components/AttachmentModal'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import * as UserUtils from '@libs/UserUtils'; @@ -10,7 +10,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ReportAvatarProps = StackScreenProps; +type ReportAvatarProps = PlatformStackScreenProps; function ReportAvatar({route}: ReportAvatarProps) { const reportIDFromRoute = route.params?.reportID ?? '-1'; diff --git a/src/pages/ReportDescriptionPage.tsx b/src/pages/ReportDescriptionPage.tsx index 6062ef748f36..0aabe5ad5d58 100644 --- a/src/pages/ReportDescriptionPage.tsx +++ b/src/pages/ReportDescriptionPage.tsx @@ -1,5 +1,5 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import type {ReportDescriptionNavigatorParamList} from '@navigation/types'; import type SCREENS from '@src/SCREENS'; @@ -8,7 +8,7 @@ import withReportOrNotFound from './home/report/withReportOrNotFound'; import RoomDescriptionPage from './RoomDescriptionPage'; import TaskDescriptionPage from './tasks/TaskDescriptionPage'; -type ReportDescriptionPageProps = WithReportOrNotFoundProps & StackScreenProps; +type ReportDescriptionPageProps = WithReportOrNotFoundProps & PlatformStackScreenProps; function ReportDescriptionPage(props: ReportDescriptionPageProps) { const isTask = ReportUtils.isTaskReport(props.report); diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 6bc3a25f28ef..3f7f36bb92a5 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; @@ -30,6 +29,7 @@ import useNetwork from '@hooks/useNetwork'; import usePaginatedReportActions from '@hooks/usePaginatedReportActions'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportDetailsNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -65,7 +65,7 @@ type ReportDetailsPageMenuItem = { shouldShowRightIcon?: boolean; }; -type ReportDetailsPageProps = WithReportOrNotFoundProps & StackScreenProps; +type ReportDetailsPageProps = WithReportOrNotFoundProps & PlatformStackScreenProps; const CASES = { DEFAULT: 'default', diff --git a/src/pages/ReportParticipantDetailsPage.tsx b/src/pages/ReportParticipantDetailsPage.tsx index db978b70cad8..342449ae2bef 100644 --- a/src/pages/ReportParticipantDetailsPage.tsx +++ b/src/pages/ReportParticipantDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -18,6 +17,7 @@ import useLocalize from '@hooks/useLocalize'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Report from '@libs/actions/Report'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import Navigation from '@navigation/Navigation'; @@ -37,7 +37,7 @@ type ReportParticipantDetailsOnyxProps = { }; type ReportParticipantDetailsPageProps = WithReportOrNotFoundProps & - StackScreenProps & + PlatformStackScreenProps & ReportParticipantDetailsOnyxProps; function ReportParticipantDetails({personalDetails, report, route}: ReportParticipantDetailsPageProps) { diff --git a/src/pages/ReportParticipantRoleSelectionPage.tsx b/src/pages/ReportParticipantRoleSelectionPage.tsx index 17b84e8903ea..95b3f88e9e37 100644 --- a/src/pages/ReportParticipantRoleSelectionPage.tsx +++ b/src/pages/ReportParticipantRoleSelectionPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import type {ValueOf} from 'type-fest'; @@ -10,6 +9,7 @@ import type {ListItem} from '@components/SelectionList/types'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Report from '@libs/actions/Report'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import Navigation from '@navigation/Navigation'; import type {ParticipantsNavigatorParamList} from '@navigation/types'; import CONST from '@src/CONST'; @@ -19,7 +19,7 @@ import NotFoundPage from './ErrorPage/NotFoundPage'; import withReportOrNotFound from './home/report/withReportOrNotFound'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; -type ReportParticipantRoleSelectionPageProps = WithReportOrNotFoundProps & StackScreenProps; +type ReportParticipantRoleSelectionPageProps = WithReportOrNotFoundProps & PlatformStackScreenProps; type ListItemType = ListItem & { value: ValueOf; diff --git a/src/pages/ReportParticipantsPage.tsx b/src/pages/ReportParticipantsPage.tsx index b4eebb9b76f7..f6d35660fc40 100755 --- a/src/pages/ReportParticipantsPage.tsx +++ b/src/pages/ReportParticipantsPage.tsx @@ -1,5 +1,4 @@ import {useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {InteractionManager, View} from 'react-native'; import type {TextInput} from 'react-native'; @@ -29,6 +28,7 @@ import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as Report from '@libs/actions/Report'; import * as UserSearchPhraseActions from '@libs/actions/RoomMembersUserSearchPhrase'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ParticipantsNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; @@ -42,7 +42,7 @@ import withReportOrNotFound from './home/report/withReportOrNotFound'; type MemberOption = Omit & {accountID: number}; -type ReportParticipantsPageProps = WithReportOrNotFoundProps & StackScreenProps; +type ReportParticipantsPageProps = WithReportOrNotFoundProps & PlatformStackScreenProps; function ReportParticipantsPage({report, route}: ReportParticipantsPageProps) { const backTo = route.params.backTo; const [selectedMembers, setSelectedMembers] = useState([]); diff --git a/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx b/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx index a9cee3236ad0..bcb46c781262 100644 --- a/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx +++ b/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx @@ -1,7 +1,7 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {useOnyx} from 'react-native-onyx'; import usePolicy from '@hooks/usePolicy'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {RestrictedActionParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -11,7 +11,7 @@ import WorkspaceAdminRestrictedAction from './WorkspaceAdminRestrictedAction'; import WorkspaceOwnerRestrictedAction from './WorkspaceOwnerRestrictedAction'; import WorkspaceUserRestrictedAction from './WorkspaceUserRestrictedAction'; -type WorkspaceRestrictedActionPageProps = StackScreenProps; +type WorkspaceRestrictedActionPageProps = PlatformStackScreenProps; function WorkspaceRestrictedActionPage({ route: { diff --git a/src/pages/RoomDescriptionPage.tsx b/src/pages/RoomDescriptionPage.tsx index a70f17d1468c..c5f8e8d01421 100644 --- a/src/pages/RoomDescriptionPage.tsx +++ b/src/pages/RoomDescriptionPage.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useFocusEffect, useRoute} from '@react-navigation/native'; import React, {useCallback, useRef, useState} from 'react'; import {View} from 'react-native'; @@ -15,6 +14,7 @@ import type {BaseTextInputRef} from '@components/TextInput/BaseTextInput/types'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportDescriptionNavigatorParamList} from '@libs/Navigation/types'; import Parser from '@libs/Parser'; import * as ReportUtils from '@libs/ReportUtils'; @@ -37,7 +37,7 @@ type RoomDescriptionPageProps = { }; function RoomDescriptionPage({report, policies}: RoomDescriptionPageProps) { - const route = useRoute>(); + const route = useRoute>(); const backTo = route.params.backTo; const styles = useThemeStyles(); const [description, setDescription] = useState(() => Parser.htmlToMarkdown(report?.description ?? '')); diff --git a/src/pages/RoomInvitePage.tsx b/src/pages/RoomInvitePage.tsx index c833fdb68ae6..b943ceec9a36 100644 --- a/src/pages/RoomInvitePage.tsx +++ b/src/pages/RoomInvitePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import type {SectionListData} from 'react-native'; @@ -24,6 +23,7 @@ import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import HttpUtils from '@libs/HttpUtils'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {RoomMembersNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; @@ -40,7 +40,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; import withReportOrNotFound from './home/report/withReportOrNotFound'; -type RoomInvitePageProps = WithReportOrNotFoundProps & WithNavigationTransitionEndProps & StackScreenProps; +type RoomInvitePageProps = WithReportOrNotFoundProps & WithNavigationTransitionEndProps & PlatformStackScreenProps; type Sections = Array>>; function RoomInvitePage({ diff --git a/src/pages/RoomMemberDetailsPage.tsx b/src/pages/RoomMemberDetailsPage.tsx index 475cf37a8847..ae0c8ffa1cdc 100644 --- a/src/pages/RoomMemberDetailsPage.tsx +++ b/src/pages/RoomMemberDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import useLocalize from '@hooks/useLocalize'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Report from '@libs/actions/Report'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {RoomMembersNavigatorParamList} from '@libs/Navigation/types'; import Navigation from '@navigation/Navigation'; import CONST from '@src/CONST'; @@ -26,7 +26,7 @@ import NotFoundPage from './ErrorPage/NotFoundPage'; import withReportOrNotFound from './home/report/withReportOrNotFound'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; -type RoomMemberDetailsPagePageProps = WithReportOrNotFoundProps & StackScreenProps; +type RoomMemberDetailsPagePageProps = WithReportOrNotFoundProps & PlatformStackScreenProps; function RoomMemberDetailsPage({report, route}: RoomMemberDetailsPagePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/RoomMembersPage.tsx b/src/pages/RoomMembersPage.tsx index b5d424b7fc57..292e7dab6851 100644 --- a/src/pages/RoomMembersPage.tsx +++ b/src/pages/RoomMembersPage.tsx @@ -1,6 +1,4 @@ -import type {RouteProp} from '@react-navigation/native'; import {useIsFocused, useRoute} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {InteractionManager, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -29,6 +27,7 @@ import * as UserSearchPhraseActions from '@libs/actions/RoomMembersUserSearchPhr import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp, PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {RoomMembersNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; @@ -44,10 +43,10 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; import withReportOrNotFound from './home/report/withReportOrNotFound'; -type RoomMembersPageProps = WithReportOrNotFoundProps & WithCurrentUserPersonalDetailsProps & StackScreenProps; +type RoomMembersPageProps = WithReportOrNotFoundProps & WithCurrentUserPersonalDetailsProps & PlatformStackScreenProps; function RoomMembersPage({report, policies}: RoomMembersPageProps) { - const route = useRoute>(); + const route = useRoute>(); const styles = useThemeStyles(); const [session] = useOnyx(ONYXKEYS.SESSION); const currentUserAccountID = Number(session?.accountID); diff --git a/src/pages/Search/SearchHoldReasonPage.tsx b/src/pages/Search/SearchHoldReasonPage.tsx index edd85e78cec2..229f7d7e6994 100644 --- a/src/pages/Search/SearchHoldReasonPage.tsx +++ b/src/pages/Search/SearchHoldReasonPage.tsx @@ -1,9 +1,9 @@ -import type {RouteProp} from '@react-navigation/native'; import React, {useCallback, useEffect} from 'react'; import type {FormInputErrors, FormOnyxValues} from '@components/Form/types'; import {useSearchContext} from '@components/Search/SearchContext'; import useLocalize from '@hooks/useLocalize'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ValidationUtils from '@libs/ValidationUtils'; import HoldReasonFormView from '@pages/iou/HoldReasonFormView'; import * as FormActions from '@userActions/FormActions'; @@ -19,7 +19,7 @@ type SearchHoldReasonPageRouteParams = { type SearchHoldReasonPageProps = { /** Navigation route context info provided by react navigation */ - route: RouteProp<{params?: SearchHoldReasonPageRouteParams}>; + route: PlatformStackRouteProp<{params?: SearchHoldReasonPageRouteParams}>; }; function SearchHoldReasonPage({route}: SearchHoldReasonPageProps) { diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 82c502febaf8..a1bd04a7e71b 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -8,12 +7,13 @@ import SearchStatusBar from '@components/Search/SearchStatusBar'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import * as SearchUtils from '@libs/SearchUtils'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type SearchPageProps = StackScreenProps; +type SearchPageProps = PlatformStackScreenProps; function SearchPage({route}: SearchPageProps) { const {shouldUseNarrowLayout} = useResponsiveLayout(); diff --git a/src/pages/TransactionDuplicate/Confirmation.tsx b/src/pages/TransactionDuplicate/Confirmation.tsx index 87748a9697a7..12e3360c7ff8 100644 --- a/src/pages/TransactionDuplicate/Confirmation.tsx +++ b/src/pages/TransactionDuplicate/Confirmation.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; @@ -19,6 +18,7 @@ import useLocalize from '@hooks/useLocalize'; import useReviewDuplicatesNavigation from '@hooks/useReviewDuplicatesNavigation'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import variables from '@styles/variables'; import * as IOU from '@src/libs/actions/IOU'; @@ -35,7 +35,7 @@ import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; function Confirmation() { const styles = useThemeStyles(); const {translate} = useLocalize(); - const route = useRoute>(); + const route = useRoute>(); const currentUserPersonalDetails = useCurrentUserPersonalDetails(); const [reviewDuplicates, reviewDuplicatesResult] = useOnyx(ONYXKEYS.REVIEW_DUPLICATES); const transaction = useMemo(() => TransactionUtils.buildNewTransactionAfterReviewingDuplicates(reviewDuplicates), [reviewDuplicates]); diff --git a/src/pages/TransactionDuplicate/Review.tsx b/src/pages/TransactionDuplicate/Review.tsx index e61f9382b895..cb27ecfcbb3c 100644 --- a/src/pages/TransactionDuplicate/Review.tsx +++ b/src/pages/TransactionDuplicate/Review.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useMemo} from 'react'; import {View} from 'react-native'; @@ -12,6 +11,7 @@ import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; @@ -25,7 +25,7 @@ import DuplicateTransactionsList from './DuplicateTransactionsList'; function TransactionDuplicateReview() { const styles = useThemeStyles(); const {translate} = useLocalize(); - const route = useRoute>(); + const route = useRoute>(); const currentPersonalDetails = useCurrentUserPersonalDetails(); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`); const reportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1'); diff --git a/src/pages/TransactionDuplicate/ReviewBillable.tsx b/src/pages/TransactionDuplicate/ReviewBillable.tsx index 666741daf303..2473c18a5551 100644 --- a/src/pages/TransactionDuplicate/ReviewBillable.tsx +++ b/src/pages/TransactionDuplicate/ReviewBillable.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -6,6 +5,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useReviewDuplicatesNavigation from '@hooks/useReviewDuplicatesNavigation'; import {setReviewDuplicatesKey} from '@libs/actions/Transaction'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as TransactionUtils from '@libs/TransactionUtils'; import type SCREENS from '@src/SCREENS'; @@ -13,7 +13,7 @@ import type {FieldItemType} from './ReviewFields'; import ReviewFields from './ReviewFields'; function ReviewBillable() { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); const compareResult = TransactionUtils.compareDuplicateTransactionFields(transactionID); diff --git a/src/pages/TransactionDuplicate/ReviewCategory.tsx b/src/pages/TransactionDuplicate/ReviewCategory.tsx index 09cbdcd28327..05e90733d6bd 100644 --- a/src/pages/TransactionDuplicate/ReviewCategory.tsx +++ b/src/pages/TransactionDuplicate/ReviewCategory.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -6,6 +5,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useReviewDuplicatesNavigation from '@hooks/useReviewDuplicatesNavigation'; import {setReviewDuplicatesKey} from '@libs/actions/Transaction'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as TransactionUtils from '@libs/TransactionUtils'; import type SCREENS from '@src/SCREENS'; @@ -13,7 +13,7 @@ import type {FieldItemType} from './ReviewFields'; import ReviewFields from './ReviewFields'; function ReviewCategory() { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); const compareResult = TransactionUtils.compareDuplicateTransactionFields(transactionID); diff --git a/src/pages/TransactionDuplicate/ReviewDescription.tsx b/src/pages/TransactionDuplicate/ReviewDescription.tsx index 3d74d8cc36e1..cc4648acd667 100644 --- a/src/pages/TransactionDuplicate/ReviewDescription.tsx +++ b/src/pages/TransactionDuplicate/ReviewDescription.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -6,6 +5,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useReviewDuplicatesNavigation from '@hooks/useReviewDuplicatesNavigation'; import {setReviewDuplicatesKey} from '@libs/actions/Transaction'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as TransactionUtils from '@libs/TransactionUtils'; import type SCREENS from '@src/SCREENS'; @@ -13,7 +13,7 @@ import type {FieldItemType} from './ReviewFields'; import ReviewFields from './ReviewFields'; function ReviewDescription() { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); const compareResult = TransactionUtils.compareDuplicateTransactionFields(transactionID); diff --git a/src/pages/TransactionDuplicate/ReviewMerchant.tsx b/src/pages/TransactionDuplicate/ReviewMerchant.tsx index 47dd43d1d334..657bbae7ce86 100644 --- a/src/pages/TransactionDuplicate/ReviewMerchant.tsx +++ b/src/pages/TransactionDuplicate/ReviewMerchant.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -6,6 +5,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useReviewDuplicatesNavigation from '@hooks/useReviewDuplicatesNavigation'; import {setReviewDuplicatesKey} from '@libs/actions/Transaction'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as TransactionUtils from '@libs/TransactionUtils'; import type SCREENS from '@src/SCREENS'; @@ -13,7 +13,7 @@ import type {FieldItemType} from './ReviewFields'; import ReviewFields from './ReviewFields'; function ReviewMerchant() { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); const compareResult = TransactionUtils.compareDuplicateTransactionFields(transactionID); diff --git a/src/pages/TransactionDuplicate/ReviewReimbursable.tsx b/src/pages/TransactionDuplicate/ReviewReimbursable.tsx index 0b932e8085db..922f35d4e861 100644 --- a/src/pages/TransactionDuplicate/ReviewReimbursable.tsx +++ b/src/pages/TransactionDuplicate/ReviewReimbursable.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -6,6 +5,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useReviewDuplicatesNavigation from '@hooks/useReviewDuplicatesNavigation'; import {setReviewDuplicatesKey} from '@libs/actions/Transaction'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as TransactionUtils from '@libs/TransactionUtils'; import type SCREENS from '@src/SCREENS'; @@ -13,7 +13,7 @@ import type {FieldItemType} from './ReviewFields'; import ReviewFields from './ReviewFields'; function ReviewReimbursable() { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); const compareResult = TransactionUtils.compareDuplicateTransactionFields(transactionID); diff --git a/src/pages/TransactionDuplicate/ReviewTag.tsx b/src/pages/TransactionDuplicate/ReviewTag.tsx index 03fb627abd8e..5d8fe2192e89 100644 --- a/src/pages/TransactionDuplicate/ReviewTag.tsx +++ b/src/pages/TransactionDuplicate/ReviewTag.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -6,6 +5,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useReviewDuplicatesNavigation from '@hooks/useReviewDuplicatesNavigation'; import {setReviewDuplicatesKey} from '@libs/actions/Transaction'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; @@ -14,7 +14,7 @@ import type {FieldItemType} from './ReviewFields'; import ReviewFields from './ReviewFields'; function ReviewTag() { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); diff --git a/src/pages/TransactionDuplicate/ReviewTaxCode.tsx b/src/pages/TransactionDuplicate/ReviewTaxCode.tsx index 78b7c1934715..109b0d96665c 100644 --- a/src/pages/TransactionDuplicate/ReviewTaxCode.tsx +++ b/src/pages/TransactionDuplicate/ReviewTaxCode.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useCallback, useMemo} from 'react'; import {useOnyx} from 'react-native-onyx'; @@ -8,6 +7,7 @@ import useLocalize from '@hooks/useLocalize'; import useReviewDuplicatesNavigation from '@hooks/useReviewDuplicatesNavigation'; import {setReviewDuplicatesKey} from '@libs/actions/Transaction'; import * as CurrencyUtils from '@libs/CurrencyUtils'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; @@ -18,7 +18,7 @@ import type {FieldItemType} from './ReviewFields'; import ReviewFields from './ReviewFields'; function ReviewTaxRate() { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`); const policy = PolicyUtils.getPolicy(report?.policyID ?? ''); diff --git a/src/pages/TransactionReceiptPage.tsx b/src/pages/TransactionReceiptPage.tsx index c05d90a180e1..a933842d7ebe 100644 --- a/src/pages/TransactionReceiptPage.tsx +++ b/src/pages/TransactionReceiptPage.tsx @@ -1,8 +1,8 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; import {useOnyx} from 'react-native-onyx'; import AttachmentModal from '@components/AttachmentModal'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, RootStackParamList, State} from '@libs/Navigation/types'; import * as ReceiptUtils from '@libs/ReceiptUtils'; import * as ReportActionUtils from '@libs/ReportActionsUtils'; @@ -16,7 +16,7 @@ import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; -type TransactionReceiptProps = StackScreenProps; +type TransactionReceiptProps = PlatformStackScreenProps; function TransactionReceipt({route}: TransactionReceiptProps) { const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID ?? '-1'}`); diff --git a/src/pages/UnlinkLoginPage.tsx b/src/pages/UnlinkLoginPage.tsx index 9869e4a70e68..8ef7c9a19979 100644 --- a/src/pages/UnlinkLoginPage.tsx +++ b/src/pages/UnlinkLoginPage.tsx @@ -1,10 +1,10 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import usePrevious from '@hooks/usePrevious'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {PublicScreensParamList} from '@navigation/types'; import * as Session from '@userActions/Session'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -16,7 +16,7 @@ type UnlinkLoginPageOnyxProps = { account: OnyxEntry; }; -type UnlinkLoginPageProps = UnlinkLoginPageOnyxProps & StackScreenProps; +type UnlinkLoginPageProps = UnlinkLoginPageOnyxProps & PlatformStackScreenProps; function UnlinkLoginPage({route, account}: UnlinkLoginPageProps) { const accountID = route.params.accountID ?? -1; diff --git a/src/pages/ValidateLoginPage/types.ts b/src/pages/ValidateLoginPage/types.ts index a42eec7131db..f6f057ba66aa 100644 --- a/src/pages/ValidateLoginPage/types.ts +++ b/src/pages/ValidateLoginPage/types.ts @@ -1,7 +1,7 @@ -import type {StackScreenProps} from '@react-navigation/stack'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {PublicScreensParamList} from '@libs/Navigation/types'; import type SCREENS from '@src/SCREENS'; -type ValidateLoginPageProps = StackScreenProps; +type ValidateLoginPageProps = PlatformStackScreenProps; export default ValidateLoginPageProps; diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 4a87d51e3c82..ed23c15ce496 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -1,6 +1,5 @@ import {PortalHost} from '@gorhom/portal'; import {useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import lodashIsEqual from 'lodash/isEqual'; import React, {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'; import type {FlatList, ViewStyle} from 'react-native'; @@ -32,6 +31,7 @@ import useViewportOffsetTop from '@hooks/useViewportOffsetTop'; import Timing from '@libs/actions/Timing'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import clearReportNotifications from '@libs/Notification/clearReportNotifications'; import Performance from '@libs/Performance'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; @@ -56,7 +56,7 @@ import ReportFooter from './report/ReportFooter'; import type {ActionListContextType, ReactionListRef, ScrollPosition} from './ReportScreenContext'; import {ActionListContext, ReactionListContext} from './ReportScreenContext'; -type ReportScreenNavigationProps = StackScreenProps; +type ReportScreenNavigationProps = PlatformStackScreenProps; type ReportScreenProps = CurrentReportIDContextValue & ReportScreenNavigationProps; diff --git a/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx b/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx index 2850ed0538db..47177d60b743 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx +++ b/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx @@ -242,4 +242,4 @@ export default withOnyx, Su key: ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE, selector: EmojiUtils.getPreferredSkinToneIndex, }, -})(forwardRef(SuggestionEmoji)); +})(forwardRef(SuggestionEmoji)); \ No newline at end of file diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 76ba6426929b..e3612cbc8d60 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -1,6 +1,5 @@ import type {ListRenderItemInfo} from '@react-native/virtualized-lists/Lists/VirtualizedList'; import {useIsFocused, useRoute} from '@react-navigation/native'; -import type {RouteProp} from '@react-navigation/native'; // eslint-disable-next-line lodash/import-scope import type {DebouncedFunc} from 'lodash'; import React, {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'; @@ -20,6 +19,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import DateUtils from '@libs/DateUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import Visibility from '@libs/Visibility'; @@ -162,7 +162,7 @@ function ReportActionsList({ const {isInNarrowPaneModal, shouldUseNarrowLayout} = useResponsiveLayout(); const {isOffline} = useNetwork(); - const route = useRoute>(); + const route = useRoute>(); const reportScrollManager = useReportScrollManager(); const userActiveSince = useRef(DateUtils.getDBTime()); const lastMessageTime = useRef(null); diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 8896611905ca..d857608e278c 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useIsFocused, useRoute} from '@react-navigation/native'; import lodashIsEqual from 'lodash/isEqual'; import React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react'; @@ -12,6 +11,7 @@ import usePrevious from '@hooks/usePrevious'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import DateUtils from '@libs/DateUtils'; import getIsReportFullyVisible from '@libs/getIsReportFullyVisible'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import * as NumberUtils from '@libs/NumberUtils'; import {generateNewRandomInt} from '@libs/NumberUtils'; @@ -87,7 +87,7 @@ function ReportActionsView({ }: ReportActionsViewProps) { useCopySelectionHelper(); const reactionListRef = useContext(ReactionListContext); - const route = useRoute>(); + const route = useRoute>(); const [session] = useOnyx(ONYXKEYS.SESSION); const [transactionThreadReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID ?? -1}`, { selector: (reportActions: OnyxEntry) => ReportActionsUtils.getSortedReportActionsForDisplay(reportActions, true), diff --git a/src/pages/home/report/ReportAttachments.tsx b/src/pages/home/report/ReportAttachments.tsx index d30d8e9aabc1..97a4a6615260 100644 --- a/src/pages/home/report/ReportAttachments.tsx +++ b/src/pages/home/report/ReportAttachments.tsx @@ -1,17 +1,17 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {useOnyx} from 'react-native-onyx'; import AttachmentModal from '@components/AttachmentModal'; import type {Attachment} from '@components/Attachments/types'; import ComposerFocusManager from '@libs/ComposerFocusManager'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ReportAttachmentsProps = StackScreenProps; +type ReportAttachmentsProps = PlatformStackScreenProps; function ReportAttachments({route}: ReportAttachmentsProps) { const reportID = route.params.reportID; diff --git a/src/pages/home/report/ReportDetailsExportPage.tsx b/src/pages/home/report/ReportDetailsExportPage.tsx index 0da9a7c1bb8e..b7b66a356a86 100644 --- a/src/pages/home/report/ReportDetailsExportPage.tsx +++ b/src/pages/home/report/ReportDetailsExportPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -13,6 +12,7 @@ import SelectionScreen from '@components/SelectionScreen'; import useLocalize from '@hooks/useLocalize'; import * as ReportActions from '@libs/actions/Report'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportDetailsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; @@ -20,7 +20,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ReportDetailsExportPageProps = StackScreenProps; +type ReportDetailsExportPageProps = PlatformStackScreenProps; type ExportType = ValueOf; diff --git a/src/pages/home/report/ReportDetailsShareCodePage.tsx b/src/pages/home/report/ReportDetailsShareCodePage.tsx index 4caa29209fa9..2f95572067c3 100644 --- a/src/pages/home/report/ReportDetailsShareCodePage.tsx +++ b/src/pages/home/report/ReportDetailsShareCodePage.tsx @@ -1,7 +1,7 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportDetailsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -18,7 +18,7 @@ type ReportDetailsShareCodePageOnyxProps = { type ReportDetailsShareCodePageProps = ReportDetailsShareCodePageOnyxProps & WithReportOrNotFoundProps & - StackScreenProps; + PlatformStackScreenProps; function ReportDetailsShareCodePage({report, policy, route}: ReportDetailsShareCodePageProps) { if (ReportUtils.isSelfDM(report)) { diff --git a/src/pages/home/report/UserTypingEventListener.tsx b/src/pages/home/report/UserTypingEventListener.tsx index fa0eed4d57c5..73062902f63e 100644 --- a/src/pages/home/report/UserTypingEventListener.tsx +++ b/src/pages/home/report/UserTypingEventListener.tsx @@ -1,9 +1,9 @@ -import type {RouteProp} from '@react-navigation/native'; import {useIsFocused, useRoute} from '@react-navigation/native'; import {useEffect, useRef} from 'react'; import {InteractionManager} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import * as Report from '@userActions/Report'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -19,7 +19,7 @@ function UserTypingEventListener({report}: UserTypingEventListenerProps) { const didSubscribeToReportTypingEvents = useRef(false); const reportID = report.reportID; const isFocused = useIsFocused(); - const route = useRoute>(); + const route = useRoute>(); useEffect( () => () => { diff --git a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx index f291d71c75e8..24bdb8f49960 100644 --- a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx +++ b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx @@ -1,5 +1,4 @@ /* eslint-disable rulesdir/no-negated-variables */ -import type {StackScreenProps} from '@react-navigation/stack'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {useEffect, useMemo} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; @@ -15,8 +14,9 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; -type WithReportAndReportActionOrNotFoundProps = StackScreenProps< +type WithReportAndReportActionOrNotFoundProps = PlatformStackScreenProps< FlagCommentNavigatorParamList & SplitDetailsNavigatorParamList, typeof SCREENS.FLAG_COMMENT_ROOT | typeof SCREENS.SPLIT_DETAILS.ROOT > & { @@ -35,7 +35,7 @@ type WithReportAndReportActionOrNotFoundProps = StackScreenProps< export default function ( WrappedComponent: ComponentType>, -): ComponentType> { +): ComponentType, keyof OnyxProps>> { function WithReportOrNotFound(props: TProps, ref: ForwardedRef) { const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`); const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '-1'}`); diff --git a/src/pages/home/report/withReportOrNotFound.tsx b/src/pages/home/report/withReportOrNotFound.tsx index 8c0f4acbbe39..b5608d281778 100644 --- a/src/pages/home/report/withReportOrNotFound.tsx +++ b/src/pages/home/report/withReportOrNotFound.tsx @@ -1,11 +1,11 @@ /* eslint-disable rulesdir/no-negated-variables */ -import type {RouteProp} from '@react-navigation/native'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {useEffect} from 'react'; -import {useOnyx} from 'react-native-onyx'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import getComponentDisplayName from '@libs/getComponentDisplayName'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import type { ParticipantsNavigatorParamList, @@ -22,20 +22,9 @@ import type SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type WithReportOrNotFoundProps = { - route: - | RouteProp - | RouteProp - | RouteProp - | RouteProp - | RouteProp - | RouteProp - | RouteProp - | RouteProp - | RouteProp; - +type WithReportOrNotFoundOnyxProps = { /** The report currently being looked at */ - report: OnyxTypes.Report; + report: OnyxEntry; /** Metadata of the report currently being looked at */ reportMetadata: OnyxEntry; @@ -50,9 +39,30 @@ type WithReportOrNotFoundProps = { isLoadingReportData: OnyxEntry; }; +type ScreenProps = + | PlatformStackScreenProps + | PlatformStackScreenProps + | PlatformStackScreenProps + | PlatformStackScreenProps + | PlatformStackScreenProps + | PlatformStackScreenProps + | PlatformStackScreenProps + | PlatformStackScreenProps + | PlatformStackScreenProps; + +type WithReportOrNotFoundProps = WithReportOrNotFoundOnyxProps & { + /** The report currently being looked at */ + report: OnyxTypes.Report; + + route: ScreenProps['route']; + navigation: ScreenProps['navigation']; +}; + export default function ( shouldRequireReportID = true, -): (WrappedComponent: React.ComponentType>) => React.ComponentType> { +): ( + WrappedComponent: React.ComponentType>, +) => React.ComponentType, keyof WithReportOrNotFoundOnyxProps>> { return function (WrappedComponent: ComponentType>) { function WithReportOrNotFound(props: TProps, ref: ForwardedRef) { const [betas] = useOnyx(ONYXKEYS.BETAS); diff --git a/src/pages/iou/HoldReasonPage.tsx b/src/pages/iou/HoldReasonPage.tsx index 7523a0932c42..61bf7399889a 100644 --- a/src/pages/iou/HoldReasonPage.tsx +++ b/src/pages/iou/HoldReasonPage.tsx @@ -1,37 +1,24 @@ -import type {RouteProp} from '@react-navigation/native'; import React, {useCallback, useEffect} from 'react'; import {useOnyx} from 'react-native-onyx'; import type {FormInputErrors, FormOnyxValues} from '@components/Form/types'; import useLocalize from '@hooks/useLocalize'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; +import type {MoneyRequestNavigatorParamList, SearchReportParamList} from '@libs/Navigation/types'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import * as FormActions from '@userActions/FormActions'; import * as IOU from '@userActions/IOU'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {Route} from '@src/ROUTES'; +import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/MoneyRequestHoldReasonForm'; import HoldReasonFormView from './HoldReasonFormView'; -type HoldReasonPageRouteParams = { - /** ID of the transaction the page was opened for */ - transactionID: string; - - /** ID of the report that user is providing hold reason to */ - reportID: string; - - /** Link to previous page */ - backTo: Route; - - searchHash?: number; -}; - -type HoldReasonPageProps = { - /** Navigation route context info provided by react navigation */ - route: RouteProp<{params: HoldReasonPageRouteParams}>; -}; +type HoldReasonPageProps = + | PlatformStackScreenProps + | PlatformStackScreenProps; function HoldReasonPage({route}: HoldReasonPageProps) { const {translate} = useLocalize(); diff --git a/src/pages/iou/SplitBillDetailsPage.tsx b/src/pages/iou/SplitBillDetailsPage.tsx index bb464e521407..889c5f1515bf 100644 --- a/src/pages/iou/SplitBillDetailsPage.tsx +++ b/src/pages/iou/SplitBillDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -13,6 +12,7 @@ import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SplitDetailsNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; @@ -28,7 +28,7 @@ import type SCREENS from '@src/SCREENS'; import type {Participant} from '@src/types/onyx/IOU'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type SplitBillDetailsPageProps = WithReportAndReportActionOrNotFoundProps & StackScreenProps; +type SplitBillDetailsPageProps = WithReportAndReportActionOrNotFoundProps & PlatformStackScreenProps; function SplitBillDetailsPage({route, report, reportAction}: SplitBillDetailsPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 09fe67ab882f..7a0047d182ac 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -35,6 +35,7 @@ function IOURequestStartPage({ route: { params: {iouType, reportID}, }, + navigation, }: IOURequestStartPageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -148,6 +149,7 @@ function IOURequestStartPage({ )} @@ -155,7 +157,10 @@ function IOURequestStartPage({ {() => ( - + )} @@ -163,7 +168,10 @@ function IOURequestStartPage({ {() => ( - + )} @@ -176,6 +184,7 @@ function IOURequestStartPage({ > diff --git a/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx b/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx index 66736dc80b52..9b90471d8d1b 100644 --- a/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx +++ b/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useIsFocused} from '@react-navigation/native'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {forwardRef} from 'react'; @@ -7,6 +6,7 @@ import {withOnyx} from 'react-native-onyx'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import * as IOUUtils from '@libs/IOUUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {MoneyRequestNavigatorParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -38,9 +38,8 @@ type MoneyRequestRouteName = | typeof SCREENS.MONEY_REQUEST.STEP_SEND_FROM | typeof SCREENS.MONEY_REQUEST.STEP_COMPANY_INFO; -type Route = RouteProp; - -type WithFullTransactionOrNotFoundProps = WithFullTransactionOrNotFoundOnyxProps & {route: Route}; +type WithFullTransactionOrNotFoundProps = WithFullTransactionOrNotFoundOnyxProps & + PlatformStackScreenProps; export default function , TRef>(WrappedComponent: ComponentType>) { // eslint-disable-next-line rulesdir/no-negated-variables diff --git a/src/pages/iou/request/step/withWritableReportOrNotFound.tsx b/src/pages/iou/request/step/withWritableReportOrNotFound.tsx index 2361d58dc2be..f4fa34c406aa 100644 --- a/src/pages/iou/request/step/withWritableReportOrNotFound.tsx +++ b/src/pages/iou/request/step/withWritableReportOrNotFound.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/core'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {forwardRef, useEffect} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; @@ -6,6 +5,7 @@ import {useOnyx} from 'react-native-onyx'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import getComponentDisplayName from '@libs/getComponentDisplayName'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {MoneyRequestNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import * as ReportActions from '@userActions/Report'; @@ -42,9 +42,7 @@ type MoneyRequestRouteName = | typeof SCREENS.MONEY_REQUEST.STEP_SEND_FROM | typeof SCREENS.MONEY_REQUEST.STEP_COMPANY_INFO; -type Route = RouteProp; - -type WithWritableReportOrNotFoundProps = WithWritableReportOrNotFoundOnyxProps & {route: Route}; +type WithWritableReportOrNotFoundProps = WithWritableReportOrNotFoundOnyxProps & PlatformStackScreenProps; export default function , TRef>( WrappedComponent: ComponentType>, diff --git a/src/pages/settings/AboutPage/ConsolePage.tsx b/src/pages/settings/AboutPage/ConsolePage.tsx index b156a6c7b2f1..be0fcf2f3021 100644 --- a/src/pages/settings/AboutPage/ConsolePage.tsx +++ b/src/pages/settings/AboutPage/ConsolePage.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import {format} from 'date-fns'; import React, {useCallback, useMemo, useRef, useState} from 'react'; @@ -26,6 +25,7 @@ import type {Log} from '@libs/Console'; import localFileCreate from '@libs/localFileCreate'; import localFileDownload from '@libs/localFileDownload'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -50,7 +50,7 @@ function ConsolePage() { const styles = useThemeStyles(); const theme = useTheme(); const {windowWidth} = useWindowDimensions(); - const route = useRoute>(); + const route = useRoute>(); const menuItems: PopoverMenuItem[] = useMemo( () => [ diff --git a/src/pages/settings/AboutPage/ShareLogPage.tsx b/src/pages/settings/AboutPage/ShareLogPage.tsx index 8f0623f99d32..ad4006b06e03 100644 --- a/src/pages/settings/AboutPage/ShareLogPage.tsx +++ b/src/pages/settings/AboutPage/ShareLogPage.tsx @@ -1,10 +1,10 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import type SCREENS from '@src/SCREENS'; import ShareLogList from './ShareLogList'; -type ShareLogPageProps = StackScreenProps; +type ShareLogPageProps = PlatformStackScreenProps; function ShareLogPage({route}: ShareLogPageProps) { return ; diff --git a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx index 2e567fe82974..135d50a4c89f 100644 --- a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx +++ b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -13,6 +12,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; import variables from '@styles/variables'; @@ -30,7 +30,7 @@ type ExitSurveyConfirmPageOnyxProps = { exitReason?: ExitReason | null; }; -type ExitSurveyConfirmPageProps = ExitSurveyConfirmPageOnyxProps & StackScreenProps; +type ExitSurveyConfirmPageProps = ExitSurveyConfirmPageOnyxProps & PlatformStackScreenProps; function ExitSurveyConfirmPage({exitReason, route, navigation}: ExitSurveyConfirmPageProps) { const {translate} = useLocalize(); diff --git a/src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx b/src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx index 1fb7cfbc94ab..87d29aba0e88 100644 --- a/src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx +++ b/src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect} from 'react'; import {useOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; @@ -17,6 +16,7 @@ import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import StatusBar from '@libs/StatusBar'; import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import Navigation from '@navigation/Navigation'; @@ -31,7 +31,7 @@ import INPUT_IDS from '@src/types/form/ExitSurveyResponseForm'; import type {Errors} from '@src/types/onyx/OnyxCommon'; import ExitSurveyOffline from './ExitSurveyOffline'; -type ExitSurveyResponsePageProps = StackScreenProps; +type ExitSurveyResponsePageProps = PlatformStackScreenProps; function ExitSurveyResponsePage({route, navigation}: ExitSurveyResponsePageProps) { const [draftResponse = ''] = useOnyx(ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM_DRAFT, {selector: (value) => value?.[INPUT_IDS.RESPONSE]}); diff --git a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx index 9fcc28f51912..d609355c10e5 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx +++ b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {InteractionManager, Keyboard, View} from 'react-native'; @@ -22,6 +21,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {canUseTouchScreen} from '@libs/DeviceCapabilities'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; @@ -33,7 +33,7 @@ import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; import ValidateCodeForm from './ValidateCodeForm'; import type {ValidateCodeFormHandle} from './ValidateCodeForm/BaseValidateCodeForm'; -type ContactMethodDetailsPageProps = StackScreenProps; +type ContactMethodDetailsPageProps = PlatformStackScreenProps; function ContactMethodDetailsPage({route}: ContactMethodDetailsPageProps) { const [loginList, loginListResult] = useOnyx(ONYXKEYS.LOGIN_LIST); diff --git a/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx b/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx index 893a54c5ccfd..a49eb140626a 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx +++ b/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; @@ -18,6 +17,7 @@ import useDelegateUserDetails from '@hooks/useDelegateUserDetails'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; @@ -35,7 +35,7 @@ type ContactMethodsPageOnyxProps = { session: OnyxEntry; }; -type ContactMethodsPageProps = ContactMethodsPageOnyxProps & StackScreenProps; +type ContactMethodsPageProps = ContactMethodsPageOnyxProps & PlatformStackScreenProps; function ContactMethodsPage({loginList, session, route}: ContactMethodsPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx b/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx index 42ab49e2ed50..9b9746045c36 100644 --- a/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx +++ b/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useCallback, useEffect, useRef, useState} from 'react'; import {View} from 'react-native'; @@ -18,21 +17,23 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as UserUtils from '@libs/UserUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; +import ROUTES from '@src/ROUTES';å import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/NewContactMethodForm'; import type {Errors} from '@src/types/onyx/OnyxCommon'; -type NewContactMethodPageProps = StackScreenProps; +type NewContactMethodPageProps = PlatformStackScreenProps; function NewContactMethodPage({route}: NewContactMethodPageProps) { - const contactMethod = UserUtils.getContactMethod(); + const [account] = useOnyx(ONYXKEYS.ACCOUNT); + const contactMethod = account?.primaryLogin ?? ''; const styles = useThemeStyles(); const {translate} = useLocalize(); const loginInputRef = useRef(null); diff --git a/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.tsx b/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.tsx index a8afffe32d33..0af04b1dfd2a 100644 --- a/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.tsx +++ b/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo, useState} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -6,6 +5,7 @@ import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import useLocalize from '@hooks/useLocalize'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import type {CountryData} from '@libs/searchCountryOptions'; import searchCountryOptions from '@libs/searchCountryOptions'; @@ -16,7 +16,7 @@ import type {TranslationPaths} from '@src/languages/types'; import type {Route} from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type CountrySelectionPageProps = StackScreenProps; +type CountrySelectionPageProps = PlatformStackScreenProps; function CountrySelectionPage({route, navigation}: CountrySelectionPageProps) { const [searchValue, setSearchValue] = useState(''); diff --git a/src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx b/src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx index 3e5287c82a42..668081242996 100644 --- a/src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx +++ b/src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx @@ -1,8 +1,8 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import AddressPage from '@pages/AddressPage'; @@ -19,7 +19,7 @@ type PersonalAddressPageOnyxProps = { isLoadingApp: OnyxEntry; }; -type PersonalAddressPageProps = StackScreenProps & PersonalAddressPageOnyxProps; +type PersonalAddressPageProps = PlatformStackScreenProps & PersonalAddressPageOnyxProps; /** * Submit form to update user's first and last legal name diff --git a/src/pages/settings/Profile/ProfileAvatar.tsx b/src/pages/settings/Profile/ProfileAvatar.tsx index 977719f63879..a80db51580ba 100644 --- a/src/pages/settings/Profile/ProfileAvatar.tsx +++ b/src/pages/settings/Profile/ProfileAvatar.tsx @@ -1,9 +1,9 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import AttachmentModal from '@components/AttachmentModal'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as UserUtils from '@libs/UserUtils'; @@ -19,7 +19,7 @@ type ProfileAvatarOnyxProps = { isLoadingApp: OnyxEntry; }; -type ProfileAvatarProps = ProfileAvatarOnyxProps & StackScreenProps; +type ProfileAvatarProps = ProfileAvatarOnyxProps & PlatformStackScreenProps; function ProfileAvatar({route, personalDetails, personalDetailsMetadata, isLoadingApp = true}: ProfileAvatarProps) { const personalDetail = personalDetails?.[route.params.accountID]; diff --git a/src/pages/settings/Report/NamePage.tsx b/src/pages/settings/Report/NamePage.tsx index de73e59bb7da..f8ee44ccaa5f 100644 --- a/src/pages/settings/Report/NamePage.tsx +++ b/src/pages/settings/Report/NamePage.tsx @@ -1,5 +1,5 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import type {ReportSettingsNavigatorParamList} from '@navigation/types'; import GroupChatNameEditPage from '@pages/GroupChatNameEditPage'; @@ -8,7 +8,7 @@ import type {WithReportOrNotFoundProps} from '@pages/home/report/withReportOrNot import type SCREENS from '@src/SCREENS'; import RoomNamePage from './RoomNamePage'; -type NamePageProps = WithReportOrNotFoundProps & StackScreenProps; +type NamePageProps = WithReportOrNotFoundProps & PlatformStackScreenProps; function NamePage({report}: NamePageProps) { if (ReportUtils.isGroupChat(report)) { diff --git a/src/pages/settings/Report/NotificationPreferencePage.tsx b/src/pages/settings/Report/NotificationPreferencePage.tsx index 416d710d4966..50d445015f45 100644 --- a/src/pages/settings/Report/NotificationPreferencePage.tsx +++ b/src/pages/settings/Report/NotificationPreferencePage.tsx @@ -1,6 +1,4 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -10,6 +8,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import useLocalize from '@hooks/useLocalize'; +import type {PlatformStackRouteProp, PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import type {ReportSettingsNavigatorParamList} from '@navigation/types'; import withReportOrNotFound from '@pages/home/report/withReportOrNotFound'; @@ -19,10 +18,10 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; -type NotificationPreferencePageProps = WithReportOrNotFoundProps & StackScreenProps; +type NotificationPreferencePageProps = WithReportOrNotFoundProps & PlatformStackScreenProps; function NotificationPreferencePage({report}: NotificationPreferencePageProps) { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID || -1}`); const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); diff --git a/src/pages/settings/Report/ReportSettingsPage.tsx b/src/pages/settings/Report/ReportSettingsPage.tsx index c407788dce65..e943bc7b84a1 100644 --- a/src/pages/settings/Report/ReportSettingsPage.tsx +++ b/src/pages/settings/Report/ReportSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -11,6 +10,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import type {ReportSettingsNavigatorParamList} from '@navigation/types'; import withReportOrNotFound from '@pages/home/report/withReportOrNotFound'; @@ -21,7 +21,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type ReportSettingsPageProps = WithReportOrNotFoundProps & StackScreenProps; +type ReportSettingsPageProps = WithReportOrNotFoundProps & PlatformStackScreenProps; function ReportSettingsPage({report, policies, route}: ReportSettingsPageProps) { const backTo = route.params.backTo; diff --git a/src/pages/settings/Report/RoomNamePage.tsx b/src/pages/settings/Report/RoomNamePage.tsx index a497d793f465..ac23f455c635 100644 --- a/src/pages/settings/Report/RoomNamePage.tsx +++ b/src/pages/settings/Report/RoomNamePage.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useIsFocused, useRoute} from '@react-navigation/native'; import React, {useCallback, useRef} from 'react'; import {View} from 'react-native'; @@ -16,6 +15,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportSettingsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; @@ -37,7 +37,7 @@ type RoomNamePageProps = RoomNamePageOnyxProps & { }; function RoomNamePage({report, reports}: RoomNamePageProps) { - const route = useRoute>(); + const route = useRoute>(); const styles = useThemeStyles(); const roomNameInputRef = useRef(null); const isFocused = useIsFocused(); diff --git a/src/pages/settings/Report/VisibilityPage.tsx b/src/pages/settings/Report/VisibilityPage.tsx index 07c05d1b8de1..a1ddc3d5fe48 100644 --- a/src/pages/settings/Report/VisibilityPage.tsx +++ b/src/pages/settings/Report/VisibilityPage.tsx @@ -1,6 +1,4 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo, useRef, useState} from 'react'; import {useOnyx} from 'react-native-onyx'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; @@ -10,6 +8,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import useLocalize from '@hooks/useLocalize'; +import type {PlatformStackRouteProp, PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportSettingsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import type {WithReportOrNotFoundProps} from '@pages/home/report/withReportOrNotFound'; @@ -20,10 +19,10 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import type {RoomVisibility} from '@src/types/onyx/Report'; -type VisibilityProps = WithReportOrNotFoundProps & StackScreenProps; +type VisibilityProps = WithReportOrNotFoundProps & PlatformStackScreenProps; function VisibilityPage({report}: VisibilityProps) { - const route = useRoute>(); + const route = useRoute>(); const [showConfirmModal, setShowConfirmModal] = useState(false); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID || -1}`); const shouldGoBackToDetailsPage = useRef(false); diff --git a/src/pages/settings/Report/WriteCapabilityPage.tsx b/src/pages/settings/Report/WriteCapabilityPage.tsx index 888c15295dc2..2f6fb9b485a7 100644 --- a/src/pages/settings/Report/WriteCapabilityPage.tsx +++ b/src/pages/settings/Report/WriteCapabilityPage.tsx @@ -1,6 +1,4 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; @@ -12,6 +10,7 @@ import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import useLocalize from '@hooks/useLocalize'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp, PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import type {ReportSettingsNavigatorParamList} from '@navigation/types'; import withReportOrNotFound from '@pages/home/report/withReportOrNotFound'; @@ -30,10 +29,10 @@ type WriteCapabilityPageOnyxProps = { type WriteCapabilityPageProps = WriteCapabilityPageOnyxProps & WithReportOrNotFoundProps & - StackScreenProps; + PlatformStackScreenProps; function WriteCapabilityPage({report, policy}: WriteCapabilityPageProps) { - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const writeCapabilityOptions = Object.values(CONST.REPORT.WRITE_CAPABILITIES).map((value) => ({ value, diff --git a/src/pages/settings/Security/AddDelegate/ConfirmDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/ConfirmDelegatePage.tsx index 2c60aef482a8..047d80ee92fa 100644 --- a/src/pages/settings/Security/AddDelegate/ConfirmDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/ConfirmDelegatePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import type {ValueOf} from 'type-fest'; import Button from '@components/Button'; @@ -13,13 +12,14 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {requestValidationCode} from '@libs/actions/Delegate'; import {formatPhoneNumber} from '@libs/LocalePhoneNumber'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ConfirmDelegatePageProps = StackScreenProps; +type ConfirmDelegatePageProps = PlatformStackScreenProps; function ConfirmDelegatePage({route}: ConfirmDelegatePageProps) { const {translate} = useLocalize(); diff --git a/src/pages/settings/Security/AddDelegate/DelegateMagicCodePage.tsx b/src/pages/settings/Security/AddDelegate/DelegateMagicCodePage.tsx index 9497507f041a..941cc2992121 100644 --- a/src/pages/settings/Security/AddDelegate/DelegateMagicCodePage.tsx +++ b/src/pages/settings/Security/AddDelegate/DelegateMagicCodePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useRef} from 'react'; import {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -8,6 +7,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import type CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -16,7 +16,7 @@ import type SCREENS from '@src/SCREENS'; import ValidateCodeForm from './ValidateCodeForm'; import type {ValidateCodeFormHandle} from './ValidateCodeForm/BaseValidateCodeForm'; -type DelegateMagicCodePageProps = StackScreenProps; +type DelegateMagicCodePageProps = PlatformStackScreenProps; function DelegateMagicCodePage({route}: DelegateMagicCodePageProps) { const {translate} = useLocalize(); diff --git a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx index 4270441775cd..7a52efb6cfd8 100644 --- a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx +++ b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -9,12 +8,13 @@ import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type SelectDelegateRolePageProps = StackScreenProps; +type SelectDelegateRolePageProps = PlatformStackScreenProps; function SelectDelegateRolePage({route}: SelectDelegateRolePageProps) { const {translate} = useLocalize(); diff --git a/src/pages/settings/Security/CloseAccountPage.tsx b/src/pages/settings/Security/CloseAccountPage.tsx index 1da4436ca810..214b38ee3620 100644 --- a/src/pages/settings/Security/CloseAccountPage.tsx +++ b/src/pages/settings/Security/CloseAccountPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useEffect, useState} from 'react'; import {View} from 'react-native'; @@ -15,6 +14,7 @@ import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ValidationUtils from '@libs/ValidationUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import variables from '@styles/variables'; @@ -31,7 +31,7 @@ type CloseAccountPageOnyxProps = { session: OnyxEntry; }; -type CloseAccountPageProps = CloseAccountPageOnyxProps & StackScreenProps; +type CloseAccountPageProps = CloseAccountPageOnyxProps & PlatformStackScreenProps; function CloseAccountPage({session}: CloseAccountPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx b/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx index dd3d3b87a12f..5ae593971f8e 100644 --- a/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx +++ b/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; @@ -19,6 +18,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Clipboard from '@libs/Clipboard'; import localFileDownload from '@libs/localFileDownload'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {BackToParams, SettingsNavigatorParamList} from '@libs/Navigation/types'; import StepWrapper from '@pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper'; import useTwoFactorAuthContext from '@pages/settings/Security/TwoFactorAuth/TwoFactorAuthContext/useTwoFactorAuth'; @@ -39,7 +39,7 @@ function CodesStep({account, user, backTo}: CodesStepProps) { const {isExtraSmallScreenWidth, isSmallScreenWidth} = useResponsiveLayout(); const [error, setError] = useState(''); const isUserValidated = user?.validated; - const route = useRoute>(); + const route = useRoute>(); const {setStep} = useTwoFactorAuthContext(); diff --git a/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.tsx b/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.tsx index c49b88c2ac0e..9c70371e76a3 100644 --- a/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.tsx +++ b/src/pages/settings/Security/TwoFactorAuth/TwoFactorAuthSteps.tsx @@ -1,9 +1,9 @@ import {useRoute} from '@react-navigation/native'; -import type {RouteProp} from '@react-navigation/native'; import React, {useCallback, useEffect, useMemo} from 'react'; import {withOnyx} from 'react-native-onyx'; import type {AnimationDirection} from '@components/AnimatedStep/AnimatedStepContext'; import useAnimatedStepContext from '@components/AnimatedStep/useAnimatedStepContext'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as TwoFactorAuthActions from '@userActions/TwoFactorAuthActions'; import CONST from '@src/CONST'; @@ -22,7 +22,7 @@ import type {BaseTwoFactorAuthFormOnyxProps} from './TwoFactorAuthForm/types'; type TwoFactorAuthStepProps = BaseTwoFactorAuthFormOnyxProps; function TwoFactorAuthSteps({account}: TwoFactorAuthStepProps) { - const route = useRoute>(); + const route = useRoute>(); const backTo = route.params?.backTo ?? ''; const forwardTo = route.params?.forwardTo ?? ''; diff --git a/src/pages/settings/Subscription/SubscriptionSize/index.tsx b/src/pages/settings/Subscription/SubscriptionSize/index.tsx index 84cd86c60bca..94c6fd5dffd8 100644 --- a/src/pages/settings/Subscription/SubscriptionSize/index.tsx +++ b/src/pages/settings/Subscription/SubscriptionSize/index.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; import {useOnyx} from 'react-native-onyx'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -7,6 +6,7 @@ import useLocalize from '@hooks/useLocalize'; import useSubStep from '@hooks/useSubStep'; import type {SubStepProps} from '@hooks/useSubStep/types'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import * as FormActions from '@userActions/FormActions'; import * as Subscription from '@userActions/Subscription'; @@ -18,7 +18,7 @@ import Size from './substeps/Size'; const bodyContent: Array> = [Size, Confirmation]; -type SubscriptionSizePageProps = StackScreenProps; +type SubscriptionSizePageProps = PlatformStackScreenProps; function SubscriptionSizePage({route}: SubscriptionSizePageProps) { const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION); diff --git a/src/pages/settings/Wallet/ActivatePhysicalCardPage.tsx b/src/pages/settings/Wallet/ActivatePhysicalCardPage.tsx index 23b694fe0d40..bdc8928f362b 100644 --- a/src/pages/settings/Wallet/ActivatePhysicalCardPage.tsx +++ b/src/pages/settings/Wallet/ActivatePhysicalCardPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useRef, useState} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -18,6 +17,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import * as CardSettings from '@userActions/Card'; @@ -33,7 +33,7 @@ type ActivatePhysicalCardPageOnyxProps = { cardList: OnyxEntry>; }; -type ActivatePhysicalCardPageProps = ActivatePhysicalCardPageOnyxProps & StackScreenProps; +type ActivatePhysicalCardPageProps = ActivatePhysicalCardPageOnyxProps & PlatformStackScreenProps; const LAST_FOUR_DIGITS_LENGTH = 4; const MAGIC_INPUT_MIN_HEIGHT = 86; diff --git a/src/pages/settings/Wallet/Card/GetPhysicalCardAddress.tsx b/src/pages/settings/Wallet/Card/GetPhysicalCardAddress.tsx index 69ba24585e2e..ef85b09ac2a6 100644 --- a/src/pages/settings/Wallet/Card/GetPhysicalCardAddress.tsx +++ b/src/pages/settings/Wallet/Card/GetPhysicalCardAddress.tsx @@ -1,10 +1,10 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useState} from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; import AddressForm from '@components/AddressForm'; import useLocalize from '@hooks/useLocalize'; import * as FormActions from '@libs/actions/FormActions'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import type {Country} from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -21,7 +21,7 @@ type GetPhysicalCardAddressOnyxProps = { draftValues: OnyxEntry; }; -type GetPhysicalCardAddressProps = GetPhysicalCardAddressOnyxProps & StackScreenProps; +type GetPhysicalCardAddressProps = GetPhysicalCardAddressOnyxProps & PlatformStackScreenProps; function GetPhysicalCardAddress({ draftValues, diff --git a/src/pages/settings/Wallet/Card/GetPhysicalCardConfirm.tsx b/src/pages/settings/Wallet/Card/GetPhysicalCardConfirm.tsx index 15354c3cdfb8..1023064c0d39 100644 --- a/src/pages/settings/Wallet/Card/GetPhysicalCardConfirm.tsx +++ b/src/pages/settings/Wallet/Card/GetPhysicalCardConfirm.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; @@ -8,6 +7,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import CONST from '@src/CONST'; @@ -34,7 +34,7 @@ type GetPhysicalCardConfirmOnyxProps = { draftValues: OnyxEntry; }; -type GetPhysicalCardConfirmProps = GetPhysicalCardConfirmOnyxProps & StackScreenProps; +type GetPhysicalCardConfirmProps = GetPhysicalCardConfirmOnyxProps & PlatformStackScreenProps; function GetPhysicalCardConfirm({ draftValues, diff --git a/src/pages/settings/Wallet/Card/GetPhysicalCardName.tsx b/src/pages/settings/Wallet/Card/GetPhysicalCardName.tsx index deaa05350c7f..0a804d1df470 100644 --- a/src/pages/settings/Wallet/Card/GetPhysicalCardName.tsx +++ b/src/pages/settings/Wallet/Card/GetPhysicalCardName.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; @@ -6,6 +5,7 @@ import InputWrapper from '@components/Form/InputWrapper'; import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ValidationUtils from '@libs/ValidationUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import CONST from '@src/CONST'; @@ -26,7 +26,7 @@ type GetPhysicalCardNameOnyxProps = { draftValues: OnyxEntry; }; -type GetPhysicalCardNameProps = GetPhysicalCardNameOnyxProps & StackScreenProps; +type GetPhysicalCardNameProps = GetPhysicalCardNameOnyxProps & PlatformStackScreenProps; function GetPhysicalCardName({ draftValues, diff --git a/src/pages/settings/Wallet/Card/GetPhysicalCardPhone.tsx b/src/pages/settings/Wallet/Card/GetPhysicalCardPhone.tsx index 56d5a29a3203..c7676db26067 100644 --- a/src/pages/settings/Wallet/Card/GetPhysicalCardPhone.tsx +++ b/src/pages/settings/Wallet/Card/GetPhysicalCardPhone.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; @@ -6,6 +5,7 @@ import InputWrapper from '@components/Form/InputWrapper'; import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import * as LoginUtils from '@libs/LoginUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -24,7 +24,7 @@ type GetPhysicalCardPhoneOnyxProps = { draftValues: OnyxEntry; }; -type GetPhysicalCardPhoneProps = GetPhysicalCardPhoneOnyxProps & StackScreenProps; +type GetPhysicalCardPhoneProps = GetPhysicalCardPhoneOnyxProps & PlatformStackScreenProps; function GetPhysicalCardPhone({ route: { diff --git a/src/pages/settings/Wallet/ExpensifyCardPage.tsx b/src/pages/settings/Wallet/ExpensifyCardPage.tsx index 1146f876860e..89c3cd668622 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useMemo, useState} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -22,6 +21,7 @@ import * as CardUtils from '@libs/CardUtils'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import * as GetPhysicalCardUtils from '@libs/GetPhysicalCardUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import * as Card from '@userActions/Card'; @@ -51,7 +51,7 @@ type ExpensifyCardPageOnyxProps = { loginList: OnyxEntry; }; -type ExpensifyCardPageProps = ExpensifyCardPageOnyxProps & StackScreenProps; +type ExpensifyCardPageProps = ExpensifyCardPageOnyxProps & PlatformStackScreenProps; type PossibleTitles = 'cardPage.smartLimit.title' | 'cardPage.monthlyLimit.title' | 'cardPage.fixedLimit.title'; diff --git a/src/pages/settings/Wallet/ReportCardLostPage.tsx b/src/pages/settings/Wallet/ReportCardLostPage.tsx index 35b5bc9cd19a..5850be921b23 100644 --- a/src/pages/settings/Wallet/ReportCardLostPage.tsx +++ b/src/pages/settings/Wallet/ReportCardLostPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useState} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -14,6 +13,7 @@ import usePrevious from '@hooks/usePrevious'; import useStyledSafeAreaInsets from '@hooks/useStyledSafeAreaInsets'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -61,7 +61,7 @@ type ReportCardLostPageOnyxProps = { cardList: OnyxEntry>; }; -type ReportCardLostPageProps = ReportCardLostPageOnyxProps & StackScreenProps; +type ReportCardLostPageProps = ReportCardLostPageOnyxProps & PlatformStackScreenProps; function ReportCardLostPage({ privatePersonalDetails = { diff --git a/src/pages/settings/Wallet/ReportVirtualCardFraudPage.tsx b/src/pages/settings/Wallet/ReportVirtualCardFraudPage.tsx index 373314df08ac..f4a2c861868c 100644 --- a/src/pages/settings/Wallet/ReportVirtualCardFraudPage.tsx +++ b/src/pages/settings/Wallet/ReportVirtualCardFraudPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -11,6 +10,7 @@ import usePrevious from '@hooks/usePrevious'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import * as Card from '@userActions/Card'; @@ -19,7 +19,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type ReportVirtualCardFraudPageProps = StackScreenProps; +type ReportVirtualCardFraudPageProps = PlatformStackScreenProps; function ReportVirtualCardFraudPage({ route: { diff --git a/src/pages/settings/Wallet/VerifyAccountPage.tsx b/src/pages/settings/Wallet/VerifyAccountPage.tsx index e375f03ba58c..0e8d48f05854 100644 --- a/src/pages/settings/Wallet/VerifyAccountPage.tsx +++ b/src/pages/settings/Wallet/VerifyAccountPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useRef} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -12,13 +11,14 @@ import useSafePaddingBottomStyle from '@hooks/useSafePaddingBottomStyle'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as User from '@userActions/User'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type VerifyAccountPageProps = StackScreenProps; +type VerifyAccountPageProps = PlatformStackScreenProps; function VerifyAccountPage({route}: VerifyAccountPageProps) { const [account] = useOnyx(ONYXKEYS.ACCOUNT); diff --git a/src/pages/tasks/NewTaskDescriptionPage.tsx b/src/pages/tasks/NewTaskDescriptionPage.tsx index 0132442b5978..fb7e7b9f4617 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.tsx +++ b/src/pages/tasks/NewTaskDescriptionPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -14,6 +13,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {NewTaskNavigatorParamList} from '@libs/Navigation/types'; import Parser from '@libs/Parser'; import * as ReportUtils from '@libs/ReportUtils'; @@ -32,7 +32,7 @@ type NewTaskDescriptionPageOnyxProps = { task: OnyxEntry; }; -type NewTaskDescriptionPageProps = NewTaskDescriptionPageOnyxProps & StackScreenProps; +type NewTaskDescriptionPageProps = NewTaskDescriptionPageOnyxProps & PlatformStackScreenProps; function NewTaskDescriptionPage({task, route}: NewTaskDescriptionPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/tasks/NewTaskDetailsPage.tsx b/src/pages/tasks/NewTaskDetailsPage.tsx index f0ff4d0fb409..245a3a9893b7 100644 --- a/src/pages/tasks/NewTaskDetailsPage.tsx +++ b/src/pages/tasks/NewTaskDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useState} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -14,6 +13,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {NewTaskNavigatorParamList} from '@libs/Navigation/types'; import Parser from '@libs/Parser'; import * as ReportUtils from '@libs/ReportUtils'; @@ -32,7 +32,7 @@ type NewTaskDetailsPageOnyxProps = { task: OnyxEntry; }; -type NewTaskDetailsPageProps = NewTaskDetailsPageOnyxProps & StackScreenProps; +type NewTaskDetailsPageProps = NewTaskDetailsPageOnyxProps & PlatformStackScreenProps; function NewTaskDetailsPage({task, route}: NewTaskDetailsPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/tasks/NewTaskPage.tsx b/src/pages/tasks/NewTaskPage.tsx index faf45df8b51d..1ac6c1b31356 100644 --- a/src/pages/tasks/NewTaskPage.tsx +++ b/src/pages/tasks/NewTaskPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {InteractionManager, View} from 'react-native'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; @@ -18,6 +17,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import blurActiveElement from '@libs/Accessibility/blurActiveElement'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {NewTaskNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReportUtils from '@libs/ReportUtils'; @@ -41,7 +41,7 @@ type NewTaskPageOnyxProps = { reports: OnyxCollection; }; -type NewTaskPageProps = NewTaskPageOnyxProps & StackScreenProps; +type NewTaskPageProps = NewTaskPageOnyxProps & PlatformStackScreenProps; function NewTaskPage({task, reports, personalDetails, route}: NewTaskPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/tasks/NewTaskTitlePage.tsx b/src/pages/tasks/NewTaskTitlePage.tsx index 5afd919cac57..55e23f258762 100644 --- a/src/pages/tasks/NewTaskTitlePage.tsx +++ b/src/pages/tasks/NewTaskTitlePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -14,6 +13,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {NewTaskNavigatorParamList} from '@libs/Navigation/types'; import * as TaskActions from '@userActions/Task'; import CONST from '@src/CONST'; @@ -27,7 +27,7 @@ type NewTaskTitlePageOnyxProps = { /** Task Creation Data */ task: OnyxEntry; }; -type NewTaskTitlePageProps = NewTaskTitlePageOnyxProps & StackScreenProps; +type NewTaskTitlePageProps = NewTaskTitlePageOnyxProps & PlatformStackScreenProps; function NewTaskTitlePage({task, route}: NewTaskTitlePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.tsx b/src/pages/tasks/TaskAssigneeSelectorModal.tsx index 3f44882e2fd0..00d8ace8b7c4 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.tsx +++ b/src/pages/tasks/TaskAssigneeSelectorModal.tsx @@ -1,5 +1,4 @@ /* eslint-disable es/no-optional-chaining */ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {InteractionManager, View} from 'react-native'; @@ -23,6 +22,7 @@ import * as ReportActions from '@libs/actions/Report'; import {READ_COMMANDS} from '@libs/API/types'; import HttpUtils from '@libs/HttpUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReportUtils from '@libs/ReportUtils'; import type {TaskDetailsNavigatorParamList} from '@navigation/types'; @@ -101,7 +101,7 @@ function useOptions() { function TaskAssigneeSelectorModal() { const styles = useThemeStyles(); - const route = useRoute>(); + const route = useRoute>(); const {translate} = useLocalize(); const session = useSession(); const backTo = route.params?.backTo; diff --git a/src/pages/tasks/TaskDescriptionPage.tsx b/src/pages/tasks/TaskDescriptionPage.tsx index acd1329b26ec..97c5cf7f7e16 100644 --- a/src/pages/tasks/TaskDescriptionPage.tsx +++ b/src/pages/tasks/TaskDescriptionPage.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useFocusEffect, useRoute} from '@react-navigation/native'; import React, {useCallback, useRef} from 'react'; import {View} from 'react-native'; @@ -16,6 +15,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportDescriptionNavigatorParamList} from '@libs/Navigation/types'; import Parser from '@libs/Parser'; import * as ReportUtils from '@libs/ReportUtils'; @@ -33,7 +33,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; type TaskDescriptionPageProps = WithReportOrNotFoundProps & WithCurrentUserPersonalDetailsProps; function TaskDescriptionPage({report, currentUserPersonalDetails}: TaskDescriptionPageProps) { - const route = useRoute>(); + const route = useRoute>(); const styles = useThemeStyles(); const {translate} = useLocalize(); diff --git a/src/pages/tasks/TaskTitlePage.tsx b/src/pages/tasks/TaskTitlePage.tsx index 900809256c45..e6c429a44674 100644 --- a/src/pages/tasks/TaskTitlePage.tsx +++ b/src/pages/tasks/TaskTitlePage.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useCallback, useRef} from 'react'; import {View} from 'react-native'; @@ -16,6 +15,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {TaskDetailsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import withReportOrNotFound from '@pages/home/report/withReportOrNotFound'; @@ -30,7 +30,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; type TaskTitlePageProps = WithReportOrNotFoundProps & WithCurrentUserPersonalDetailsProps; function TaskTitlePage({report, currentUserPersonalDetails}: TaskTitlePageProps) { - const route = useRoute>(); + const route = useRoute>(); const styles = useThemeStyles(); const {translate} = useLocalize(); diff --git a/src/pages/wallet/WalletStatementPage.tsx b/src/pages/wallet/WalletStatementPage.tsx index 54b601a00350..4319eb09e071 100644 --- a/src/pages/wallet/WalletStatementPage.tsx +++ b/src/pages/wallet/WalletStatementPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {format, getMonth, getYear} from 'date-fns'; import {Str} from 'expensify-common'; import React, {useEffect} from 'react'; @@ -15,6 +14,7 @@ import DateUtils from '@libs/DateUtils'; import fileDownload from '@libs/fileDownload'; import Growl from '@libs/Growl'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {WalletStatementNavigatorParamList} from '@navigation/types'; import * as User from '@userActions/User'; import CONFIG from '@src/CONFIG'; @@ -27,7 +27,7 @@ type WalletStatementOnyxProps = { walletStatement: OnyxEntry; }; -type WalletStatementPageProps = WalletStatementOnyxProps & StackScreenProps; +type WalletStatementPageProps = WalletStatementOnyxProps & PlatformStackScreenProps; function WalletStatementPage({walletStatement, route}: WalletStatementPageProps) { const themePreference = useThemePreference(); diff --git a/src/pages/workspace/WorkspaceAvatar.tsx b/src/pages/workspace/WorkspaceAvatar.tsx index dfe79feb7755..79fc432a82a8 100644 --- a/src/pages/workspace/WorkspaceAvatar.tsx +++ b/src/pages/workspace/WorkspaceAvatar.tsx @@ -1,9 +1,9 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import AttachmentModal from '@components/AttachmentModal'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import * as UserUtils from '@libs/UserUtils'; @@ -16,7 +16,7 @@ type WorkspaceAvatarOnyxProps = { isLoadingApp: OnyxEntry; }; -type WorkspaceAvatarProps = WorkspaceAvatarOnyxProps & StackScreenProps; +type WorkspaceAvatarProps = WorkspaceAvatarOnyxProps & PlatformStackScreenProps; function WorkspaceAvatar({policy, isLoadingApp = true}: WorkspaceAvatarProps) { const avatarURL = policy?.avatarURL ?? '' ? policy?.avatarURL ?? '' : ReportUtils.getDefaultWorkspaceAvatar(policy?.name ?? ''); diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index 3db7623bfad1..575cb8a0e75e 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect, useNavigationState} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -24,6 +23,7 @@ import {isConnectionInProgress} from '@libs/actions/connections'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import getTopmostRouteName from '@libs/Navigation/getTopmostRouteName'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import {getDefaultWorkspaceAvatar} from '@libs/ReportUtils'; import type {FullScreenNavigatorParamList} from '@navigation/types'; @@ -66,7 +66,7 @@ type WorkspaceMenuItem = { badgeText?: string; }; -type WorkspaceInitialPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceInitialPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; type PolicyFeatureStates = Record; diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.tsx b/src/pages/workspace/WorkspaceInviteMessagePage.tsx index 65776deb7f9a..a79cf537a814 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.tsx +++ b/src/pages/workspace/WorkspaceInviteMessagePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import lodashDebounce from 'lodash/debounce'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {Keyboard, View} from 'react-native'; @@ -20,6 +19,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import Parser from '@libs/Parser'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -41,7 +41,7 @@ import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscree type WorkspaceInviteMessagePageProps = WithPolicyAndFullscreenLoadingProps & WithCurrentUserPersonalDetailsProps & - StackScreenProps; + PlatformStackScreenProps; function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}: WorkspaceInviteMessagePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index ad48d15aa9df..edd7374bf8c3 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import type {SectionListData} from 'react-native'; import {useOnyx, withOnyx} from 'react-native-onyx'; @@ -22,6 +21,7 @@ import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import HttpUtils from '@libs/HttpUtils'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import type {MemberForList} from '@libs/OptionsListUtils'; import * as PhoneNumber from '@libs/PhoneNumber'; @@ -54,7 +54,7 @@ type WorkspaceInvitePageOnyxProps = { type WorkspaceInvitePageProps = WithPolicyAndFullscreenLoadingProps & WithNavigationTransitionEndProps & WorkspaceInvitePageOnyxProps & - StackScreenProps; + PlatformStackScreenProps; function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, policy}: WorkspaceInvitePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/WorkspaceJoinUserPage.tsx b/src/pages/workspace/WorkspaceJoinUserPage.tsx index d73dab51c4fe..cf1225d89fbf 100644 --- a/src/pages/workspace/WorkspaceJoinUserPage.tsx +++ b/src/pages/workspace/WorkspaceJoinUserPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useRef} from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; @@ -6,6 +5,7 @@ import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import ScreenWrapper from '@components/ScreenWrapper'; import useThemeStyles from '@hooks/useThemeStyles'; import navigateAfterJoinRequest from '@libs/navigateAfterJoinRequest'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {AuthScreensParamList} from '@navigation/types'; @@ -21,7 +21,7 @@ type WorkspaceJoinUserPageOnyxProps = { policy: OnyxEntry; }; -type WorkspaceJoinUserPageRoute = {route: StackScreenProps['route']}; +type WorkspaceJoinUserPageRoute = {route: PlatformStackScreenProps['route']}; type WorkspaceJoinUserPageProps = WorkspaceJoinUserPageRoute & WorkspaceJoinUserPageOnyxProps; let isJoinLinkUsed = false; diff --git a/src/pages/workspace/WorkspaceMembersPage.tsx b/src/pages/workspace/WorkspaceMembersPage.tsx index 027a7509ec0d..e226f6068718 100644 --- a/src/pages/workspace/WorkspaceMembersPage.tsx +++ b/src/pages/workspace/WorkspaceMembersPage.tsx @@ -1,5 +1,4 @@ import {useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import lodashIsEqual from 'lodash/isEqual'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import type {TextInput} from 'react-native'; @@ -34,6 +33,7 @@ import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; @@ -53,7 +53,9 @@ import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscree import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; import WorkspacePageWithSections from './WorkspacePageWithSections'; -type WorkspaceMembersPageProps = WithPolicyAndFullscreenLoadingProps & WithCurrentUserPersonalDetailsProps & StackScreenProps; +type WorkspaceMembersPageProps = WithPolicyAndFullscreenLoadingProps & + WithCurrentUserPersonalDetailsProps & + PlatformStackScreenProps; /** * Inverts an object, equivalent of _.invert diff --git a/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx b/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx index 54d8401a99f8..4f342d91bbc1 100644 --- a/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx +++ b/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -17,6 +16,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import {isControlPolicy} from '@libs/PolicyUtils'; import * as Category from '@userActions/Policy/Category'; @@ -37,7 +37,7 @@ import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscree import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; import ToggleSettingOptionRow from './workflows/ToggleSettingsOptionRow'; -type WorkspaceMoreFeaturesPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceMoreFeaturesPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; type Item = { icon: IconAsset; diff --git a/src/pages/workspace/WorkspaceProfileAddressPage.tsx b/src/pages/workspace/WorkspaceProfileAddressPage.tsx index 321471db4c69..57f55e468b1f 100644 --- a/src/pages/workspace/WorkspaceProfileAddressPage.tsx +++ b/src/pages/workspace/WorkspaceProfileAddressPage.tsx @@ -1,8 +1,8 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import type {FormOnyxValues} from '@components/Form/types'; import useLocalize from '@hooks/useLocalize'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AddressPage from '@pages/AddressPage'; import {updateAddress} from '@userActions/Policy/Policy'; @@ -14,7 +14,7 @@ import withPolicy from './withPolicy'; type WorkspaceProfileAddressPagePolicyProps = WithPolicyProps; -type WorkspaceProfileAddressPageProps = StackScreenProps & WorkspaceProfileAddressPagePolicyProps; +type WorkspaceProfileAddressPageProps = PlatformStackScreenProps & WorkspaceProfileAddressPagePolicyProps; function WorkspaceProfileAddressPage({policy, route}: WorkspaceProfileAddressPageProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/WorkspaceProfilePage.tsx b/src/pages/workspace/WorkspaceProfilePage.tsx index 1413ad968069..74b62159b7e1 100644 --- a/src/pages/workspace/WorkspaceProfilePage.tsx +++ b/src/pages/workspace/WorkspaceProfilePage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import type {ImageStyle, StyleProp} from 'react-native'; import {Image, StyleSheet, View} from 'react-native'; @@ -22,6 +21,7 @@ import useThemeIllustrations from '@hooks/useThemeIllustrations'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import Parser from '@libs/Parser'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -38,7 +38,7 @@ import type {WithPolicyProps} from './withPolicy'; import withPolicy from './withPolicy'; import WorkspacePageWithSections from './WorkspacePageWithSections'; -type WorkspaceProfilePageProps = WithPolicyProps & StackScreenProps; +type WorkspaceProfilePageProps = WithPolicyProps & PlatformStackScreenProps; function WorkspaceProfilePage({policyDraft, policy: policyProp, route}: WorkspaceProfilePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/accounting/intacct/EnterSageIntacctCredentialsPage.tsx b/src/pages/workspace/accounting/intacct/EnterSageIntacctCredentialsPage.tsx index 9814e5cef996..d7eee7648a69 100644 --- a/src/pages/workspace/accounting/intacct/EnterSageIntacctCredentialsPage.tsx +++ b/src/pages/workspace/accounting/intacct/EnterSageIntacctCredentialsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; @@ -13,13 +12,14 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {connectToSageIntacct} from '@libs/actions/connections/SageIntacct'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/SageIntactCredentialsForm'; -type SageIntacctPrerequisitesPageProps = StackScreenProps; +type SageIntacctPrerequisitesPageProps = PlatformStackScreenProps; function EnterSageIntacctCredentialsPage({route}: SageIntacctPrerequisitesPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/accounting/intacct/ExistingConnectionsPage.tsx b/src/pages/workspace/accounting/intacct/ExistingConnectionsPage.tsx index a034699454ed..9829fc569f53 100644 --- a/src/pages/workspace/accounting/intacct/ExistingConnectionsPage.tsx +++ b/src/pages/workspace/accounting/intacct/ExistingConnectionsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -9,12 +8,13 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {copyExistingPolicyConnection} from '@libs/actions/connections'; import {getAdminPoliciesConnectedToSageIntacct} from '@libs/actions/Policy/Policy'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import type SCREENS from '@src/SCREENS'; -type ExistingConnectionsPageProps = StackScreenProps; +type ExistingConnectionsPageProps = PlatformStackScreenProps; function ExistingConnectionsPage({route}: ExistingConnectionsPageProps) { const {translate, datetimeToRelative} = useLocalize(); diff --git a/src/pages/workspace/accounting/intacct/SageIntacctPrerequisitesPage.tsx b/src/pages/workspace/accounting/intacct/SageIntacctPrerequisitesPage.tsx index 1c60065a08c8..56f11640ea7c 100644 --- a/src/pages/workspace/accounting/intacct/SageIntacctPrerequisitesPage.tsx +++ b/src/pages/workspace/accounting/intacct/SageIntacctPrerequisitesPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo, useRef} from 'react'; import {View} from 'react-native'; // eslint-disable-next-line no-restricted-imports @@ -16,6 +15,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import fileDownload from '@libs/fileDownload'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportActionContextMenu'; import * as Link from '@userActions/Link'; @@ -23,7 +23,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type SageIntacctPrerequisitesPageProps = StackScreenProps; +type SageIntacctPrerequisitesPageProps = PlatformStackScreenProps; function SageIntacctPrerequisitesPage({route}: SageIntacctPrerequisitesPageProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/accounting/intacct/export/SageIntacctDefaultVendorPage.tsx b/src/pages/workspace/accounting/intacct/export/SageIntacctDefaultVendorPage.tsx index 213f561fb4e9..4ca7d5d349ec 100644 --- a/src/pages/workspace/accounting/intacct/export/SageIntacctDefaultVendorPage.tsx +++ b/src/pages/workspace/accounting/intacct/export/SageIntacctDefaultVendorPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; import BlockingView from '@components/BlockingViews/BlockingView'; @@ -12,6 +11,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import {getSageIntacctNonReimbursableActiveDefaultVendor, getSageIntacctVendors, settingsPendingAction} from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import variables from '@styles/variables'; @@ -22,7 +22,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {Connections} from '@src/types/onyx/Policy'; -type SageIntacctDefaultVendorPageProps = StackScreenProps; +type SageIntacctDefaultVendorPageProps = PlatformStackScreenProps; function SageIntacctDefaultVendorPage({route}: SageIntacctDefaultVendorPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/accounting/intacct/import/SageIntacctEditUserDimensionsPage.tsx b/src/pages/workspace/accounting/intacct/import/SageIntacctEditUserDimensionsPage.tsx index cd10e270d7d2..8c92aee4722c 100644 --- a/src/pages/workspace/accounting/intacct/import/SageIntacctEditUserDimensionsPage.tsx +++ b/src/pages/workspace/accounting/intacct/import/SageIntacctEditUserDimensionsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; import ConfirmModal from '@components/ConfirmModal'; @@ -22,6 +21,7 @@ import { } from '@libs/actions/connections/SageIntacct'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import {settingsPendingAction} from '@libs/PolicyUtils'; import CONST from '@src/CONST'; @@ -31,7 +31,7 @@ import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/SageIntacctDimensionsForm'; import DimensionTypeSelector from './DimensionTypeSelector'; -type SageIntacctEditUserDimensionsPageProps = StackScreenProps; +type SageIntacctEditUserDimensionsPageProps = PlatformStackScreenProps; function SageIntacctEditUserDimensionsPage({route}: SageIntacctEditUserDimensionsPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/accounting/intacct/import/SageIntacctMappingsTypePage.tsx b/src/pages/workspace/accounting/intacct/import/SageIntacctMappingsTypePage.tsx index 73f35cc7bfdb..7e181cdb65c6 100644 --- a/src/pages/workspace/accounting/intacct/import/SageIntacctMappingsTypePage.tsx +++ b/src/pages/workspace/accounting/intacct/import/SageIntacctMappingsTypePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo} from 'react'; import RadioListItem from '@components/SelectionList/RadioListItem'; import SelectionScreen from '@components/SelectionScreen'; @@ -9,6 +8,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {updateSageIntacctMappingValue} from '@libs/actions/connections/SageIntacct'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import {settingsPendingAction} from '@libs/PolicyUtils'; import * as Policy from '@userActions/Policy/Policy'; @@ -17,7 +17,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {SageIntacctMappingName, SageIntacctMappingValue} from '@src/types/onyx/Policy'; -type SageIntacctMappingsTypePageProps = StackScreenProps; +type SageIntacctMappingsTypePageProps = PlatformStackScreenProps; function SageIntacctMappingsTypePage({route}: SageIntacctMappingsTypePageProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/accounting/intacct/import/SageIntacctToggleMappingsPage.tsx b/src/pages/workspace/accounting/intacct/import/SageIntacctToggleMappingsPage.tsx index 82757d8d9ae1..af85a65a39c9 100644 --- a/src/pages/workspace/accounting/intacct/import/SageIntacctToggleMappingsPage.tsx +++ b/src/pages/workspace/accounting/intacct/import/SageIntacctToggleMappingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React from 'react'; import ConnectionLayout from '@components/ConnectionLayout'; @@ -11,6 +10,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {clearSageIntacctErrorField, updateSageIntacctMappingValue} from '@libs/actions/connections/SageIntacct'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import {areSettingsInErrorFields, settingsPendingAction} from '@libs/PolicyUtils'; import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow'; @@ -20,7 +20,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {SageIntacctMappingName, SageIntacctMappingValue} from '@src/types/onyx/Policy'; -type SageIntacctToggleMappingsPageProps = StackScreenProps; +type SageIntacctToggleMappingsPageProps = PlatformStackScreenProps; type DisplayTypeTranslationKeys = { titleKey: TranslationPaths; diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteExistingConnectionsPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteExistingConnectionsPage.tsx index a83a5dab716e..77b01ed43689 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteExistingConnectionsPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteExistingConnectionsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import ConnectionLayout from '@components/ConnectionLayout'; @@ -8,13 +7,14 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {copyExistingPolicyConnection} from '@libs/actions/connections'; import {getAdminPoliciesConnectedToNetSuite} from '@libs/actions/Policy/Policy'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ExistingConnectionsPageProps = StackScreenProps; +type ExistingConnectionsPageProps = PlatformStackScreenProps; function NetSuiteExistingConnectionsPage({route}: ExistingConnectionsPageProps) { const {translate, datetimeToRelative} = useLocalize(); diff --git a/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx b/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx index abc98f1c4d42..a39a9aeb4206 100644 --- a/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx +++ b/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useState} from 'react'; import {View} from 'react-native'; import Computer from '@assets/images/laptop-with-second-screen-sync.svg'; @@ -17,8 +16,9 @@ import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import LoadingPage from '@pages/LoadingPage'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; -type RequireQuickBooksDesktopModalProps = StackScreenProps; +type RequireQuickBooksDesktopModalProps = PlatformStackScreenProps; function RequireQuickBooksDesktopModal({route}: RequireQuickBooksDesktopModalProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx b/src/pages/workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx index 8fe390075d8d..b7f06b12f28d 100644 --- a/src/pages/workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx +++ b/src/pages/workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import Computer from '@assets/images/laptop-with-second-screen-x.svg'; @@ -14,8 +13,9 @@ import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; -type RequireQuickBooksDesktopModalProps = StackScreenProps; +type RequireQuickBooksDesktopModalProps = PlatformStackScreenProps; function RequireQuickBooksDesktopModal({route}: RequireQuickBooksDesktopModalProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/accounting/reconciliation/CardReconciliationPage.tsx b/src/pages/workspace/accounting/reconciliation/CardReconciliationPage.tsx index c907095c4301..86fc05054cc5 100644 --- a/src/pages/workspace/accounting/reconciliation/CardReconciliationPage.tsx +++ b/src/pages/workspace/accounting/reconciliation/CardReconciliationPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {useOnyx} from 'react-native-onyx'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -10,6 +9,7 @@ import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as AccountingUtils from '@libs/AccountingUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -23,7 +23,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {ConnectionName} from '@src/types/onyx/Policy'; -type CardReconciliationPageProps = WithPolicyConnectionsProps & StackScreenProps; +type CardReconciliationPageProps = WithPolicyConnectionsProps & PlatformStackScreenProps; function CardReconciliationPage({policy, route}: CardReconciliationPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/accounting/reconciliation/ReconciliationAccountSettingsPage.tsx b/src/pages/workspace/accounting/reconciliation/ReconciliationAccountSettingsPage.tsx index f79b7920f77b..e2d6aef05450 100644 --- a/src/pages/workspace/accounting/reconciliation/ReconciliationAccountSettingsPage.tsx +++ b/src/pages/workspace/accounting/reconciliation/ReconciliationAccountSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {useOnyx} from 'react-native-onyx'; import ConnectionLayout from '@components/ConnectionLayout'; @@ -11,6 +10,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as AccountingUtils from '@libs/AccountingUtils'; import {getLastFourDigits} from '@libs/BankAccountUtils'; import * as CardUtils from '@libs/CardUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -21,7 +21,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type ReconciliationAccountSettingsPageProps = StackScreenProps; +type ReconciliationAccountSettingsPageProps = PlatformStackScreenProps; function ReconciliationAccountSettingsPage({route}: ReconciliationAccountSettingsPageProps) { const {policyID, connection} = route.params; diff --git a/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx index bb49c5212fb2..adcf515719a8 100644 --- a/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroOrganizationConfigurationPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {View} from 'react-native'; import BlockingView from '@components/BlockingViews/BlockingView'; @@ -12,6 +11,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as Xero from '@libs/actions/connections/Xero'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import {findCurrentXeroOrganization, getXeroTenants} from '@libs/PolicyUtils'; import withPolicy from '@pages/workspace/withPolicy'; @@ -22,7 +22,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type XeroOrganizationConfigurationPageProps = WithPolicyProps & StackScreenProps; +type XeroOrganizationConfigurationPageProps = WithPolicyProps & PlatformStackScreenProps; function XeroOrganizationConfigurationPage({ policy, route: { diff --git a/src/pages/workspace/categories/CategoryApproverPage.tsx b/src/pages/workspace/categories/CategoryApproverPage.tsx index 649681db6155..78f5f579bf93 100644 --- a/src/pages/workspace/categories/CategoryApproverPage.tsx +++ b/src/pages/workspace/categories/CategoryApproverPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -8,6 +7,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CategoryUtils from '@libs/CategoryUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -15,7 +15,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type EditCategoryPageProps = StackScreenProps; +type EditCategoryPageProps = PlatformStackScreenProps; function CategoryApproverPage({ route: { diff --git a/src/pages/workspace/categories/CategoryDefaultTaxRatePage.tsx b/src/pages/workspace/categories/CategoryDefaultTaxRatePage.tsx index 16ea5b9bd2a7..a87dae907aea 100644 --- a/src/pages/workspace/categories/CategoryDefaultTaxRatePage.tsx +++ b/src/pages/workspace/categories/CategoryDefaultTaxRatePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -10,6 +9,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CategoryUtils from '@libs/CategoryUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -18,7 +18,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {TaxRate} from '@src/types/onyx'; -type EditCategoryPageProps = StackScreenProps; +type EditCategoryPageProps = PlatformStackScreenProps; function CategoryDefaultTaxRatePage({ route: { diff --git a/src/pages/workspace/categories/CategoryDescriptionHintPage.tsx b/src/pages/workspace/categories/CategoryDescriptionHintPage.tsx index d16d66ce3ea3..26bd66833929 100644 --- a/src/pages/workspace/categories/CategoryDescriptionHintPage.tsx +++ b/src/pages/workspace/categories/CategoryDescriptionHintPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -12,6 +11,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -21,7 +21,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceCategoryDescriptionHintForm'; -type EditCategoryPageProps = StackScreenProps; +type EditCategoryPageProps = PlatformStackScreenProps; function CategoryDescriptionHintPage({ route: { diff --git a/src/pages/workspace/categories/CategoryFlagAmountsOverPage.tsx b/src/pages/workspace/categories/CategoryFlagAmountsOverPage.tsx index 6b675f740785..dbd491197d37 100644 --- a/src/pages/workspace/categories/CategoryFlagAmountsOverPage.tsx +++ b/src/pages/workspace/categories/CategoryFlagAmountsOverPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -14,6 +13,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -25,7 +25,7 @@ import INPUT_IDS from '@src/types/form/WorkspaceCategoryFlagAmountsOverForm'; import type {PolicyCategoryExpenseLimitType} from '@src/types/onyx/PolicyCategory'; import ExpenseLimitTypeSelector from './ExpenseLimitTypeSelector/ExpenseLimitTypeSelector'; -type EditCategoryPageProps = StackScreenProps; +type EditCategoryPageProps = PlatformStackScreenProps; function CategoryFlagAmountsOverPage({ route: { diff --git a/src/pages/workspace/categories/CategoryGLCodePage.tsx b/src/pages/workspace/categories/CategoryGLCodePage.tsx index 131f17a14242..8e95eeae51d4 100644 --- a/src/pages/workspace/categories/CategoryGLCodePage.tsx +++ b/src/pages/workspace/categories/CategoryGLCodePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {useOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; @@ -11,6 +10,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -20,7 +20,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceCategoryForm'; -type EditCategoryPageProps = StackScreenProps; +type EditCategoryPageProps = PlatformStackScreenProps; function CategoryGLCodePage({route}: EditCategoryPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/categories/CategoryPayrollCodePage.tsx b/src/pages/workspace/categories/CategoryPayrollCodePage.tsx index df5ba802a566..43014547b6f5 100644 --- a/src/pages/workspace/categories/CategoryPayrollCodePage.tsx +++ b/src/pages/workspace/categories/CategoryPayrollCodePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {useOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; @@ -11,6 +10,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -20,7 +20,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceCategoryForm'; -type EditCategoryPageProps = StackScreenProps; +type EditCategoryPageProps = PlatformStackScreenProps; function CategoryPayrollCodePage({route}: EditCategoryPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/categories/CategoryRequireReceiptsOverPage.tsx b/src/pages/workspace/categories/CategoryRequireReceiptsOverPage.tsx index 7d526ede42b5..4c57a8b9ab2e 100644 --- a/src/pages/workspace/categories/CategoryRequireReceiptsOverPage.tsx +++ b/src/pages/workspace/categories/CategoryRequireReceiptsOverPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -11,6 +10,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -19,7 +19,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type EditCategoryPageProps = StackScreenProps; +type EditCategoryPageProps = PlatformStackScreenProps; function getInitiallyFocusedOptionKey(isAlwaysSelected: boolean, isNeverSelected: boolean): ValueOf { if (isAlwaysSelected) { diff --git a/src/pages/workspace/categories/CategorySettingsPage.tsx b/src/pages/workspace/categories/CategorySettingsPage.tsx index 137d32fb0b78..b6726abceeae 100644 --- a/src/pages/workspace/categories/CategorySettingsPage.tsx +++ b/src/pages/workspace/categories/CategorySettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useMemo, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -21,6 +20,7 @@ import * as CategoryUtils from '@libs/CategoryUtils'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import {isControlPolicy} from '@libs/PolicyUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -33,7 +33,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type CategorySettingsPageProps = StackScreenProps; +type CategorySettingsPageProps = PlatformStackScreenProps; function CategorySettingsPage({ route: { diff --git a/src/pages/workspace/categories/CreateCategoryPage.tsx b/src/pages/workspace/categories/CreateCategoryPage.tsx index 472cba1215af..0b431cef46b8 100644 --- a/src/pages/workspace/categories/CreateCategoryPage.tsx +++ b/src/pages/workspace/categories/CreateCategoryPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; @@ -8,6 +7,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -23,7 +23,7 @@ type WorkspaceCreateCategoryPageOnyxProps = { policyCategories: OnyxEntry; }; -type CreateCategoryPageProps = WorkspaceCreateCategoryPageOnyxProps & StackScreenProps; +type CreateCategoryPageProps = WorkspaceCreateCategoryPageOnyxProps & PlatformStackScreenProps; function CreateCategoryPage({route, policyCategories}: CreateCategoryPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/categories/EditCategoryPage.tsx b/src/pages/workspace/categories/EditCategoryPage.tsx index 224233fff318..4a7047ce82de 100644 --- a/src/pages/workspace/categories/EditCategoryPage.tsx +++ b/src/pages/workspace/categories/EditCategoryPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; @@ -8,6 +7,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Category from '@userActions/Policy/Category'; @@ -23,7 +23,7 @@ type WorkspaceEditCategoryPageOnyxProps = { policyCategories: OnyxEntry; }; -type EditCategoryPageProps = WorkspaceEditCategoryPageOnyxProps & StackScreenProps; +type EditCategoryPageProps = WorkspaceEditCategoryPageOnyxProps & PlatformStackScreenProps; function EditCategoryPage({route, policyCategories}: EditCategoryPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/categories/ImportCategoriesPage.tsx b/src/pages/workspace/categories/ImportCategoriesPage.tsx index d0eecc54ab9c..cdb0cae964b1 100644 --- a/src/pages/workspace/categories/ImportCategoriesPage.tsx +++ b/src/pages/workspace/categories/ImportCategoriesPage.tsx @@ -1,14 +1,14 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import ImportSpreedsheet from '@components/ImportSpreadsheet'; import usePolicy from '@hooks/usePolicy'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ImportCategoriesPageProps = StackScreenProps; +type ImportCategoriesPageProps = PlatformStackScreenProps; function ImportCategoriesPage({route}: ImportCategoriesPageProps) { const policyID = route.params.policyID; diff --git a/src/pages/workspace/categories/ImportedCategoriesPage.tsx b/src/pages/workspace/categories/ImportedCategoriesPage.tsx index 041e2b77c91e..05db9a7ce0f6 100644 --- a/src/pages/workspace/categories/ImportedCategoriesPage.tsx +++ b/src/pages/workspace/categories/ImportedCategoriesPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {useOnyx} from 'react-native-onyx'; import ConfirmModal from '@components/ConfirmModal'; @@ -12,6 +11,7 @@ import {closeImportPage} from '@libs/actions/ImportSpreadsheet'; import {importPolicyCategories} from '@libs/actions/Policy/Category'; import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import {isControlPolicy} from '@libs/PolicyUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -22,7 +22,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {Errors} from '@src/types/onyx/OnyxCommon'; -type ImportedCategoriesPageProps = StackScreenProps; +type ImportedCategoriesPageProps = PlatformStackScreenProps; function ImportedCategoriesPage({route}: ImportedCategoriesPageProps) { const {translate} = useLocalize(); const [spreadsheet] = useOnyx(ONYXKEYS.IMPORTED_SPREADSHEET); diff --git a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx index 1286d504d3ec..6afe13c388ff 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect, useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import lodashSortBy from 'lodash/sortBy'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; @@ -36,6 +35,7 @@ import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -54,7 +54,7 @@ type PolicyOption = ListItem & { keyForList: string; }; -type WorkspaceCategoriesPageProps = StackScreenProps; +type WorkspaceCategoriesPageProps = PlatformStackScreenProps; function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) { const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout(); diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardAccountSelectCardPage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardAccountSelectCardPage.tsx index 3df8598fde2d..4a7555f4a91f 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardAccountSelectCardPage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardAccountSelectCardPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -13,6 +12,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Policy from '@libs/actions/Policy/Policy'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -23,7 +23,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import {getExportMenuItem} from './utils'; -type WorkspaceCompanyCardAccountSelectCardProps = StackScreenProps; +type WorkspaceCompanyCardAccountSelectCardProps = PlatformStackScreenProps; function WorkspaceCompanyCardAccountSelectCardPage({route}: WorkspaceCompanyCardAccountSelectCardProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx index df4e9635e851..d460daa15a05 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {format} from 'date-fns'; import React, {useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; @@ -20,6 +19,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as Policy from '@libs/actions/Policy/Policy'; import * as CardUtils from '@libs/CardUtils'; import * as ErrorUtils from '@libs/ErrorUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -33,7 +33,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import {getExportMenuItem} from './utils'; -type WorkspaceCompanyCardDetailsPageProps = StackScreenProps; +type WorkspaceCompanyCardDetailsPageProps = PlatformStackScreenProps; function WorkspaceCompanyCardDetailsPage({route}: WorkspaceCompanyCardDetailsPageProps) { const {policyID, cardID, backTo, bank} = route.params; diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardEditCardNamePage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardEditCardNamePage.tsx index c55d575838a8..d5baa5c9f711 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardEditCardNamePage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardEditCardNamePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {useOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; @@ -11,6 +10,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Policy from '@libs/actions/Policy/Policy'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import Navigation from '@navigation/Navigation'; @@ -22,7 +22,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/EditExpensifyCardNameForm'; -type WorkspaceCompanyCardEditCardNamePageProps = StackScreenProps; +type WorkspaceCompanyCardEditCardNamePageProps = PlatformStackScreenProps; function WorkspaceCompanyCardEditCardNamePage({route}: WorkspaceCompanyCardEditCardNamePageProps) { const {policyID, cardID, bank} = route.params; diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardFeedSelectorPage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardFeedSelectorPage.tsx index 767f08068f95..8c1bc3fde81d 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardFeedSelectorPage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardFeedSelectorPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {useOnyx} from 'react-native-onyx'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -12,6 +11,7 @@ import type {ListItem} from '@components/SelectionList/types'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import Navigation from '@navigation/Navigation'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -46,7 +46,7 @@ const mockedData: CardFeeds = { }, }; -type WorkspaceCompanyCardFeedSelectorPageProps = StackScreenProps; +type WorkspaceCompanyCardFeedSelectorPageProps = PlatformStackScreenProps; function WorkspaceCompanyCardFeedSelectorPage({route}: WorkspaceCompanyCardFeedSelectorPageProps) { const {policyID} = route.params; diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx index 25f1487381ab..8b5fb143cb53 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {ActivityIndicator} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -7,6 +6,7 @@ import * as Illustrations from '@components/Icon/Illustrations'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -112,7 +112,7 @@ const mockedCards = { }, } as unknown as WorkspaceCardsList; -type WorkspaceCompanyCardPageProps = StackScreenProps; +type WorkspaceCompanyCardPageProps = PlatformStackScreenProps; function WorkspaceCompanyCardPage({route}: WorkspaceCompanyCardPageProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsSettingsFeedNamePage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsSettingsFeedNamePage.tsx index bacc82331331..d8282816fe09 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsSettingsFeedNamePage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsSettingsFeedNamePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Policy from '@libs/actions/Policy/Policy'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as ValidationUtils from '@libs/ValidationUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -25,7 +25,7 @@ import type SCREENS from '@src/SCREENS'; import type {WorkspaceCompanyCardFeedName} from '@src/types/form/WorkspaceCompanyCardFeedName'; import INPUT_IDS from '@src/types/form/WorkspaceTaxCustomName'; -type WorkspaceCompanyCardsSettingsFeedNamePageProps = StackScreenProps; +type WorkspaceCompanyCardsSettingsFeedNamePageProps = PlatformStackScreenProps; function WorkspaceCompanyCardsSettingsFeedNamePage({ route: { diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsSettingsPage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsSettingsPage.tsx index 42f89c44ee8b..e79e605f9770 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsSettingsPage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Policy from '@libs/actions/Policy/Policy'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow'; @@ -23,7 +23,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceCompanyCardsSettingsPageProps = StackScreenProps; +type WorkspaceCompanyCardsSettingsPageProps = PlatformStackScreenProps; function WorkspaceCompanyCardsSettingsPage({ route: { diff --git a/src/pages/workspace/distanceRates/CreateDistanceRatePage.tsx b/src/pages/workspace/distanceRates/CreateDistanceRatePage.tsx index 7566f458fcff..58545d244ffc 100644 --- a/src/pages/workspace/distanceRates/CreateDistanceRatePage.tsx +++ b/src/pages/workspace/distanceRates/CreateDistanceRatePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import AmountForm from '@components/AmountForm'; @@ -12,6 +11,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import {getOptimisticRateName, validateRateValue} from '@libs/PolicyDistanceRatesUtils'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -24,7 +24,7 @@ import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/PolicyCreateDistanceRateForm'; import type {Rate} from '@src/types/onyx/Policy'; -type CreateDistanceRatePageProps = StackScreenProps; +type CreateDistanceRatePageProps = PlatformStackScreenProps; function CreateDistanceRatePage({route}: CreateDistanceRatePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRateDetailsPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRateDetailsPage.tsx index 0b7d925f2ee2..10501a569449 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRateDetailsPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRateDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -17,6 +16,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -27,7 +27,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {Rate, TaxRateAttributes} from '@src/types/onyx/Policy'; -type PolicyDistanceRateDetailsPageProps = StackScreenProps; +type PolicyDistanceRateDetailsPageProps = PlatformStackScreenProps; function PolicyDistanceRateDetailsPage({route}: PolicyDistanceRateDetailsPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRateEditPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRateEditPage.tsx index 30ab4b40d958..df301ae9b1e1 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRateEditPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRateEditPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {Keyboard} from 'react-native'; import AmountForm from '@components/AmountForm'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import {validateRateValue} from '@libs/PolicyDistanceRatesUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -22,7 +22,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/PolicyDistanceRateEditForm'; -type PolicyDistanceRateEditPageProps = StackScreenProps; +type PolicyDistanceRateEditPageProps = PlatformStackScreenProps; function PolicyDistanceRateEditPage({route}: PolicyDistanceRateEditPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRateTaxRateEditPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRateTaxRateEditPage.tsx index 9fe090222691..4e9d03008f17 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRateTaxRateEditPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRateTaxRateEditPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -6,6 +5,7 @@ import TaxPicker from '@components/TaxPicker'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type * as OptionsListUtils from '@libs/OptionsListUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -17,7 +17,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type PolicyDistanceRateTaxRateEditPageProps = WithPolicyOnyxProps & StackScreenProps; +type PolicyDistanceRateTaxRateEditPageProps = WithPolicyOnyxProps & PlatformStackScreenProps; function PolicyDistanceRateTaxRateEditPage({route, policy}: PolicyDistanceRateTaxRateEditPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRateTaxReclaimableEditPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRateTaxReclaimableEditPage.tsx index f20272dd2f5c..91495572cbe0 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRateTaxReclaimableEditPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRateTaxReclaimableEditPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import AmountForm from '@components/AmountForm'; import FormProvider from '@components/Form/FormProvider'; @@ -10,6 +9,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import {validateTaxClaimableValue} from '@libs/PolicyDistanceRatesUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -21,7 +21,8 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/PolicyDistanceRateTaxReclaimableOnEditForm'; -type PolicyDistanceRateTaxReclaimableEditPageProps = WithPolicyOnyxProps & StackScreenProps; +type PolicyDistanceRateTaxReclaimableEditPageProps = WithPolicyOnyxProps & + PlatformStackScreenProps; function PolicyDistanceRateTaxReclaimableEditPage({route, policy}: PolicyDistanceRateTaxReclaimableEditPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx index 661388a1657d..1dc03f328bce 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect, useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; import Button from '@components/Button'; @@ -25,6 +24,7 @@ import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as DistanceRate from '@userActions/Policy/DistanceRate'; @@ -36,7 +36,7 @@ import type {CustomUnit, Rate} from '@src/types/onyx/Policy'; type RateForList = ListItem & {value: string}; -type PolicyDistanceRatesPageProps = StackScreenProps; +type PolicyDistanceRatesPageProps = PlatformStackScreenProps; function PolicyDistanceRatesPage({ route: { diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage.tsx index e7199e61c2dd..c9de7ab4ca6c 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -16,6 +15,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -30,7 +30,7 @@ import type {CustomUnit} from '@src/types/onyx/Policy'; import CategorySelector from './CategorySelector'; import UnitSelector from './UnitSelector'; -type PolicyDistanceRatesSettingsPageProps = StackScreenProps; +type PolicyDistanceRatesSettingsPageProps = PlatformStackScreenProps; function PolicyDistanceRatesSettingsPage({route}: PolicyDistanceRatesSettingsPageProps) { const policyID = route.params.policyID; diff --git a/src/pages/workspace/expensifyCard/WorkspaceCardSettingsPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceCardSettingsPage.tsx index b34397cc43e3..2458e5033ab2 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceCardSettingsPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceCardSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -11,6 +10,7 @@ import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {getLastFourDigits} from '@libs/BankAccountUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -20,7 +20,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceCardSettingsPageProps = StackScreenProps; +type WorkspaceCardSettingsPageProps = PlatformStackScreenProps; function WorkspaceCardSettingsPage({route}: WorkspaceCardSettingsPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx index f1075d85cfd8..a1ca4ce22e10 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useEffect, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; @@ -19,6 +18,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import getClickedTargetLocation from '@libs/getClickedTargetLocation'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {FullScreenNavigatorParamList} from '@navigation/types'; import variables from '@styles/variables'; @@ -40,7 +40,7 @@ type WorkspaceCardsListLabelProps = { }; function WorkspaceCardsListLabel({type, value, style}: WorkspaceCardsListLabelProps) { - const route = useRoute>(); + const route = useRoute>(); const policy = usePolicy(route.params.policyID); const styles = useThemeStyles(); const {windowWidth} = useWindowDimensions(); diff --git a/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitPage.tsx index bb8515fe85d3..d2e96abd2fe0 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo, useState} from 'react'; import {useOnyx} from 'react-native-onyx'; import AmountForm from '@components/AmountForm'; @@ -12,6 +11,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import Navigation from '@navigation/Navigation'; @@ -26,7 +26,7 @@ import INPUT_IDS from '@src/types/form/EditExpensifyCardLimitForm'; type ConfirmationWarningTranslationPaths = 'workspace.expensifyCard.smartLimitWarning' | 'workspace.expensifyCard.monthlyLimitWarning' | 'workspace.expensifyCard.fixedLimitWarning'; -type WorkspaceEditCardLimitPageProps = StackScreenProps; +type WorkspaceEditCardLimitPageProps = PlatformStackScreenProps; function WorkspaceEditCardLimitPage({route}: WorkspaceEditCardLimitPageProps) { const {policyID, cardID} = route.params; diff --git a/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx b/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx index 94a1382b4454..a75e7272b089 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo, useState} from 'react'; import {useOnyx} from 'react-native-onyx'; import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; @@ -13,6 +12,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -24,7 +24,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceEditCardLimitTypePageProps = StackScreenProps; +type WorkspaceEditCardLimitTypePageProps = PlatformStackScreenProps; function WorkspaceEditCardLimitTypePage({route}: WorkspaceEditCardLimitTypePageProps) { const {policyID, cardID} = route.params; diff --git a/src/pages/workspace/expensifyCard/WorkspaceEditCardNamePage.tsx b/src/pages/workspace/expensifyCard/WorkspaceEditCardNamePage.tsx index c5eb8a53930a..74128fdd05ae 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceEditCardNamePage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceEditCardNamePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {useOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; @@ -10,6 +9,7 @@ import TextInput from '@components/TextInput'; import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import Navigation from '@navigation/Navigation'; @@ -22,7 +22,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/EditExpensifyCardNameForm'; -type WorkspaceEditCardNamePageProps = StackScreenProps; +type WorkspaceEditCardNamePageProps = PlatformStackScreenProps; function WorkspaceEditCardNamePage({route}: WorkspaceEditCardNamePageProps) { const {policyID, cardID} = route.params; diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardBankAccounts.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardBankAccounts.tsx index b8b8776df048..8d38219c6c79 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardBankAccounts.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardBankAccounts.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {getLastFourDigits} from '@libs/BankAccountUtils'; import * as CardUtils from '@libs/CardUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -24,7 +24,7 @@ import type SCREENS from '@src/SCREENS'; import type {BankName} from '@src/types/onyx/Bank'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type WorkspaceExpensifyCardBankAccountsProps = StackScreenProps; +type WorkspaceExpensifyCardBankAccountsProps = PlatformStackScreenProps; function WorkspaceExpensifyCardBankAccounts({route}: WorkspaceExpensifyCardBankAccountsProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardDetailsPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardDetailsPage.tsx index 03b489d93402..cd0b9ff21ce6 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardDetailsPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -21,6 +20,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; import * as CurrencyUtils from '@libs/CurrencyUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -33,7 +33,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceExpensifyCardDetailsPageProps = StackScreenProps; +type WorkspaceExpensifyCardDetailsPageProps = PlatformStackScreenProps; function WorkspaceExpensifyCardDetailsPage({route}: WorkspaceExpensifyCardDetailsPageProps) { const {policyID, cardID, backTo} = route.params; diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx index ef38cb509e78..cd36077f5ca2 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardListPage.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import React, {useCallback, useMemo} from 'react'; import type {ListRenderItemInfo} from 'react-native'; import {FlatList, View} from 'react-native'; @@ -16,6 +15,7 @@ import usePolicy from '@hooks/usePolicy'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@navigation/types'; @@ -32,7 +32,7 @@ import WorkspaceCardListRow from './WorkspaceCardListRow'; type WorkspaceExpensifyCardListPageProps = { /** Route from navigation */ - route: RouteProp; + route: PlatformStackRouteProp; /** List of Expensify cards */ cardsList: OnyxEntry; diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPage.tsx index bc29918fe450..4fd741be7684 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPage.tsx @@ -1,11 +1,11 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {ActivityIndicator} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -16,7 +16,7 @@ import type SCREENS from '@src/SCREENS'; import WorkspaceExpensifyCardListPage from './WorkspaceExpensifyCardListPage'; import WorkspaceExpensifyCardPageEmptyState from './WorkspaceExpensifyCardPageEmptyState'; -type WorkspaceExpensifyCardPageProps = StackScreenProps; +type WorkspaceExpensifyCardPageProps = PlatformStackScreenProps; function WorkspaceExpensifyCardPage({route}: WorkspaceExpensifyCardPageProps) { const policyID = route.params.policyID ?? '-1'; diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx index 7dc6293e23ea..95491a3196ca 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -12,6 +11,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import Navigation from '@navigation/Navigation'; import type {WithPolicyAndFullscreenLoadingProps} from '@pages/workspace/withPolicyAndFullscreenLoading'; @@ -40,7 +40,7 @@ const expensifyCardFeatures: FeatureListItem[] = [ ]; type WorkspaceExpensifyCardPageEmptyStateProps = { - route: StackScreenProps['route']; + route: PlatformStackScreenProps['route']; } & WithPolicyAndFullscreenLoadingProps; function WorkspaceExpensifyCardPageEmptyState({route, policy}: WorkspaceExpensifyCardPageEmptyStateProps) { diff --git a/src/pages/workspace/expensifyCard/WorkspaceSettlementAccountPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceSettlementAccountPage.tsx index 369973485499..4d49a86a410a 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceSettlementAccountPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceSettlementAccountPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as AccountingUtils from '@libs/AccountingUtils'; import {getLastFourDigits} from '@libs/BankAccountUtils'; import * as CardUtils from '@libs/CardUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -27,7 +27,7 @@ import type SCREENS from '@src/SCREENS'; import type {BankName} from '@src/types/onyx/Bank'; import type {ConnectionName} from '@src/types/onyx/Policy'; -type WorkspaceSettlementAccountPageProps = StackScreenProps; +type WorkspaceSettlementAccountPageProps = PlatformStackScreenProps; function WorkspaceSettlementAccountPage({route}: WorkspaceSettlementAccountPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/expensifyCard/WorkspaceSettlementFrequencyPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceSettlementFrequencyPage.tsx index 62db3af81da6..3ff957b75d46 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceSettlementFrequencyPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceSettlementFrequencyPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -9,17 +8,15 @@ import RadioListItem from '@components/SelectionList/RadioListItem'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as PolicyUtils from '@libs/PolicyUtils'; -import Navigation from '@navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; -import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Card from '@userActions/Card'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceSettlementFrequencyPageProps = StackScreenProps; +type WorkspaceSettlementFrequencyPageProps = PlatformStackScreenProps; function WorkspaceSettlementFrequencyPage({route}: WorkspaceSettlementFrequencyPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/expensifyCard/issueNew/IssueNewCardPage.tsx b/src/pages/workspace/expensifyCard/issueNew/IssueNewCardPage.tsx index 3b777765c7b8..d3dad7e94fdc 100644 --- a/src/pages/workspace/expensifyCard/issueNew/IssueNewCardPage.tsx +++ b/src/pages/workspace/expensifyCard/issueNew/IssueNewCardPage.tsx @@ -1,6 +1,6 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; import {useOnyx} from 'react-native-onyx'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import type {WithPolicyAndFullscreenLoadingProps} from '@pages/workspace/withPolicyAndFullscreenLoading'; @@ -16,7 +16,7 @@ import ConfirmationStep from './ConfirmationStep'; import LimitStep from './LimitStep'; import LimitTypeStep from './LimitTypeStep'; -type IssueNewCardPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type IssueNewCardPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function IssueNewCardPage({policy, route}: IssueNewCardPageProps) { const [issueNewCard] = useOnyx(ONYXKEYS.ISSUE_NEW_EXPENSIFY_CARD); diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx b/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx index b269d93df098..02496ed9e228 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx +++ b/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx @@ -1,9 +1,9 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; @@ -14,7 +14,7 @@ import WorkspaceInvoicesNoVBAView from './WorkspaceInvoicesNoVBAView'; import WorkspaceInvoicesVBAView from './WorkspaceInvoicesVBAView'; import WorkspaceInvoiceVBASection from './WorkspaceInvoiceVBASection'; -type WorkspaceInvoicesPageProps = StackScreenProps; +type WorkspaceInvoicesPageProps = PlatformStackScreenProps; function WorkspaceInvoicesPage({route}: WorkspaceInvoicesPageProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); diff --git a/src/pages/workspace/invoices/WorkspaceInvoicingDetailsName.tsx b/src/pages/workspace/invoices/WorkspaceInvoicingDetailsName.tsx index 80f323431baa..c7f4bd3b504a 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicingDetailsName.tsx +++ b/src/pages/workspace/invoices/WorkspaceInvoicingDetailsName.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {useOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ValidationUtils from '@libs/ValidationUtils'; import Navigation from '@navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import CONST from '@src/CONST'; @@ -19,7 +19,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceInvoicesCompanyNameForm'; -type WorkspaceInvoicingDetailsNameProps = StackScreenProps; +type WorkspaceInvoicingDetailsNameProps = PlatformStackScreenProps; function WorkspaceInvoicingDetailsName({route}: WorkspaceInvoicingDetailsNameProps) { const {policyID} = route.params; diff --git a/src/pages/workspace/invoices/WorkspaceInvoicingDetailsWebsite.tsx b/src/pages/workspace/invoices/WorkspaceInvoicingDetailsWebsite.tsx index 0427aef81db3..5c62cb8c4d9b 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicingDetailsWebsite.tsx +++ b/src/pages/workspace/invoices/WorkspaceInvoicingDetailsWebsite.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React from 'react'; import {useOnyx} from 'react-native-onyx'; @@ -11,6 +10,7 @@ import TextInput from '@components/TextInput'; import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as Url from '@libs/Url'; import * as ValidationUtils from '@libs/ValidationUtils'; import Navigation from '@navigation/Navigation'; @@ -21,7 +21,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceInvoicesCompanyWebsiteForm'; -type WorkspaceInvoicingDetailsWebsiteProps = StackScreenProps; +type WorkspaceInvoicingDetailsWebsiteProps = PlatformStackScreenProps; function WorkspaceInvoicingDetailsWebsite({route}: WorkspaceInvoicingDetailsWebsiteProps) { const {policyID} = route.params; diff --git a/src/pages/workspace/members/ImportMembersPage.tsx b/src/pages/workspace/members/ImportMembersPage.tsx index 6fff3085b472..05c153356fee 100644 --- a/src/pages/workspace/members/ImportMembersPage.tsx +++ b/src/pages/workspace/members/ImportMembersPage.tsx @@ -1,11 +1,11 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import ImportSpreedsheet from '@components/ImportSpreadsheet'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ImportMembersPageProps = StackScreenProps; +type ImportMembersPageProps = PlatformStackScreenProps; function ImportMembersPage({route}: ImportMembersPageProps) { const policyID = route.params.policyID; diff --git a/src/pages/workspace/members/ImportedMembersPage.tsx b/src/pages/workspace/members/ImportedMembersPage.tsx index 468c64818dba..e0204e40f4fa 100644 --- a/src/pages/workspace/members/ImportedMembersPage.tsx +++ b/src/pages/workspace/members/ImportedMembersPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {useOnyx} from 'react-native-onyx'; import ConfirmModal from '@components/ConfirmModal'; @@ -11,13 +10,14 @@ import {closeImportPage} from '@libs/actions/ImportSpreadsheet'; import {importPolicyMembers} from '@libs/actions/Policy/Member'; import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ImportedMembersPageProps = StackScreenProps; +type ImportedMembersPageProps = PlatformStackScreenProps; function ImportedMembersPage({route}: ImportedMembersPageProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx b/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx index 52814f5da23d..cc3b63d084c3 100644 --- a/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx +++ b/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -24,6 +23,7 @@ import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; import * as CurrencyUtils from '@libs/CurrencyUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import shouldRenderTransferOwnerButton from '@libs/shouldRenderTransferOwnerButton'; import Navigation from '@navigation/Navigation'; @@ -50,7 +50,7 @@ type WorkspacePolicyOnyxProps = { type WorkspaceMemberDetailsPageProps = Omit & WorkspacePolicyOnyxProps & - StackScreenProps; + PlatformStackScreenProps; function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceMemberDetailsPageProps) { const policyID = route.params.policyID; diff --git a/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx b/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx index 2c1bb1f66e2d..c93e84f96d61 100644 --- a/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx +++ b/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useState} from 'react'; import ExpensifyCardImage from '@assets/images/expensify-card.svg'; import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton'; @@ -11,6 +10,7 @@ import type {ListItem} from '@components/SelectionList/types'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; @@ -49,7 +49,7 @@ const mockedData: CardFeeds = { }, }; -type WorkspaceMemberNewCardPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceMemberNewCardPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function WorkspaceMemberNewCardPage({route, personalDetails}: WorkspaceMemberNewCardPageProps) { const {policyID} = route.params; diff --git a/src/pages/workspace/members/WorkspaceOwnerChangeErrorPage.tsx b/src/pages/workspace/members/WorkspaceOwnerChangeErrorPage.tsx index b24a2a53d0ef..82ec34fd152f 100644 --- a/src/pages/workspace/members/WorkspaceOwnerChangeErrorPage.tsx +++ b/src/pages/workspace/members/WorkspaceOwnerChangeErrorPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import Button from '@components/Button'; @@ -11,6 +10,7 @@ import Text from '@components/Text'; import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -19,7 +19,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceOwnerChangeSuccessPageProps = StackScreenProps; +type WorkspaceOwnerChangeSuccessPageProps = PlatformStackScreenProps; function WorkspaceOwnerChangeErrorPage({route}: WorkspaceOwnerChangeSuccessPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/members/WorkspaceOwnerChangeSuccessPage.tsx b/src/pages/workspace/members/WorkspaceOwnerChangeSuccessPage.tsx index f5c9dd398bf6..fc2f919370e2 100644 --- a/src/pages/workspace/members/WorkspaceOwnerChangeSuccessPage.tsx +++ b/src/pages/workspace/members/WorkspaceOwnerChangeSuccessPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import ConfirmationPage from '@components/ConfirmationPage'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -6,6 +5,7 @@ import LottieAnimations from '@components/LottieAnimations'; import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -14,7 +14,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceOwnerChangeSuccessPageProps = StackScreenProps; +type WorkspaceOwnerChangeSuccessPageProps = PlatformStackScreenProps; function WorkspaceOwnerChangeSuccessPage({route}: WorkspaceOwnerChangeSuccessPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/members/WorkspaceOwnerChangeWrapperPage.tsx b/src/pages/workspace/members/WorkspaceOwnerChangeWrapperPage.tsx index 325e1112ab4b..caea1e4d4eba 100644 --- a/src/pages/workspace/members/WorkspaceOwnerChangeWrapperPage.tsx +++ b/src/pages/workspace/members/WorkspaceOwnerChangeWrapperPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -8,6 +7,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; import CardAuthenticationModal from '@pages/settings/Subscription/CardAuthenticationModal'; @@ -22,7 +22,7 @@ import type SCREENS from '@src/SCREENS'; import WorkspaceOwnerChangeCheck from './WorkspaceOwnerChangeCheck'; import WorkspaceOwnerPaymentCardForm from './WorkspaceOwnerPaymentCardForm'; -type WorkspaceOwnerChangeWrapperPageProps = WithPolicyOnyxProps & StackScreenProps; +type WorkspaceOwnerChangeWrapperPageProps = WithPolicyOnyxProps & PlatformStackScreenProps; function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWrapperPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx b/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx index 8dbd90c9e929..f0b1319196c6 100644 --- a/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx +++ b/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useRef} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import * as ReportField from '@libs/actions/Policy/ReportField'; import DateUtils from '@libs/DateUtils'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -30,7 +30,7 @@ import INPUT_IDS from '@src/types/form/WorkspaceReportFieldForm'; import InitialListValueSelector from './InitialListValueSelector'; import TypeSelector from './TypeSelector'; -type CreateReportFieldsPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type CreateReportFieldsPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; const defaultDate = DateUtils.extractDate(new Date().toString()); diff --git a/src/pages/workspace/reportFields/ReportFieldsAddListValuePage.tsx b/src/pages/workspace/reportFields/ReportFieldsAddListValuePage.tsx index f404a6fbae4f..dd483b466d63 100644 --- a/src/pages/workspace/reportFields/ReportFieldsAddListValuePage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsAddListValuePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo} from 'react'; import {Keyboard} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -13,6 +12,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportField from '@libs/actions/Policy/ReportField'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as WorkspaceReportFieldUtils from '@libs/WorkspaceReportFieldUtils'; @@ -25,7 +25,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceReportFieldForm'; -type ReportFieldsAddListValuePageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type ReportFieldsAddListValuePageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function ReportFieldsAddListValuePage({ policy, diff --git a/src/pages/workspace/reportFields/ReportFieldsEditValuePage.tsx b/src/pages/workspace/reportFields/ReportFieldsEditValuePage.tsx index bfc885000c98..5ce2461bab16 100644 --- a/src/pages/workspace/reportFields/ReportFieldsEditValuePage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsEditValuePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {Keyboard} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -13,6 +12,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportField from '@libs/actions/Policy/ReportField'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as WorkspaceReportFieldUtils from '@libs/WorkspaceReportFieldUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -24,7 +24,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceReportFieldForm'; -type ReportFieldsEditValuePageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type ReportFieldsEditValuePageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function ReportFieldsEditValuePage({ policy, diff --git a/src/pages/workspace/reportFields/ReportFieldsInitialValuePage.tsx b/src/pages/workspace/reportFields/ReportFieldsInitialValuePage.tsx index 74ed854a0495..13b1afb7e3d7 100644 --- a/src/pages/workspace/reportFields/ReportFieldsInitialValuePage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsInitialValuePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; @@ -13,6 +12,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportField from '@libs/actions/Policy/ReportField'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; @@ -29,7 +29,8 @@ import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceReportFieldForm'; import ReportFieldsInitialListValuePicker from './InitialListValueSelector/ReportFieldsInitialListValuePicker'; -type ReportFieldsInitialValuePageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type ReportFieldsInitialValuePageProps = WithPolicyAndFullscreenLoadingProps & + PlatformStackScreenProps; function ReportFieldsInitialValuePage({ policy, route: { diff --git a/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx b/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx index 3cc647b4d681..31057bf41f20 100644 --- a/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -26,6 +25,7 @@ import * as ReportField from '@libs/actions/Policy/ReportField'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -49,7 +49,7 @@ type ValueListItem = ListItem & { orderWeight?: number; }; -type ReportFieldsListValuesPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type ReportFieldsListValuesPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function ReportFieldsListValuesPage({ policy, diff --git a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx index cc6460d20641..34e3da1e6453 100644 --- a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useState} from 'react'; import {View} from 'react-native'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as WorkspaceReportFieldUtils from '@libs/WorkspaceReportFieldUtils'; @@ -25,7 +25,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ReportFieldsSettingsPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type ReportFieldsSettingsPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function ReportFieldsSettingsPage({ policy, diff --git a/src/pages/workspace/reportFields/ReportFieldsValueSettingsPage.tsx b/src/pages/workspace/reportFields/ReportFieldsValueSettingsPage.tsx index 0886f2cd683c..08b94fcc4aee 100644 --- a/src/pages/workspace/reportFields/ReportFieldsValueSettingsPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsValueSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import usePrevious from '@hooks/usePrevious'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportField from '@libs/actions/Policy/ReportField'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -27,7 +27,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ReportFieldsValueSettingsPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type ReportFieldsValueSettingsPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function ReportFieldsValueSettingsPage({ policy, diff --git a/src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx b/src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx index 603e610b6f5d..ac5cc704a77a 100644 --- a/src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx +++ b/src/pages/workspace/reportFields/WorkspaceReportFieldsPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect, useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import {Str} from 'expensify-common'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; @@ -33,6 +32,7 @@ import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; @@ -51,7 +51,7 @@ type ReportFieldForList = ListItem & { orderWeight?: number; }; -type WorkspaceReportFieldsPageProps = StackScreenProps; +type WorkspaceReportFieldsPageProps = PlatformStackScreenProps; function WorkspaceReportFieldsPage({ route: { diff --git a/src/pages/workspace/rules/PolicyRulesPage.tsx b/src/pages/workspace/rules/PolicyRulesPage.tsx index 1fce2fb7bfcf..747a98660037 100644 --- a/src/pages/workspace/rules/PolicyRulesPage.tsx +++ b/src/pages/workspace/rules/PolicyRulesPage.tsx @@ -1,10 +1,10 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import usePermissions from '@hooks/usePermissions'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; @@ -14,7 +14,7 @@ import type SCREENS from '@src/SCREENS'; import ExpenseReportRulesSection from './ExpenseReportRulesSection'; import IndividualExpenseRulesSection from './IndividualExpenseRulesSection'; -type PolicyRulesPageProps = StackScreenProps; +type PolicyRulesPageProps = PlatformStackScreenProps; function PolicyRulesPage({route}: PolicyRulesPageProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/rules/RulesAutoApproveReportsUnderPage.tsx b/src/pages/workspace/rules/RulesAutoApproveReportsUnderPage.tsx index 679c8489cd29..c628a3ad135d 100644 --- a/src/pages/workspace/rules/RulesAutoApproveReportsUnderPage.tsx +++ b/src/pages/workspace/rules/RulesAutoApproveReportsUnderPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import AmountForm from '@components/AmountForm'; @@ -13,6 +12,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -22,7 +22,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/RulesAutoApproveReportsUnderModalForm'; -type RulesAutoApproveReportsUnderPageProps = StackScreenProps; +type RulesAutoApproveReportsUnderPageProps = PlatformStackScreenProps; function RulesAutoApproveReportsUnderPage({route}: RulesAutoApproveReportsUnderPageProps) { const {policyID} = route.params; diff --git a/src/pages/workspace/rules/RulesAutoPayReportsUnderPage.tsx b/src/pages/workspace/rules/RulesAutoPayReportsUnderPage.tsx index b21ad1f4a1f3..8a63f2e303ec 100644 --- a/src/pages/workspace/rules/RulesAutoPayReportsUnderPage.tsx +++ b/src/pages/workspace/rules/RulesAutoPayReportsUnderPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import AmountForm from '@components/AmountForm'; @@ -14,6 +13,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as PolicyActions from '@userActions/Policy/Policy'; @@ -22,7 +22,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/RulesAutoPayReportsUnderModalForm'; -type RulesAutoPayReportsUnderPageProps = StackScreenProps; +type RulesAutoPayReportsUnderPageProps = PlatformStackScreenProps; function RulesAutoPayReportsUnderPage({route}: RulesAutoPayReportsUnderPageProps) { const policyID = route?.params?.policyID ?? '-1'; diff --git a/src/pages/workspace/rules/RulesBillableDefaultPage.tsx b/src/pages/workspace/rules/RulesBillableDefaultPage.tsx index 900007f9a573..2b9d42ed748c 100644 --- a/src/pages/workspace/rules/RulesBillableDefaultPage.tsx +++ b/src/pages/workspace/rules/RulesBillableDefaultPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -10,6 +9,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Policy from '@userActions/Policy/Policy'; @@ -17,7 +17,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type RulesBillableDefaultPageProps = StackScreenProps; +type RulesBillableDefaultPageProps = PlatformStackScreenProps; function RulesBillableDefaultPage({ route: { diff --git a/src/pages/workspace/rules/RulesCustomNamePage.tsx b/src/pages/workspace/rules/RulesCustomNamePage.tsx index 4be433651a78..394960ef80fb 100644 --- a/src/pages/workspace/rules/RulesCustomNamePage.tsx +++ b/src/pages/workspace/rules/RulesCustomNamePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import BulletList from '@components/BulletList'; @@ -15,6 +14,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as PolicyActions from '@userActions/Policy/Policy'; @@ -23,7 +23,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/RulesCustomNameModalForm'; -type RulesCustomNamePageProps = StackScreenProps; +type RulesCustomNamePageProps = PlatformStackScreenProps; function RulesCustomNamePage({route}: RulesCustomNamePageProps) { const policyID = route?.params?.policyID ?? '-1'; diff --git a/src/pages/workspace/rules/RulesMaxExpenseAgePage.tsx b/src/pages/workspace/rules/RulesMaxExpenseAgePage.tsx index 2424a14c08f5..345bf96d94a6 100644 --- a/src/pages/workspace/rules/RulesMaxExpenseAgePage.tsx +++ b/src/pages/workspace/rules/RulesMaxExpenseAgePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as PolicyActions from '@userActions/Policy/Policy'; @@ -20,7 +20,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/RulesMaxExpenseAgeForm'; -type RulesMaxExpenseAgePageProps = StackScreenProps; +type RulesMaxExpenseAgePageProps = PlatformStackScreenProps; function RulesMaxExpenseAgePage({ route: { diff --git a/src/pages/workspace/rules/RulesMaxExpenseAmountPage.tsx b/src/pages/workspace/rules/RulesMaxExpenseAmountPage.tsx index 79ae647ae224..3d59833db9d8 100644 --- a/src/pages/workspace/rules/RulesMaxExpenseAmountPage.tsx +++ b/src/pages/workspace/rules/RulesMaxExpenseAmountPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import AmountForm from '@components/AmountForm'; @@ -13,6 +12,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as PolicyActions from '@userActions/Policy/Policy'; @@ -21,7 +21,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/RulesMaxExpenseAmountForm'; -type RulesMaxExpenseAmountPageProps = StackScreenProps; +type RulesMaxExpenseAmountPageProps = PlatformStackScreenProps; function RulesMaxExpenseAmountPage({ route: { diff --git a/src/pages/workspace/rules/RulesRandomReportAuditPage.tsx b/src/pages/workspace/rules/RulesRandomReportAuditPage.tsx index dcc9a58e65e9..19e9d79ba8e6 100644 --- a/src/pages/workspace/rules/RulesRandomReportAuditPage.tsx +++ b/src/pages/workspace/rules/RulesRandomReportAuditPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -21,7 +21,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/RulesRandomReportAuditModalForm'; -type RulesRandomReportAuditPageProps = StackScreenProps; +type RulesRandomReportAuditPageProps = PlatformStackScreenProps; function RulesRandomReportAuditPage({route}: RulesRandomReportAuditPageProps) { const policyID = route?.params?.policyID ?? '-1'; diff --git a/src/pages/workspace/rules/RulesReceiptRequiredAmountPage.tsx b/src/pages/workspace/rules/RulesReceiptRequiredAmountPage.tsx index 96e6be6eeb95..27df41c4c371 100644 --- a/src/pages/workspace/rules/RulesReceiptRequiredAmountPage.tsx +++ b/src/pages/workspace/rules/RulesReceiptRequiredAmountPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import AmountForm from '@components/AmountForm'; @@ -13,6 +12,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as PolicyActions from '@userActions/Policy/Policy'; @@ -21,7 +21,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/RulesRequiredReceiptAmountForm'; -type RulesReceiptRequiredAmountPageProps = StackScreenProps; +type RulesReceiptRequiredAmountPageProps = PlatformStackScreenProps; function RulesReceiptRequiredAmountPage({ route: { diff --git a/src/pages/workspace/tags/EditTagPage.tsx b/src/pages/workspace/tags/EditTagPage.tsx index c8cef174dbdb..d79225ce665c 100644 --- a/src/pages/workspace/tags/EditTagPage.tsx +++ b/src/pages/workspace/tags/EditTagPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {Keyboard} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -13,6 +12,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -29,7 +29,7 @@ type EditTagPageOnyxProps = { policyTags: OnyxEntry; }; -type EditTagPageProps = EditTagPageOnyxProps & StackScreenProps; +type EditTagPageProps = EditTagPageOnyxProps & PlatformStackScreenProps; function EditTagPage({route, policyTags}: EditTagPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/tags/ImportTagsPage.tsx b/src/pages/workspace/tags/ImportTagsPage.tsx index 0dd7c01f0af3..9f7e1af0a9e5 100644 --- a/src/pages/workspace/tags/ImportTagsPage.tsx +++ b/src/pages/workspace/tags/ImportTagsPage.tsx @@ -1,11 +1,11 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import ImportSpreedsheet from '@components/ImportSpreadsheet'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type ImportTagsPageProps = StackScreenProps; +type ImportTagsPageProps = PlatformStackScreenProps; function ImportTagsPage({route}: ImportTagsPageProps) { const policyID = route.params.policyID; diff --git a/src/pages/workspace/tags/ImportedTagsPage.tsx b/src/pages/workspace/tags/ImportedTagsPage.tsx index b2e95edc43a4..dd68f8f7e5f9 100644 --- a/src/pages/workspace/tags/ImportedTagsPage.tsx +++ b/src/pages/workspace/tags/ImportedTagsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo, useState} from 'react'; import {useOnyx} from 'react-native-onyx'; import ConfirmModal from '@components/ConfirmModal'; @@ -12,6 +11,7 @@ import {closeImportPage} from '@libs/actions/ImportSpreadsheet'; import {importPolicyTags} from '@libs/actions/Policy/Tag'; import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import {isControlPolicy} from '@libs/PolicyUtils'; @@ -21,7 +21,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {Errors} from '@src/types/onyx/OnyxCommon'; -type ImportedTagsPageProps = StackScreenProps; +type ImportedTagsPageProps = PlatformStackScreenProps; function ImportedTagsPage({route}: ImportedTagsPageProps) { const {translate} = useLocalize(); diff --git a/src/pages/workspace/tags/TagApproverPage.tsx b/src/pages/workspace/tags/TagApproverPage.tsx index 874754b2cf4b..b6ea97c4d1be 100644 --- a/src/pages/workspace/tags/TagApproverPage.tsx +++ b/src/pages/workspace/tags/TagApproverPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -6,6 +5,7 @@ import WorkspaceMembersSelectionList from '@components/WorkspaceMembersSelection import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -13,7 +13,7 @@ import * as Tag from '@userActions/Policy/Tag'; import CONST from '@src/CONST'; import type SCREENS from '@src/SCREENS'; -type TagApproverPageProps = StackScreenProps; +type TagApproverPageProps = PlatformStackScreenProps; function TagApproverPage({route}: TagApproverPageProps) { const {policyID, tagName} = route.params; diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index 8360108be362..3bd20f7dbc69 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {useOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -22,7 +22,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceTagForm'; -type EditTagGLCodePageProps = StackScreenProps; +type EditTagGLCodePageProps = PlatformStackScreenProps; function TagGLCodePage({route}: EditTagGLCodePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/tags/TagSettingsPage.tsx b/src/pages/workspace/tags/TagSettingsPage.tsx index aedd7e36a274..68d833441438 100644 --- a/src/pages/workspace/tags/TagSettingsPage.tsx +++ b/src/pages/workspace/tags/TagSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useMemo} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -18,6 +17,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -29,7 +29,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type TagSettingsPageProps = StackScreenProps; +type TagSettingsPageProps = PlatformStackScreenProps; function TagSettingsPage({route, navigation}: TagSettingsPageProps) { const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${route.params.policyID}`); diff --git a/src/pages/workspace/tags/WorkspaceCreateTagPage.tsx b/src/pages/workspace/tags/WorkspaceCreateTagPage.tsx index cde6a55c5258..b3c9ac10cf2c 100644 --- a/src/pages/workspace/tags/WorkspaceCreateTagPage.tsx +++ b/src/pages/workspace/tags/WorkspaceCreateTagPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {Keyboard} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -14,6 +13,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -30,7 +30,7 @@ type WorkspaceCreateTagPageOnyxProps = { policyTags: OnyxEntry; }; -type CreateTagPageProps = WorkspaceCreateTagPageOnyxProps & StackScreenProps; +type CreateTagPageProps = WorkspaceCreateTagPageOnyxProps & PlatformStackScreenProps; function CreateTagPage({route, policyTags}: CreateTagPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx b/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx index d63799169ca8..019f840f9ab5 100644 --- a/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -14,6 +13,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Tag from '@libs/actions/Policy/Tag'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -28,7 +28,7 @@ type WorkspaceEditTagsPageOnyxProps = { policyTags: OnyxEntry; }; -type WorkspaceEditTagsPageProps = WorkspaceEditTagsPageOnyxProps & StackScreenProps; +type WorkspaceEditTagsPageProps = WorkspaceEditTagsPageOnyxProps & PlatformStackScreenProps; function WorkspaceEditTagsPage({route, policyTags}: WorkspaceEditTagsPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/tags/WorkspaceTagsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsPage.tsx index a30b56d6dda4..3cb3219e2d6b 100644 --- a/src/pages/workspace/tags/WorkspaceTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceTagsPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect, useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import lodashSortBy from 'lodash/sortBy'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; @@ -35,6 +34,7 @@ import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -48,7 +48,7 @@ import type {PendingAction} from '@src/types/onyx/OnyxCommon'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {PolicyTag, PolicyTagList, TagListItem} from './types'; -type WorkspaceTagsPageProps = StackScreenProps; +type WorkspaceTagsPageProps = PlatformStackScreenProps; function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) { const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout(); diff --git a/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx index b5b527dc4dfa..5d99c2f0b375 100644 --- a/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -16,6 +15,7 @@ import usePermissions from '@hooks/usePermissions'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Tag from '@libs/actions/Policy/Tag'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; @@ -31,7 +31,7 @@ type WorkspaceTagsSettingsPageOnyxProps = { /** Collection of tags attached to a policy */ policyTags: OnyxEntry; }; -type WorkspaceTagsSettingsPageProps = WorkspaceTagsSettingsPageOnyxProps & StackScreenProps; +type WorkspaceTagsSettingsPageProps = WorkspaceTagsSettingsPageOnyxProps & PlatformStackScreenProps; /** * The pending state might be set by either setPolicyBillableMode or disableWorkspaceBillableExpenses. diff --git a/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx b/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx index a01707a04740..77599165674c 100644 --- a/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx @@ -1,5 +1,4 @@ import {useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -27,6 +26,7 @@ import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -40,7 +40,7 @@ import type SCREENS from '@src/SCREENS'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {TagListItem} from './types'; -type WorkspaceViewTagsProps = StackScreenProps; +type WorkspaceViewTagsProps = PlatformStackScreenProps; function WorkspaceViewTagsPage({route}: WorkspaceViewTagsProps) { const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout(); diff --git a/src/pages/workspace/taxes/NamePage.tsx b/src/pages/workspace/taxes/NamePage.tsx index 0fb495a04574..cc3a22fa4ef9 100644 --- a/src/pages/workspace/taxes/NamePage.tsx +++ b/src/pages/workspace/taxes/NamePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {renamePolicyTax, validateTaxName} from '@libs/actions/TaxRate'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import Parser from '@libs/Parser'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -25,7 +25,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceTaxNameForm'; -type NamePageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type NamePageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function NamePage({ route: { diff --git a/src/pages/workspace/taxes/ValuePage.tsx b/src/pages/workspace/taxes/ValuePage.tsx index 5b724d625e5b..1da36229a7be 100644 --- a/src/pages/workspace/taxes/ValuePage.tsx +++ b/src/pages/workspace/taxes/ValuePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import AmountForm from '@components/AmountForm'; import FormProvider from '@components/Form/FormProvider'; @@ -12,6 +11,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {updatePolicyTaxValue, validateTaxValue} from '@libs/actions/TaxRate'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -24,7 +24,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceTaxValueForm'; -type ValuePageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type ValuePageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function ValuePage({ route: { diff --git a/src/pages/workspace/taxes/WorkspaceCreateTaxPage.tsx b/src/pages/workspace/taxes/WorkspaceCreateTaxPage.tsx index 4a31f7d16b1e..4dddcb42265d 100644 --- a/src/pages/workspace/taxes/WorkspaceCreateTaxPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceCreateTaxPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {createPolicyTax, getNextTaxCode, getTaxValueWithPercentage, validateTaxName, validateTaxValue} from '@libs/actions/TaxRate'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -26,7 +26,7 @@ import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceNewTaxForm'; import type {TaxRate} from '@src/types/onyx'; -type WorkspaceCreateTaxPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceCreateTaxPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function WorkspaceCreateTaxPage({ policy, diff --git a/src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx b/src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx index 0f50ed8fe0b8..7c4eb45bb9a0 100644 --- a/src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useState} from 'react'; import {View} from 'react-native'; import ConfirmModal from '@components/ConfirmModal'; @@ -15,6 +14,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {clearTaxRateFieldError, deletePolicyTaxes, setPolicyTaxesEnabled} from '@libs/actions/TaxRate'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -25,7 +25,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceEditTaxPageBaseProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceEditTaxPageBaseProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function WorkspaceEditTaxPage({ route: { diff --git a/src/pages/workspace/taxes/WorkspaceTaxCodePage.tsx b/src/pages/workspace/taxes/WorkspaceTaxCodePage.tsx index e9005a8a58f2..05536a4257e4 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxCodePage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxCodePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; @@ -13,6 +12,7 @@ import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import {setPolicyTaxCode, validateTaxCode} from '@libs/actions/TaxRate'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import CONST from '@src/CONST'; @@ -21,7 +21,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceTaxCodeForm'; -type WorkspaceTaxCodePageProps = StackScreenProps; +type WorkspaceTaxCodePageProps = PlatformStackScreenProps; function WorkspaceTaxCodePage({route}: WorkspaceTaxCodePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index db180bddb532..0c616c07fddd 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect, useIsFocused} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; import Button from '@components/Button'; @@ -28,6 +27,7 @@ import {clearTaxRateError, deletePolicyTaxes, setPolicyTaxesEnabled} from '@libs import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import type {FullScreenNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -39,7 +39,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {TaxRate} from '@src/types/onyx'; -type WorkspaceTaxesPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceTaxesPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function WorkspaceTaxesPage({ policy, diff --git a/src/pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName.tsx b/src/pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName.tsx index f24a388011ab..88edc1f25797 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; @@ -11,6 +10,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as ValidationUtils from '@libs/ValidationUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -24,7 +24,8 @@ import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceTaxCustomName'; import type {WorkspaceTaxCustomName} from '@src/types/form/WorkspaceTaxCustomName'; -type WorkspaceTaxesSettingsCustomTaxNameProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceTaxesSettingsCustomTaxNameProps = WithPolicyAndFullscreenLoadingProps & + PlatformStackScreenProps; function WorkspaceTaxesSettingsCustomTaxName({ route: { diff --git a/src/pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency.tsx b/src/pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency.tsx index 2e40667c1daf..c481b5f5adee 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -7,6 +6,7 @@ import TaxPicker from '@components/TaxPicker'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import type * as OptionsListUtils from '@libs/OptionsListUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; @@ -19,7 +19,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; type WorkspaceTaxesSettingsForeignCurrencyProps = WithPolicyAndFullscreenLoadingProps & - StackScreenProps; + PlatformStackScreenProps; function WorkspaceTaxesSettingsForeignCurrency({ route: { params: {policyID}, diff --git a/src/pages/workspace/taxes/WorkspaceTaxesSettingsPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesSettingsPage.tsx index bfd688facc5f..4de7c320cd2f 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesSettingsPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesSettingsPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -9,6 +8,7 @@ import ScrollView from '@components/ScrollView'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import withPolicyAndFullscreenLoading from '@pages/workspace/withPolicyAndFullscreenLoading'; @@ -17,7 +17,7 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -type WorkspaceTaxesSettingsPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceTaxesSettingsPageProps = WithPolicyAndFullscreenLoadingProps & PlatformStackScreenProps; function WorkspaceTaxesSettingsPage({ route: { diff --git a/src/pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency.tsx b/src/pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency.tsx index c46efe3fd243..81b81b7cba4c 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import {View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -7,6 +6,7 @@ import TaxPicker from '@components/TaxPicker'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import type * as OptionsListUtils from '@libs/OptionsListUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; @@ -19,7 +19,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; type WorkspaceTaxesSettingsWorkspaceCurrencyProps = WithPolicyAndFullscreenLoadingProps & - StackScreenProps; + PlatformStackScreenProps; function WorkspaceTaxesSettingsWorkspaceCurrency({ route: { diff --git a/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx b/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx index a8c9705663d4..0522aa59162f 100644 --- a/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx +++ b/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx @@ -1,5 +1,4 @@ import {useNavigation} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect} from 'react'; import {useOnyx} from 'react-native-onyx'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -8,6 +7,7 @@ import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -18,7 +18,7 @@ import type SCREENS from '@src/SCREENS'; import UpgradeConfirmation from './UpgradeConfirmation'; import UpgradeIntro from './UpgradeIntro'; -type WorkspaceUpgradePageProps = StackScreenProps; +type WorkspaceUpgradePageProps = PlatformStackScreenProps; function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { const navigation = useNavigation(); diff --git a/src/pages/workspace/withPolicy.tsx b/src/pages/workspace/withPolicy.tsx index e1fdd2b29687..ab2938a463ab 100644 --- a/src/pages/workspace/withPolicy.tsx +++ b/src/pages/workspace/withPolicy.tsx @@ -1,8 +1,8 @@ -import type {RouteProp} from '@react-navigation/native'; import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; import React, {forwardRef} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {useOnyx} from 'react-native-onyx'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, BottomTabNavigatorParamList, FullScreenNavigatorParamList, ReimbursementAccountNavigatorParamList, SettingsNavigatorParamList} from '@navigation/types'; import * as Policy from '@userActions/Policy/Policy'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -12,7 +12,7 @@ import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; type NavigatorsParamList = BottomTabNavigatorParamList & AuthScreensParamList & SettingsNavigatorParamList & ReimbursementAccountNavigatorParamList & FullScreenNavigatorParamList; -type PolicyRoute = RouteProp< +type PolicyRoute = PlatformStackRouteProp< NavigatorsParamList, | typeof SCREENS.REIMBURSEMENT_ACCOUNT_ROOT | typeof SCREENS.WORKSPACE.INITIAL diff --git a/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx b/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx index d026c218910f..c3448c2f7c95 100644 --- a/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx +++ b/src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import type {ValueOf} from 'type-fest'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; @@ -13,6 +12,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import * as Localize from '@libs/Localize'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -27,7 +27,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; type AutoReportingFrequencyKey = Exclude, 'instant'>; type Locale = ValueOf; -type WorkspaceAutoReportingFrequencyPageProps = WithPolicyOnyxProps & StackScreenProps; +type WorkspaceAutoReportingFrequencyPageProps = WithPolicyOnyxProps & PlatformStackScreenProps; type WorkspaceAutoReportingFrequencyPageItem = { text: string; diff --git a/src/pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage.tsx b/src/pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage.tsx index a9f96061ec0a..8336700a7d79 100644 --- a/src/pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage.tsx +++ b/src/pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useState} from 'react'; import type {ValueOf} from 'type-fest'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; @@ -8,6 +7,7 @@ import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import useLocalize from '@hooks/useLocalize'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -21,7 +21,8 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; const DAYS_OF_MONTH = 28; -type WorkspaceAutoReportingMonthlyOffsetProps = WithPolicyOnyxProps & StackScreenProps; +type WorkspaceAutoReportingMonthlyOffsetProps = WithPolicyOnyxProps & + PlatformStackScreenProps; type AutoReportingOffsetKeys = ValueOf; diff --git a/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx b/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx index 17bad8a1a102..76fd4370cbc7 100644 --- a/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx +++ b/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx @@ -1,5 +1,4 @@ import {useFocusEffect} from '@react-navigation/native'; -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -21,6 +20,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import {getPaymentMethodDescription} from '@libs/PaymentUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -42,7 +42,7 @@ import type {ToggleSettingOptionRowProps} from './ToggleSettingsOptionRow'; import {getAutoReportingFrequencyDisplayNames} from './WorkspaceAutoReportingFrequencyPage'; import type {AutoReportingFrequencyKey} from './WorkspaceAutoReportingFrequencyPage'; -type WorkspaceWorkflowsPageProps = WithPolicyProps & StackScreenProps; +type WorkspaceWorkflowsPageProps = WithPolicyProps & PlatformStackScreenProps; function WorkspaceWorkflowsPage({policy, route}: WorkspaceWorkflowsPageProps) { const {translate, preferredLocale} = useLocalize(); diff --git a/src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx b/src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx index 0931492614cc..4b1666968b3b 100644 --- a/src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx +++ b/src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useMemo, useState} from 'react'; import type {SectionListData} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -15,6 +14,7 @@ import useNetwork from '@hooks/useNetwork'; import {formatPhoneNumber} from '@libs/LocalePhoneNumber'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -35,7 +35,7 @@ type WorkspaceWorkflowsPayerPageOnyxProps = { type WorkspaceWorkflowsPayerPageProps = WorkspaceWorkflowsPayerPageOnyxProps & WithPolicyAndFullscreenLoadingProps & - StackScreenProps; + PlatformStackScreenProps; type MemberOption = Omit & {accountID: number}; type MembersSection = SectionListData>; diff --git a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx index 94a56f8fe162..8b164aeba98c 100644 --- a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx +++ b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApproverPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import type {SectionListData} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -19,6 +18,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -35,7 +35,7 @@ import type {Icon} from '@src/types/onyx/OnyxCommon'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; type WorkspaceWorkflowsApprovalsApproverPageProps = WithPolicyAndFullscreenLoadingProps & - StackScreenProps; + PlatformStackScreenProps; type SelectionListApprover = { text: string; diff --git a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx index 4998bf09a333..17fadf188e67 100644 --- a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx +++ b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useRef} from 'react'; // eslint-disable-next-line no-restricted-imports import type {ScrollView} from 'react-native'; @@ -13,6 +12,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import withPolicyAndFullscreenLoading from '@pages/workspace/withPolicyAndFullscreenLoading'; import type {WithPolicyAndFullscreenLoadingProps} from '@pages/workspace/withPolicyAndFullscreenLoading'; @@ -24,7 +24,8 @@ import type SCREENS from '@src/SCREENS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import ApprovalWorkflowEditor from './ApprovalWorkflowEditor'; -type WorkspaceWorkflowsApprovalsCreatePageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceWorkflowsApprovalsCreatePageProps = WithPolicyAndFullscreenLoadingProps & + PlatformStackScreenProps; function WorkspaceWorkflowsApprovalsCreatePage({policy, isLoadingReportData = true, route}: WorkspaceWorkflowsApprovalsCreatePageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx index c2da4e39739a..cf8337f16b8e 100644 --- a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx +++ b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; // eslint-disable-next-line no-restricted-imports import type {ScrollView} from 'react-native'; @@ -13,6 +12,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import {convertPolicyEmployeesToApprovalWorkflows} from '@libs/WorkflowUtils'; @@ -27,7 +27,8 @@ import type ApprovalWorkflow from '@src/types/onyx/ApprovalWorkflow'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import ApprovalWorkflowEditor from './ApprovalWorkflowEditor'; -type WorkspaceWorkflowsApprovalsEditPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; +type WorkspaceWorkflowsApprovalsEditPageProps = WithPolicyAndFullscreenLoadingProps & + PlatformStackScreenProps; function WorkspaceWorkflowsApprovalsEditPage({policy, isLoadingReportData = true, route}: WorkspaceWorkflowsApprovalsEditPageProps) { const styles = useThemeStyles(); diff --git a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx index 697714d55746..8f7553e97fe1 100644 --- a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx +++ b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import type {SectionListData} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -19,6 +18,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -48,7 +48,7 @@ type SelectionListMember = { type MembersSection = SectionListData>; type WorkspaceWorkflowsApprovalsExpensesFromPageProps = WithPolicyAndFullscreenLoadingProps & - StackScreenProps; + PlatformStackScreenProps; function WorkspaceWorkflowsApprovalsExpensesFromPage({policy, isLoadingReportData = true, route}: WorkspaceWorkflowsApprovalsExpensesFromPageProps) { const styles = useThemeStyles(); diff --git a/tests/perf-test/ReportScreen.perf-test.tsx b/tests/perf-test/ReportScreen.perf-test.tsx index 95ac9729e606..8733ad4cd095 100644 --- a/tests/perf-test/ReportScreen.perf-test.tsx +++ b/tests/perf-test/ReportScreen.perf-test.tsx @@ -1,4 +1,3 @@ -import type {StackNavigationProp, StackScreenProps} from '@react-navigation/stack'; import {screen} from '@testing-library/react-native'; import type {ComponentType} from 'react'; import React from 'react'; @@ -9,6 +8,7 @@ import type Animated from 'react-native-reanimated'; import {measurePerformance} from 'reassure'; import type {WithNavigationFocusProps} from '@components/withNavigationFocus'; import type Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackNavigationProp, PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import ComposeProviders from '@src/components/ComposeProviders'; import DragAndDropProvider from '@src/components/DragAndDrop/Provider'; @@ -34,7 +34,7 @@ import * as TestHelper from '../utils/TestHelper'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; import wrapOnyxWithWaitForBatchedUpdates from '../utils/wrapOnyxWithWaitForBatchedUpdates'; -type ReportScreenWrapperProps = StackScreenProps; +type ReportScreenWrapperProps = PlatformStackScreenProps; jest.mock('@src/libs/API', () => ({ write: jest.fn(), @@ -209,7 +209,7 @@ test('[ReportScreen] should render ReportScreen', async () => { await screen.findByTestId(`report-screen-${report.reportID}`); }; - const navigation = {addListener} as unknown as StackNavigationProp; + const navigation = {addListener} as unknown as PlatformStackNavigationProp; await waitForBatchedUpdates(); const reportCollectionDataSet: ReportCollectionDataSet = { @@ -243,7 +243,7 @@ test('[ReportScreen] should render composer', async () => { await screen.findByTestId('composer'); }; - const navigation = {addListener} as unknown as StackNavigationProp; + const navigation = {addListener} as unknown as PlatformStackNavigationProp; await waitForBatchedUpdates(); @@ -278,7 +278,7 @@ test('[ReportScreen] should render report list', async () => { await screen.findByTestId('report-actions-list'); }; - const navigation = {addListener} as unknown as StackNavigationProp; + const navigation = {addListener} as unknown as PlatformStackNavigationProp; await waitForBatchedUpdates(); diff --git a/tests/unit/NextStepUtilsTest.ts b/tests/unit/NextStepUtilsTest.ts index 776c5f95cce7..13d4e85940dc 100644 --- a/tests/unit/NextStepUtilsTest.ts +++ b/tests/unit/NextStepUtilsTest.ts @@ -627,6 +627,10 @@ describe('libs/NextStepUtils', () => { text: ' %expenses.', }, ]; + // mock the report as approved + const originalState = {stateNum: report.stateNum, statusNum: report.statusNum}; + report.stateNum = CONST.REPORT.STATE_NUM.APPROVED; + report.statusNum = CONST.REPORT.STATUS_NUM.APPROVED; return Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, { achAccount: { From cf17480d96bd1267fbf89405a3b1acf921100a95 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 11 Oct 2024 13:00:33 +0200 Subject: [PATCH 002/145] fix: match previous behavior and close keyboard in chat navigator when we swipe the screen --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 94846c04e334..d33a89bfa0af 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -30,6 +30,7 @@ import PusherConnectionManager from '@libs/PusherConnectionManager'; import * as ReportUtils from '@libs/ReportUtils'; import {buildSearchQueryString} from '@libs/SearchUtils'; import * as SessionUtils from '@libs/SessionUtils'; +import hideKeyboardOnSwipe from '@libs/Navigation/AppNavigator/hideKeyboardOnSwipe'; import ConnectionCompletePage from '@pages/ConnectionCompletePage'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import DesktopSignInRedirectPage from '@pages/signin/DesktopSignInRedirectPage'; @@ -392,6 +393,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie }, []); const CentralPaneScreenOptions = { + ...hideKeyboardOnSwipe, headerShown: false, title: 'New Expensify', From 2f4363cca1385ea91e85a5a657468b278dede77f Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 11 Oct 2024 13:16:07 +0200 Subject: [PATCH 003/145] fix: prettier --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 2 +- .../AppNavigator/Navigators/ExplanationModalNavigator.tsx | 2 +- .../AppNavigator/Navigators/FeatureTrainingModalNavigator.tsx | 2 +- src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx | 2 +- src/pages/home/report/withReportAndReportActionOrNotFound.tsx | 2 +- .../workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx | 2 +- .../workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx | 2 +- .../workspace/invoices/WorkspaceInvoicingDetailsName.tsx | 2 +- .../approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx | 2 +- tests/unit/NextStepUtilsTest.ts | 4 ---- 10 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index d33a89bfa0af..a19869e073fa 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -19,6 +19,7 @@ import {READ_COMMANDS} from '@libs/API/types'; import HttpUtils from '@libs/HttpUtils'; import KeyboardShortcut from '@libs/KeyboardShortcut'; import Log from '@libs/Log'; +import hideKeyboardOnSwipe from '@libs/Navigation/AppNavigator/hideKeyboardOnSwipe'; import getCurrentUrl from '@libs/Navigation/currentUrl'; import Navigation from '@libs/Navigation/Navigation'; import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom'; @@ -30,7 +31,6 @@ import PusherConnectionManager from '@libs/PusherConnectionManager'; import * as ReportUtils from '@libs/ReportUtils'; import {buildSearchQueryString} from '@libs/SearchUtils'; import * as SessionUtils from '@libs/SessionUtils'; -import hideKeyboardOnSwipe from '@libs/Navigation/AppNavigator/hideKeyboardOnSwipe'; import ConnectionCompletePage from '@pages/ConnectionCompletePage'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import DesktopSignInRedirectPage from '@pages/signin/DesktopSignInRedirectPage'; diff --git a/src/libs/Navigation/AppNavigator/Navigators/ExplanationModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/ExplanationModalNavigator.tsx index b4626072538f..507abedf7102 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/ExplanationModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/ExplanationModalNavigator.tsx @@ -3,9 +3,9 @@ import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; import ExplanationModal from '@components/ExplanationModal'; import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; +import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; import type {ExplanationModalNavigatorParamList} from '@libs/Navigation/types'; import SCREENS from '@src/SCREENS'; -import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; const Stack = createPlatformStackNavigator(); diff --git a/src/libs/Navigation/AppNavigator/Navigators/FeatureTrainingModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/FeatureTrainingModalNavigator.tsx index 3cc563582709..b5bf352c75f9 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/FeatureTrainingModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/FeatureTrainingModalNavigator.tsx @@ -2,10 +2,10 @@ import React from 'react'; import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; +import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; import type {FeatureTrainingNavigatorParamList} from '@libs/Navigation/types'; import TrackTrainingPage from '@pages/TrackTrainingPage'; import SCREENS from '@src/SCREENS'; -import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; const Stack = createPlatformStackNavigator(); diff --git a/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx b/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx index 47177d60b743..2850ed0538db 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx +++ b/src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx @@ -242,4 +242,4 @@ export default withOnyx, Su key: ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE, selector: EmojiUtils.getPreferredSkinToneIndex, }, -})(forwardRef(SuggestionEmoji)); \ No newline at end of file +})(forwardRef(SuggestionEmoji)); diff --git a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx index 24bdb8f49960..2d9893ab9090 100644 --- a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx +++ b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx @@ -6,6 +6,7 @@ import {useOnyx} from 'react-native-onyx'; import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import getComponentDisplayName from '@libs/getComponentDisplayName'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FlagCommentNavigatorParamList, SplitDetailsNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; @@ -14,7 +15,6 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; type WithReportAndReportActionOrNotFoundProps = PlatformStackScreenProps< FlagCommentNavigatorParamList & SplitDetailsNavigatorParamList, diff --git a/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx b/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx index a39a9aeb4206..d0cf8bb5dad9 100644 --- a/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx +++ b/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx @@ -12,11 +12,11 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as QuickbooksDesktop from '@libs/actions/connections/QuickbooksDesktop'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import LoadingPage from '@pages/LoadingPage'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; type RequireQuickBooksDesktopModalProps = PlatformStackScreenProps; diff --git a/src/pages/workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx b/src/pages/workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx index b7f06b12f28d..b210148adbee 100644 --- a/src/pages/workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx +++ b/src/pages/workspace/accounting/qbd/RequireQuickBooksDesktopPage.tsx @@ -10,10 +10,10 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; -import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; type RequireQuickBooksDesktopModalProps = PlatformStackScreenProps; diff --git a/src/pages/workspace/invoices/WorkspaceInvoicingDetailsName.tsx b/src/pages/workspace/invoices/WorkspaceInvoicingDetailsName.tsx index c7f4bd3b504a..63dd9bfce0ab 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicingDetailsName.tsx +++ b/src/pages/workspace/invoices/WorkspaceInvoicingDetailsName.tsx @@ -9,9 +9,9 @@ import TextInput from '@components/TextInput'; import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import * as ValidationUtils from '@libs/ValidationUtils'; import Navigation from '@navigation/Navigation'; -import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import CONST from '@src/CONST'; diff --git a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx index 17fadf188e67..16aff537b901 100644 --- a/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx +++ b/src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsCreatePage.tsx @@ -10,9 +10,9 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; -import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import withPolicyAndFullscreenLoading from '@pages/workspace/withPolicyAndFullscreenLoading'; import type {WithPolicyAndFullscreenLoadingProps} from '@pages/workspace/withPolicyAndFullscreenLoading'; diff --git a/tests/unit/NextStepUtilsTest.ts b/tests/unit/NextStepUtilsTest.ts index 13d4e85940dc..368295b580ca 100644 --- a/tests/unit/NextStepUtilsTest.ts +++ b/tests/unit/NextStepUtilsTest.ts @@ -592,10 +592,6 @@ describe('libs/NextStepUtils', () => { text: ' a business bank account.', }, ]; - // mock the report as approved - const originalState = {stateNum: report.stateNum, statusNum: report.statusNum}; - report.stateNum = CONST.REPORT.STATE_NUM.APPROVED; - report.statusNum = CONST.REPORT.STATUS_NUM.APPROVED; const result = NextStepUtils.buildNextStep(report, CONST.REPORT.STATUS_NUM.APPROVED); From 2d2627a72e72af14644497b585db466874ba476b Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 11 Oct 2024 13:40:07 +0200 Subject: [PATCH 004/145] fix: partially fix CI checks --- src/pages/OnboardingAccounting/types.ts | 4 ++-- .../home/report/withReportAndReportActionOrNotFound.tsx | 2 +- .../expensifyCard/WorkspaceSettlementFrequencyPage.tsx | 3 +++ tests/unit/NextStepUtilsTest.ts | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/pages/OnboardingAccounting/types.ts b/src/pages/OnboardingAccounting/types.ts index 4f7a3ebc3439..fb9e1e1caac4 100644 --- a/src/pages/OnboardingAccounting/types.ts +++ b/src/pages/OnboardingAccounting/types.ts @@ -1,8 +1,8 @@ -import type {StackScreenProps} from '@react-navigation/stack'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types'; import type SCREENS from '@src/SCREENS'; -type OnboardingAccountingProps = StackScreenProps; +type OnboardingAccountingProps = PlatformStackScreenProps; type BaseOnboardingAccountingProps = OnboardingAccountingProps & { /* Whether to use native styles tailored for native devices */ diff --git a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx index 2d9893ab9090..5d5f025ddbcc 100644 --- a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx +++ b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx @@ -35,7 +35,7 @@ type WithReportAndReportActionOrNotFoundProps = PlatformStackScreenProps< export default function ( WrappedComponent: ComponentType>, -): ComponentType, keyof OnyxProps>> { +): ComponentType> { function WithReportOrNotFound(props: TProps, ref: ForwardedRef) { const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`); const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '-1'}`); diff --git a/src/pages/workspace/expensifyCard/WorkspaceSettlementFrequencyPage.tsx b/src/pages/workspace/expensifyCard/WorkspaceSettlementFrequencyPage.tsx index 3ff957b75d46..52fa4c8890d0 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceSettlementFrequencyPage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceSettlementFrequencyPage.tsx @@ -9,7 +9,10 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; +import * as PolicyUtils from '@libs/PolicyUtils'; +import Navigation from '@navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; +import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Card from '@userActions/Card'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; diff --git a/tests/unit/NextStepUtilsTest.ts b/tests/unit/NextStepUtilsTest.ts index 368295b580ca..776c5f95cce7 100644 --- a/tests/unit/NextStepUtilsTest.ts +++ b/tests/unit/NextStepUtilsTest.ts @@ -592,6 +592,10 @@ describe('libs/NextStepUtils', () => { text: ' a business bank account.', }, ]; + // mock the report as approved + const originalState = {stateNum: report.stateNum, statusNum: report.statusNum}; + report.stateNum = CONST.REPORT.STATE_NUM.APPROVED; + report.statusNum = CONST.REPORT.STATUS_NUM.APPROVED; const result = NextStepUtils.buildNextStep(report, CONST.REPORT.STATUS_NUM.APPROVED); @@ -623,10 +627,6 @@ describe('libs/NextStepUtils', () => { text: ' %expenses.', }, ]; - // mock the report as approved - const originalState = {stateNum: report.stateNum, statusNum: report.statusNum}; - report.stateNum = CONST.REPORT.STATE_NUM.APPROVED; - report.statusNum = CONST.REPORT.STATUS_NUM.APPROVED; return Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, { achAccount: { From a42c01415a68fcb9909e825278e09e3f1fc53c9c Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 11 Oct 2024 15:00:29 +0200 Subject: [PATCH 005/145] fix: eslint --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index a19869e073fa..94e2c4863ea2 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -14,12 +14,10 @@ import useOnboardingFlowRouter from '@hooks/useOnboardingFlow'; import usePermissions from '@hooks/usePermissions'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as Welcome from '@libs/actions/Welcome'; import {READ_COMMANDS} from '@libs/API/types'; import HttpUtils from '@libs/HttpUtils'; import KeyboardShortcut from '@libs/KeyboardShortcut'; import Log from '@libs/Log'; -import hideKeyboardOnSwipe from '@libs/Navigation/AppNavigator/hideKeyboardOnSwipe'; import getCurrentUrl from '@libs/Navigation/currentUrl'; import Navigation from '@libs/Navigation/Navigation'; import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom'; @@ -58,6 +56,7 @@ import beforeRemoveReportOpenedFromSearchRHP from './beforeRemoveReportOpenedFro import CENTRAL_PANE_SCREENS from './CENTRAL_PANE_SCREENS'; import createResponsiveStackNavigator from './createResponsiveStackNavigator'; import defaultScreenOptions from './defaultScreenOptions'; +import hideKeyboardOnSwipe from './hideKeyboardOnSwipe'; import BottomTabNavigator from './Navigators/BottomTabNavigator'; import ExplanationModalNavigator from './Navigators/ExplanationModalNavigator'; import FeatureTrainingModalNavigator from './Navigators/FeatureTrainingModalNavigator'; From e476b1bad3fa6dc3273216cff9c31a61ff6cc1dc Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 11 Oct 2024 15:05:38 +0200 Subject: [PATCH 006/145] fix: removed unused code --- .../getOnboardingModalScreenOptions/index.native.ts | 12 ------------ .../getOnboardingModalScreenOptions/index.ts | 9 --------- 2 files changed, 21 deletions(-) delete mode 100644 src/libs/Navigation/getOnboardingModalScreenOptions/index.native.ts delete mode 100644 src/libs/Navigation/getOnboardingModalScreenOptions/index.ts diff --git a/src/libs/Navigation/getOnboardingModalScreenOptions/index.native.ts b/src/libs/Navigation/getOnboardingModalScreenOptions/index.native.ts deleted file mode 100644 index 98dd131a9332..000000000000 --- a/src/libs/Navigation/getOnboardingModalScreenOptions/index.native.ts +++ /dev/null @@ -1,12 +0,0 @@ -import getRootNavigatorScreenOptions from '@libs/Navigation/AppNavigator/getRootNavigatorScreenOptions'; -import type {ThemeStyles} from '@styles/index'; -import type {StyleUtilsType} from '@styles/utils'; - -function getOnboardingModalScreenOptions(isSmallScreenWidth: boolean, styles: ThemeStyles, StyleUtils: StyleUtilsType) { - return { - ...getRootNavigatorScreenOptions(isSmallScreenWidth, styles, StyleUtils).fullScreen, - gestureEnabled: false, - }; -} - -export default getOnboardingModalScreenOptions; diff --git a/src/libs/Navigation/getOnboardingModalScreenOptions/index.ts b/src/libs/Navigation/getOnboardingModalScreenOptions/index.ts deleted file mode 100644 index aad1964f441c..000000000000 --- a/src/libs/Navigation/getOnboardingModalScreenOptions/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import getRootNavigatorScreenOptions from '@libs/Navigation/AppNavigator/getRootNavigatorScreenOptions'; -import type {ThemeStyles} from '@styles/index'; -import type {StyleUtilsType} from '@styles/utils'; - -function getOnboardingModalScreenOptions(isSmallScreenWidth: boolean, styles: ThemeStyles, StyleUtils: StyleUtilsType, shouldUseNarrowLayout: boolean) { - return getRootNavigatorScreenOptions(isSmallScreenWidth, styles, StyleUtils).onboardingModalNavigator(shouldUseNarrowLayout); -} - -export default getOnboardingModalScreenOptions; From db5ec1212b04b4b865809e29b25806dceccc697b Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 11 Oct 2024 15:35:29 +0200 Subject: [PATCH 007/145] fix: TS --- src/pages/home/report/withReportOrNotFound.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/pages/home/report/withReportOrNotFound.tsx b/src/pages/home/report/withReportOrNotFound.tsx index b5608d281778..2c74abe7f24d 100644 --- a/src/pages/home/report/withReportOrNotFound.tsx +++ b/src/pages/home/report/withReportOrNotFound.tsx @@ -24,7 +24,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; type WithReportOrNotFoundOnyxProps = { /** The report currently being looked at */ - report: OnyxEntry; + report: OnyxTypes.Report; /** Metadata of the report currently being looked at */ reportMetadata: OnyxEntry; @@ -51,18 +51,13 @@ type ScreenProps = | PlatformStackScreenProps; type WithReportOrNotFoundProps = WithReportOrNotFoundOnyxProps & { - /** The report currently being looked at */ - report: OnyxTypes.Report; - route: ScreenProps['route']; navigation: ScreenProps['navigation']; }; export default function ( shouldRequireReportID = true, -): ( - WrappedComponent: React.ComponentType>, -) => React.ComponentType, keyof WithReportOrNotFoundOnyxProps>> { +): (WrappedComponent: React.ComponentType>) => React.ComponentType> { return function (WrappedComponent: ComponentType>) { function WithReportOrNotFound(props: TProps, ref: ForwardedRef) { const [betas] = useOnyx(ONYXKEYS.BETAS); From 9d30239de5c17c8a931f2a1cdecf50b18f393f41 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 11 Oct 2024 16:45:45 +0200 Subject: [PATCH 008/145] fix: rename functions to pass CI --- tests/perf-test/ReportScreen.perf-test.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/perf-test/ReportScreen.perf-test.tsx b/tests/perf-test/ReportScreen.perf-test.tsx index 8733ad4cd095..8c6bdc0fd714 100644 --- a/tests/perf-test/ReportScreen.perf-test.tsx +++ b/tests/perf-test/ReportScreen.perf-test.tsx @@ -5,7 +5,7 @@ import type ReactNative from 'react-native'; import {Dimensions, InteractionManager} from 'react-native'; import Onyx from 'react-native-onyx'; import type Animated from 'react-native-reanimated'; -import {measurePerformance} from 'reassure'; +import {measureRenders} from 'reassure'; import type {WithNavigationFocusProps} from '@components/withNavigationFocus'; import type Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackNavigationProp, PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; @@ -228,7 +228,7 @@ test('[ReportScreen] should render ReportScreen', async () => { ...reportCollectionDataSet, ...reportActionsCollectionDataSet, }); - await measurePerformance( + await measureRenders( { ...reportCollectionDataSet, ...reportActionsCollectionDataSet, }); - await measurePerformance( + await measureRenders( { ...reportCollectionDataSet, ...reportActionsCollectionDataSet, }); - await measurePerformance( + await measureRenders( Date: Mon, 14 Oct 2024 15:05:16 +0200 Subject: [PATCH 009/145] fix: crashes in FlatList on goBack on Android --- ...eens+3.34.0+003+fabric-flat-list-fix.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 patches/react-native-screens+3.34.0+003+fabric-flat-list-fix.patch diff --git a/patches/react-native-screens+3.34.0+003+fabric-flat-list-fix.patch b/patches/react-native-screens+3.34.0+003+fabric-flat-list-fix.patch new file mode 100644 index 000000000000..3327ed477893 --- /dev/null +++ b/patches/react-native-screens+3.34.0+003+fabric-flat-list-fix.patch @@ -0,0 +1,57 @@ +diff --git a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.kt b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.kt +index 9d08d39..146b9c2 100644 +--- a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.kt ++++ b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/Screen.kt +@@ -18,6 +18,7 @@ import com.facebook.react.uimanager.PixelUtil + import com.facebook.react.uimanager.UIManagerHelper + import com.facebook.react.uimanager.UIManagerModule + import com.swmansion.rnscreens.events.HeaderHeightChangeEvent ++import com.swmansion.rnscreens.ext.isInsideScrollViewWithRemoveClippedSubviews + + @SuppressLint("ViewConstructor") // Only we construct this view, it is never inflated. + class Screen( +@@ -310,6 +311,16 @@ class Screen( + startTransitionRecursive(child.toolbar) + } + if (child is ViewGroup) { ++ // a combination of https://github.com/software-mansion/react-native-screens/pull/2307/files and https://github.com/software-mansion/react-native-screens/pull/2383/files ++ // The children are miscounted when there's a FlatList with ++ // removeClippedSubviews set to true (default). ++ // We add a simple view for each item in the list to make it work as expected. ++ // See https://github.com/software-mansion/react-native-screens/issues/2282 ++ if (child.isInsideScrollViewWithRemoveClippedSubviews()) { ++ for (j in 0 until child.childCount) { ++ child.addView(View(context)) ++ } ++ } + startTransitionRecursive(child) + } + } +diff --git a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt +new file mode 100644 +index 0000000..9d9fbfd +--- /dev/null ++++ b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt +@@ -0,0 +1,21 @@ ++package com.swmansion.rnscreens.ext ++ ++import android.view.View ++import android.view.ViewGroup ++import com.facebook.react.views.scroll.ReactHorizontalScrollView ++import com.facebook.react.views.scroll.ReactScrollView ++import com.swmansion.rnscreens.ScreenStack ++ ++internal fun View.isInsideScrollViewWithRemoveClippedSubviews(): Boolean { ++ if (this is ReactHorizontalScrollView || this is ReactScrollView) { ++ return false ++ } ++ var parentView = this.parent ++ while (parentView is ViewGroup && parentView !is ScreenStack) { ++ if (parentView is ReactScrollView) { ++ return parentView.removeClippedSubviews ++ } ++ parentView = parentView.parent ++ } ++ return false ++} +\ No newline at end of file From 2eddd622ba7f85c829ef75ace36e5b4b7005aebe Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Mon, 14 Oct 2024 16:31:08 +0200 Subject: [PATCH 010/145] fix: crash when open and close image in chat --- ...6.4.1+001+native-stack-recycle-crash.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/react-native-pager-view+6.4.1+001+native-stack-recycle-crash.patch diff --git a/patches/react-native-pager-view+6.4.1+001+native-stack-recycle-crash.patch b/patches/react-native-pager-view+6.4.1+001+native-stack-recycle-crash.patch new file mode 100644 index 000000000000..da849c43bb32 --- /dev/null +++ b/patches/react-native-pager-view+6.4.1+001+native-stack-recycle-crash.patch @@ -0,0 +1,29 @@ +diff --git a/node_modules/react-native-pager-view/android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt b/node_modules/react-native-pager-view/android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt +index 0abf668..0bfca0a 100644 +--- a/node_modules/react-native-pager-view/android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt ++++ b/node_modules/react-native-pager-view/android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt +@@ -151,10 +151,20 @@ object PagerViewViewManagerImpl { + + private fun refreshViewChildrenLayout(view: View) { + view.post { +- view.measure( ++ try { ++ view.measure( + View.MeasureSpec.makeMeasureSpec(view.width, View.MeasureSpec.EXACTLY), +- View.MeasureSpec.makeMeasureSpec(view.height, View.MeasureSpec.EXACTLY)) +- view.layout(view.left, view.top, view.right, view.bottom) ++ View.MeasureSpec.makeMeasureSpec(view.height, View.MeasureSpec.EXACTLY) ++ ) ++ view.layout(view.left, view.top, view.right, view.bottom) ++ } catch (e: Exception) { ++ // no-op ++ // fixes a crash: java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true ++ // It looks like we can not force layout on a recycled views. The safer solution would be simply call .requestLayout(), but I believe that ++ // force layouting was added intentionally and fixes some issues, so we simply wrap the operation with try/catch to not crash the app ++ // patch can be removed when https://github.com/callstack/react-native-pager-view/issues/882 or https://github.com/callstack/react-native-pager-view/issues/859 ++ // will be fixed ++ } + } + } + } +\ No newline at end of file From 8f57acc4c3e42ba7b6fb235a5dcccbe5339d4df8 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Mon, 14 Oct 2024 17:02:30 +0200 Subject: [PATCH 011/145] fix: incorrect merge conflic resolve --- src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx b/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx index 9b9746045c36..a891c58b8ae1 100644 --- a/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx +++ b/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx @@ -24,7 +24,7 @@ import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES';å +import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/NewContactMethodForm'; import type {Errors} from '@src/types/onyx/OnyxCommon'; @@ -32,8 +32,7 @@ import type {Errors} from '@src/types/onyx/OnyxCommon'; type NewContactMethodPageProps = PlatformStackScreenProps; function NewContactMethodPage({route}: NewContactMethodPageProps) { - const [account] = useOnyx(ONYXKEYS.ACCOUNT); - const contactMethod = account?.primaryLogin ?? ''; + const contactMethod = UserUtils.getContactMethod(); const styles = useThemeStyles(); const {translate} = useLocalize(); const loginInputRef = useRef(null); From 600088aa7666522a74a2d781e2c0c85962e6d1ff Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Tue, 15 Oct 2024 17:11:48 +0200 Subject: [PATCH 012/145] fix: not showing up keyboard in ChatFinder screen --- src/components/SelectionList/BaseSelectionList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 06bf8eb6434a..fe367197066d 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -542,7 +542,7 @@ function BaseSelectionList( if (shouldDelayFocus) { focusTimeoutRef.current = setTimeout(focusTextInput, CONST.ANIMATED_TRANSITION); } else { - focusTextInput(); + requestAnimationFrame(focusTextInput); } } From fb47d6fc523472463b67fd6d258d4b429b90a624 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 16 Oct 2024 18:48:31 +0200 Subject: [PATCH 013/145] fix: iOS un-natural transitions --- ...custom-animations-native-transitions.patch | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 patches/react-native-screens+3.34.0+004+ios-custom-animations-native-transitions.patch diff --git a/patches/react-native-screens+3.34.0+004+ios-custom-animations-native-transitions.patch b/patches/react-native-screens+3.34.0+004+ios-custom-animations-native-transitions.patch new file mode 100644 index 000000000000..62cbf68f458d --- /dev/null +++ b/patches/react-native-screens+3.34.0+004+ios-custom-animations-native-transitions.patch @@ -0,0 +1,156 @@ +diff --git a/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm b/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm +index abb2cf6..fb81d52 100644 +--- a/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm ++++ b/node_modules/react-native-screens/ios/RNSScreenStackAnimator.mm +@@ -5,13 +5,14 @@ + + // proportions to default transition duration + static const float RNSSlideOpenTransitionDurationProportion = 1; +-static const float RNSFadeOpenTransitionDurationProportion = 0.2 / 0.35; +-static const float RNSSlideCloseTransitionDurationProportion = 0.25 / 0.35; +-static const float RNSFadeCloseTransitionDurationProportion = 0.15 / 0.35; +-static const float RNSFadeCloseDelayTransitionDurationProportion = 0.1 / 0.35; ++static const float RNSFadeOpenTransitionDurationProportion = 0.2 / 0.5; ++static const float RNSSlideCloseTransitionDurationProportion = 0.25 / 0.5; ++static const float RNSFadeCloseTransitionDurationProportion = 0.15 / 0.5; ++static const float RNSFadeCloseDelayTransitionDurationProportion = 0.1 / 0.5; + // same value is used in other projects using similar approach for transistions + // and it looks the most similar to the value used by Apple + static constexpr float RNSShadowViewMaxAlpha = 0.1; ++static const int UIViewAnimationOptionCurveDefaultTransition = 7 << 16; + + @implementation RNSScreenStackAnimator { + UINavigationControllerOperation _operation; +@@ -22,7 +23,7 @@ - (instancetype)initWithOperation:(UINavigationControllerOperation)operation + { + if (self = [super init]) { + _operation = operation; +- _transitionDuration = 0.35; // default duration in seconds ++ _transitionDuration = 0.5; // default duration in seconds + } + return self; + } +@@ -129,6 +130,8 @@ - (void)animateSimplePushWithShadowEnabled:(BOOL)shadowEnabled + } + + [UIView animateWithDuration:[self transitionDuration:transitionContext] ++ delay:0 ++ options:UIViewAnimationOptionCurveDefaultTransition + animations:^{ + fromViewController.view.transform = leftTransform; + toViewController.view.transform = CGAffineTransformIdentity; +@@ -170,6 +173,8 @@ - (void)animateSimplePushWithShadowEnabled:(BOOL)shadowEnabled + + if (!transitionContext.isInteractive) { + [UIView animateWithDuration:[self transitionDuration:transitionContext] ++ delay:0 ++ options:UIViewAnimationOptionCurveDefaultTransition + animations:animationBlock + completion:completionBlock]; + } else { +@@ -203,6 +208,8 @@ - (void)animateSlideFromLeftWithTransitionContext:(id; + stackAnimation?: WithDefault; +- transitionDuration?: WithDefault; ++ transitionDuration?: WithDefault; + replaceAnimation?: WithDefault; + swipeDirection?: WithDefault; + hideKeyboardOnSwipe?: boolean; +diff --git a/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts b/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts +index 11ed190..f676e08 100644 +--- a/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts ++++ b/node_modules/react-native-screens/lib/typescript/fabric/ScreenNativeComponent.d.ts +@@ -55,7 +55,7 @@ export interface NativeProps extends ViewProps { + gestureResponseDistance?: GestureResponseDistanceType; + stackPresentation?: WithDefault; + stackAnimation?: WithDefault; +- transitionDuration?: WithDefault; ++ transitionDuration?: WithDefault; + replaceAnimation?: WithDefault; + swipeDirection?: WithDefault; + hideKeyboardOnSwipe?: boolean; +diff --git a/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts b/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts +index bb59c4c..d4c14ee 100644 +--- a/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts ++++ b/node_modules/react-native-screens/src/fabric/ModalScreenNativeComponent.ts +@@ -90,7 +90,7 @@ export interface NativeProps extends ViewProps { + gestureResponseDistance?: GestureResponseDistanceType; + stackPresentation?: WithDefault; + stackAnimation?: WithDefault; +- transitionDuration?: WithDefault; ++ transitionDuration?: WithDefault; + replaceAnimation?: WithDefault; + swipeDirection?: WithDefault; + hideKeyboardOnSwipe?: boolean; +diff --git a/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts b/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts +index 4e39336..ab0b313 100644 +--- a/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts ++++ b/node_modules/react-native-screens/src/fabric/ScreenNativeComponent.ts +@@ -92,7 +92,7 @@ export interface NativeProps extends ViewProps { + gestureResponseDistance?: GestureResponseDistanceType; + stackPresentation?: WithDefault; + stackAnimation?: WithDefault; +- transitionDuration?: WithDefault; ++ transitionDuration?: WithDefault; + replaceAnimation?: WithDefault; + swipeDirection?: WithDefault; + hideKeyboardOnSwipe?: boolean; \ No newline at end of file From de1eda94be590b32ae5db1e8f57737d71b8487b8 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 16 Oct 2024 18:59:28 +0200 Subject: [PATCH 014/145] fix: new screen to use new interface --- .../UpdateDelegateRole/UpdateDelegateMagicCodePage.tsx | 4 ++-- .../AddDelegate/UpdateDelegateRole/UpdateDelegateRolePage.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateMagicCodePage.tsx b/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateMagicCodePage.tsx index 2c1bc55e0e92..b61238c43e39 100644 --- a/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateMagicCodePage.tsx +++ b/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateMagicCodePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useRef} from 'react'; import {useOnyx} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -8,6 +7,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import type CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -16,7 +16,7 @@ import type SCREENS from '@src/SCREENS'; import ValidateCodeForm from './ValidateCodeForm'; import type {ValidateCodeFormHandle} from './ValidateCodeForm/BaseValidateCodeForm'; -type UpdateDelegateMagicCodePageProps = StackScreenProps; +type UpdateDelegateMagicCodePageProps = PlatformStackScreenProps; function UpdateDelegateMagicCodePage({route}: UpdateDelegateMagicCodePageProps) { const {translate} = useLocalize(); diff --git a/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateRolePage.tsx b/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateRolePage.tsx index 58b1b710d474..12e77fb2eebe 100644 --- a/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateRolePage.tsx +++ b/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateRolePage.tsx @@ -1,4 +1,3 @@ -import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect, useState} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -10,13 +9,14 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {clearDelegateRolePendingAction, requestValidationCode, updateDelegateRoleOptimistically} from '@libs/actions/Delegate'; import Navigation from '@libs/Navigation/Navigation'; +import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {DelegateRole} from '@src/types/onyx/Account'; -type UpdateDelegateRolePageProps = StackScreenProps; +type UpdateDelegateRolePageProps = PlatformStackScreenProps; function UpdateDelegateRolePage({route}: UpdateDelegateRolePageProps) { const {translate} = useLocalize(); From a7293da050229bb24daa0e6031114980a9270135 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Sun, 6 Oct 2024 17:35:20 +0200 Subject: [PATCH 015/145] fix: remove header in FullScreenNavigator --- .../AppNavigator/createCustomFullScreenNavigator/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.tsx index 204a9780e7d5..f3d605e1824f 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/index.tsx @@ -2,12 +2,14 @@ import type {ParamListBase} from '@react-navigation/native'; import {createNavigatorFactory} from '@react-navigation/native'; import useNavigationResetOnLayoutChange from '@libs/Navigation/AppNavigator/useNavigationResetOnLayoutChange'; import createPlatformStackNavigatorComponent from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent'; +import defaultPlatformStackScreenOptions from '@libs/Navigation/PlatformStackNavigation/defaultPlatformStackScreenOptions'; import type {PlatformStackNavigationEventMap, PlatformStackNavigationOptions, PlatformStackNavigationState} from '@libs/Navigation/PlatformStackNavigation/types'; import CustomFullScreenRouter from './CustomFullScreenRouter'; const CustomFullScreenNavigatorComponent = createPlatformStackNavigatorComponent('CustomFullScreenNavigator', { createRouter: CustomFullScreenRouter, useCustomEffects: useNavigationResetOnLayoutChange, + defaultScreenOptions: defaultPlatformStackScreenOptions, }); function createCustomFullScreenNavigator() { From 711ae64a9bed7c70fa6199e951c8c4f3137e6cea Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Sat, 26 Oct 2024 19:08:12 +0200 Subject: [PATCH 016/145] remove unused temporary navigator factories --- .../BottomTabBar.tsx | 191 ------------------ .../BottomTabNavigationContentWrapper.tsx | 22 -- .../TopBar.tsx | 78 ------- .../index.tsx | 33 --- .../useCustomState/index.ts | 20 -- .../CustomFullScreenRouter.tsx | 77 ------- .../index.tsx | 19 -- 7 files changed, 440 deletions(-) delete mode 100644 src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/BottomTabBar.tsx delete mode 100644 src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/BottomTabNavigationContentWrapper.tsx delete mode 100644 src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/TopBar.tsx delete mode 100644 src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/index.tsx delete mode 100644 src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/useCustomState/index.ts delete mode 100644 src/libs/Navigation/AppNavigator/createCustomPlatformStackFullScreenNavigator/CustomFullScreenRouter.tsx delete mode 100644 src/libs/Navigation/AppNavigator/createCustomPlatformStackFullScreenNavigator/index.tsx diff --git a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/BottomTabBar.tsx b/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/BottomTabBar.tsx deleted file mode 100644 index 3bf029012b36..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/BottomTabBar.tsx +++ /dev/null @@ -1,191 +0,0 @@ -import {useNavigation} from '@react-navigation/native'; -import React, {memo, useCallback, useEffect, useState} from 'react'; -import {NativeModules, View} from 'react-native'; -import {useOnyx} from 'react-native-onyx'; -import Icon from '@components/Icon'; -import * as Expensicons from '@components/Icon/Expensicons'; -import {PressableWithFeedback} from '@components/Pressable'; -import type {SearchQueryString} from '@components/Search/types'; -import Tooltip from '@components/Tooltip'; -import useActiveWorkspace from '@hooks/useActiveWorkspace'; -import useLocalize from '@hooks/useLocalize'; -import useTheme from '@hooks/useTheme'; -import useThemeStyles from '@hooks/useThemeStyles'; -import * as Session from '@libs/actions/Session'; -import interceptAnonymousUser from '@libs/interceptAnonymousUser'; -import Navigation from '@libs/Navigation/Navigation'; -import type {AuthScreensParamList} from '@libs/Navigation/types'; -import {isCentralPaneName} from '@libs/NavigationUtils'; -import * as PolicyUtils from '@libs/PolicyUtils'; -import * as SearchQueryUtils from '@libs/SearchQueryUtils'; -import type {BrickRoad} from '@libs/WorkspacesSettingsUtils'; -import {getChatTabBrickRoad} from '@libs/WorkspacesSettingsUtils'; -import navigationRef from '@navigation/navigationRef'; -import BottomTabAvatar from '@pages/home/sidebar/BottomTabAvatar'; -import BottomTabBarFloatingActionButton from '@pages/home/sidebar/BottomTabBarFloatingActionButton'; -import variables from '@styles/variables'; -import * as Welcome from '@userActions/Welcome'; -import * as OnboardingFlow from '@userActions/Welcome/OnboardingFlow'; -import CONST from '@src/CONST'; -import NAVIGATORS from '@src/NAVIGATORS'; -import ONYXKEYS from '@src/ONYXKEYS'; -import type {Route} from '@src/ROUTES'; -import ROUTES from '@src/ROUTES'; -import SCREENS from '@src/SCREENS'; - -type BottomTabBarProps = { - selectedTab: string | undefined; -}; - -/** - * Returns SearchQueryString that has policyID correctly set. - * - * When we're coming back to Search Screen we might have pre-existing policyID inside SearchQuery. - * There are 2 cases when we might want to remove this `policyID`: - * - if Policy was removed in another screen - * - if WorkspaceSwitcher was used to globally unset a policyID - * Otherwise policyID will be inserted into query - */ -function handleQueryWithPolicyID(query: SearchQueryString, activePolicyID?: string): SearchQueryString { - const queryJSON = SearchQueryUtils.buildSearchQueryJSON(query); - if (!queryJSON) { - return query; - } - - const policyID = activePolicyID ?? queryJSON.policyID; - const policy = PolicyUtils.getPolicy(policyID); - - // In case policy is missing or there is no policy currently selected via WorkspaceSwitcher we remove it - if (!activePolicyID || !policy) { - delete queryJSON.policyID; - } else { - queryJSON.policyID = policyID; - } - - return SearchQueryUtils.buildSearchQueryString(queryJSON); -} - -function BottomTabBar({selectedTab}: BottomTabBarProps) { - const theme = useTheme(); - const styles = useThemeStyles(); - const {translate} = useLocalize(); - const navigation = useNavigation(); - const {activeWorkspaceID} = useActiveWorkspace(); - const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP); - const transactionViolations = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); - const [chatTabBrickRoad, setChatTabBrickRoad] = useState(getChatTabBrickRoad(activeWorkspaceID)); - - useEffect(() => { - setChatTabBrickRoad(getChatTabBrickRoad(activeWorkspaceID)); - }, [activeWorkspaceID, transactionViolations]); - - useEffect(() => { - const navigationState = navigation.getState(); - const routes = navigationState?.routes; - const currentRoute = routes?.at(navigationState?.index ?? 0); - // When we are redirected to the Settings tab from the OldDot, we don't want to call the Welcome.show() method. - // To prevent this, the value of the bottomTabRoute?.name is checked here - if (!!(currentRoute && currentRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR && !isCentralPaneName(currentRoute.name)) || Session.isAnonymousUser()) { - return; - } - - // HybridApp has own entry point when we decide whether to display onboarding and explanation modal. - if (NativeModules.HybridAppModule) { - return; - } - - Welcome.isOnboardingFlowCompleted({ - onNotCompleted: () => OnboardingFlow.startOnboardingFlow(), - }); - - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, [isLoadingApp]); - - const navigateToChats = useCallback(() => { - if (selectedTab === SCREENS.HOME) { - return; - } - const route = activeWorkspaceID ? (`/w/${activeWorkspaceID}/${ROUTES.HOME}` as Route) : ROUTES.HOME; - Navigation.navigate(route); - }, [activeWorkspaceID, selectedTab]); - - const navigateToSearch = useCallback(() => { - if (selectedTab === SCREENS.SEARCH.BOTTOM_TAB) { - return; - } - interceptAnonymousUser(() => { - const rootState = navigationRef.getRootState(); - const lastSearchRoute = rootState.routes.filter((route) => route.name === SCREENS.SEARCH.CENTRAL_PANE).at(-1); - - if (lastSearchRoute) { - const {q, ...rest} = lastSearchRoute.params as AuthScreensParamList[typeof SCREENS.SEARCH.CENTRAL_PANE]; - const cleanedQuery = handleQueryWithPolicyID(q, activeWorkspaceID); - - Navigation.navigate( - ROUTES.SEARCH_CENTRAL_PANE.getRoute({ - query: cleanedQuery, - ...rest, - }), - ); - return; - } - - const defaultCannedQuery = SearchQueryUtils.buildCannedSearchQuery(); - // when navigating to search we might have an activePolicyID set from workspace switcher - const query = activeWorkspaceID ? `${defaultCannedQuery} ${CONST.SEARCH.SYNTAX_ROOT_KEYS.POLICY_ID}:${activeWorkspaceID}` : defaultCannedQuery; - Navigation.navigate(ROUTES.SEARCH_CENTRAL_PANE.getRoute({query})); - }); - }, [activeWorkspaceID, selectedTab]); - - return ( - - - - - - {chatTabBrickRoad && ( - - )} - - - - - - - - - - - - - - - - ); -} - -BottomTabBar.displayName = 'BottomTabBar'; - -export default memo(BottomTabBar); diff --git a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/BottomTabNavigationContentWrapper.tsx b/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/BottomTabNavigationContentWrapper.tsx deleted file mode 100644 index dd93a6df7b1e..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/BottomTabNavigationContentWrapper.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import ScreenWrapper from '@components/ScreenWrapper'; -import useThemeStyles from '@hooks/useThemeStyles'; -import type {NavigationContentWrapperProps} from '@libs/Navigation/PlatformStackNavigation/types'; - -function BottomTabNavigationContentWrapper({children, displayName}: NavigationContentWrapperProps) { - const styles = useThemeStyles(); - - return ( - - {children} - - ); -} - -export default BottomTabNavigationContentWrapper; diff --git a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/TopBar.tsx b/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/TopBar.tsx deleted file mode 100644 index eba7a7448ad0..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/TopBar.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import {useOnyx} from 'react-native-onyx'; -import Breadcrumbs from '@components/Breadcrumbs'; -import {PressableWithoutFeedback} from '@components/Pressable'; -import SearchButton from '@components/Search/SearchRouter/SearchButton'; -import Text from '@components/Text'; -import WorkspaceSwitcherButton from '@components/WorkspaceSwitcherButton'; -import useLocalize from '@hooks/useLocalize'; -import usePolicy from '@hooks/usePolicy'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@libs/Navigation/Navigation'; -import * as SearchQueryUtils from '@libs/SearchQueryUtils'; -import SignInButton from '@pages/home/sidebar/SignInButton'; -import * as Session from '@userActions/Session'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; - -type TopBarProps = {breadcrumbLabel: string; activeWorkspaceID?: string; shouldDisplaySearch?: boolean; shouldDisplayCancelSearch?: boolean}; - -function TopBar({breadcrumbLabel, activeWorkspaceID, shouldDisplaySearch = true, shouldDisplayCancelSearch = false}: TopBarProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - const policy = usePolicy(activeWorkspaceID); - const [session] = useOnyx(ONYXKEYS.SESSION, {selector: (sessionValue) => sessionValue && {authTokenType: sessionValue.authTokenType}}); - const isAnonymousUser = Session.isAnonymousUser(session); - - const headerBreadcrumb = policy?.name - ? {type: CONST.BREADCRUMB_TYPE.STRONG, text: policy.name} - : { - type: CONST.BREADCRUMB_TYPE.ROOT, - }; - - const displaySignIn = isAnonymousUser; - const displaySearch = !isAnonymousUser && shouldDisplaySearch; - - return ( - - - - - - - - - - {displaySignIn && } - {shouldDisplayCancelSearch && ( - { - Navigation.goBack(ROUTES.SEARCH_CENTRAL_PANE.getRoute({query: SearchQueryUtils.buildCannedSearchQuery()})); - }} - > - {translate('common.cancel')} - - )} - {displaySearch && } - - - ); -} - -TopBar.displayName = 'TopBar'; - -export default TopBar; diff --git a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/index.tsx b/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/index.tsx deleted file mode 100644 index 2461c542ec7d..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import type {ParamListBase} from '@react-navigation/native'; -import {createNavigatorFactory} from '@react-navigation/native'; -import React from 'react'; -import createPlatformStackNavigatorComponent from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent'; -import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; -import type {ExtraContentProps, PlatformStackNavigationEventMap, PlatformStackNavigationOptions, PlatformStackNavigationState} from '@libs/Navigation/PlatformStackNavigation/types'; -import BottomTabBar from './BottomTabBar'; -import BottomTabNavigationContentWrapper from './BottomTabNavigationContentWrapper'; -import useCustomState from './useCustomState'; - -const defaultScreenOptions: PlatformStackNavigationOptions = { - animation: Animations.NONE, -}; - -function ExtraContent({state}: ExtraContentProps) { - const selectedTab = state.routes.at(-1)?.name; - return ; -} - -const CustomBottomTabNavigatorComponent = createPlatformStackNavigatorComponent('CustomBottomTabNavigator', { - useCustomState, - defaultScreenOptions, - NavigationContentWrapper: BottomTabNavigationContentWrapper, - ExtraContent, -}); - -function createCustomBottomTabNavigator() { - return createNavigatorFactory, PlatformStackNavigationOptions, PlatformStackNavigationEventMap, typeof CustomBottomTabNavigatorComponent>( - CustomBottomTabNavigatorComponent, - )(); -} - -export default createCustomBottomTabNavigator; diff --git a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/useCustomState/index.ts b/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/useCustomState/index.ts deleted file mode 100644 index e95c6c292dbc..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomPlatformStackBottomTabNavigator/useCustomState/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type {CustomStateHookProps} from '@libs/Navigation/PlatformStackNavigation/types'; -import type {NavigationStateRoute} from '@libs/Navigation/types'; -import SCREENS from '@src/SCREENS'; - -function useCustomState({state}: CustomStateHookProps) { - const routesToRender = [state.routes.at(-1)] as NavigationStateRoute[]; - - // We need to render at least one HOME screen to make sure everything load properly. This may be not necessary after changing how IS_SIDEBAR_LOADED is handled. - // Currently this value will be switched only after the first HOME screen is rendered. - if (routesToRender.at(0)?.name !== SCREENS.HOME) { - const routeToRender = state.routes.find((route) => route.name === SCREENS.HOME); - if (routeToRender) { - routesToRender.unshift(routeToRender); - } - } - - return {stateToRender: {...state, routes: routesToRender, index: routesToRender.length - 1}}; -} - -export default useCustomState; diff --git a/src/libs/Navigation/AppNavigator/createCustomPlatformStackFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomPlatformStackFullScreenNavigator/CustomFullScreenRouter.tsx deleted file mode 100644 index 5c837fc93a5b..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomPlatformStackFullScreenNavigator/CustomFullScreenRouter.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import type {ParamListBase, PartialState, Router, RouterConfigOptions} from '@react-navigation/native'; -import {StackRouter} from '@react-navigation/native'; -import getIsNarrowLayout from '@libs/getIsNarrowLayout'; -import type {PlatformStackNavigationState, PlatformStackRouterOptions} from '@libs/Navigation/PlatformStackNavigation/types'; -import SCREENS from '@src/SCREENS'; - -type StackState = PlatformStackNavigationState | PartialState>; - -const isAtLeastOneInState = (state: StackState, screenName: string): boolean => state.routes.some((route) => route.name === screenName); - -function adaptStateIfNecessary(state: StackState) { - const isNarrowLayout = getIsNarrowLayout(); - const workspaceCentralPane = state.routes.at(-1); - - // There should always be WORKSPACE.INITIAL screen in the state to make sure go back works properly if we deeplinkg to a subpage of settings. - if (!isAtLeastOneInState(state, SCREENS.WORKSPACE.INITIAL)) { - // @ts-expect-error Updating read only property - // noinspection JSConstantReassignment - state.stale = true; // eslint-disable-line - - // This is necessary for ts to narrow type down to PartialState. - if (state.stale === true) { - // Unshift the root screen to fill left pane. - state.routes.unshift({ - name: SCREENS.WORKSPACE.INITIAL, - params: workspaceCentralPane?.params, - }); - } - } - - // If the screen is wide, there should be at least two screens inside: - // - WORKSPACE.INITIAL to cover left pane. - // - WORKSPACE.PROFILE (first workspace settings screen) to cover central pane. - if (!isNarrowLayout) { - if (state.routes.length === 1 && state.routes.at(0)?.name === SCREENS.WORKSPACE.INITIAL) { - // @ts-expect-error Updating read only property - // noinspection JSConstantReassignment - state.stale = true; // eslint-disable-line - // Push the default settings central pane screen. - if (state.stale === true) { - state.routes.push({ - name: SCREENS.WORKSPACE.PROFILE, - params: state.routes.at(0)?.params, - }); - } - } - // eslint-disable-next-line no-param-reassign, @typescript-eslint/non-nullable-type-assertion-style - (state.index as number) = state.routes.length - 1; - } -} - -function CustomFullScreenRouter(options: PlatformStackRouterOptions) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const stackRouter = StackRouter(options) as Router, any>; - - return { - ...stackRouter, - getInitialState({routeNames, routeParamList, routeGetIdList}: RouterConfigOptions) { - const initialState = stackRouter.getInitialState({routeNames, routeParamList, routeGetIdList}); - adaptStateIfNecessary(initialState); - - // If we needed to modify the state we need to rehydrate it to get keys for new routes. - if (initialState.stale) { - return stackRouter.getRehydratedState(initialState, {routeNames, routeParamList, routeGetIdList}); - } - - return initialState; - }, - getRehydratedState(partialState: StackState, {routeNames, routeParamList, routeGetIdList}: RouterConfigOptions): PlatformStackNavigationState { - adaptStateIfNecessary(partialState); - const state = stackRouter.getRehydratedState(partialState, {routeNames, routeParamList, routeGetIdList}); - return state; - }, - }; -} - -export default CustomFullScreenRouter; diff --git a/src/libs/Navigation/AppNavigator/createCustomPlatformStackFullScreenNavigator/index.tsx b/src/libs/Navigation/AppNavigator/createCustomPlatformStackFullScreenNavigator/index.tsx deleted file mode 100644 index 204a9780e7d5..000000000000 --- a/src/libs/Navigation/AppNavigator/createCustomPlatformStackFullScreenNavigator/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import type {ParamListBase} from '@react-navigation/native'; -import {createNavigatorFactory} from '@react-navigation/native'; -import useNavigationResetOnLayoutChange from '@libs/Navigation/AppNavigator/useNavigationResetOnLayoutChange'; -import createPlatformStackNavigatorComponent from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent'; -import type {PlatformStackNavigationEventMap, PlatformStackNavigationOptions, PlatformStackNavigationState} from '@libs/Navigation/PlatformStackNavigation/types'; -import CustomFullScreenRouter from './CustomFullScreenRouter'; - -const CustomFullScreenNavigatorComponent = createPlatformStackNavigatorComponent('CustomFullScreenNavigator', { - createRouter: CustomFullScreenRouter, - useCustomEffects: useNavigationResetOnLayoutChange, -}); - -function createCustomFullScreenNavigator() { - return createNavigatorFactory, PlatformStackNavigationOptions, PlatformStackNavigationEventMap, typeof CustomFullScreenNavigatorComponent>( - CustomFullScreenNavigatorComponent, - )(); -} - -export default createCustomFullScreenNavigator; From 853349f302af32396fa1378bd21fed8fca1ea335 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 28 Oct 2024 13:02:08 +0100 Subject: [PATCH 017/145] fix: improve naming of (side) modal navigator screen options generators --- .../AppNavigator/ModalStackNavigators/index.tsx | 6 +++--- ...lScreenOptions.ts => useModalStackScreenOptions.ts} | 4 ++-- .../AppNavigator/Navigators/LeftModalNavigator.tsx | 4 ++-- .../AppNavigator/Navigators/RightModalNavigator.tsx | 4 ++-- ...avigatorOptions.ts => useSideModalScreenOptions.ts} | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) rename src/libs/Navigation/AppNavigator/ModalStackNavigators/{useModalScreenOptions.ts => useModalStackScreenOptions.ts} (92%) rename src/libs/Navigation/AppNavigator/{useModalNavigatorOptions.ts => useSideModalScreenOptions.ts} (78%) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index cc9a2ef11738..24f743d906a7 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -35,8 +35,8 @@ import type { import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; -import type {GetModalStackScreenOptions} from './useModalScreenOptions'; -import useModalScreenOptions from './useModalScreenOptions'; +import type {GetModalStackScreenOptions} from './useModalStackScreenOptions'; +import useModalStackScreenOptions from './useModalStackScreenOptions'; type Screens = Partial React.ComponentType>>; @@ -50,7 +50,7 @@ function createModalStackNavigator(screens: Scr const ModalStackNavigator = createPlatformStackNavigator(); function ModalStack() { - const screenOptions = useModalScreenOptions(getScreenOptions); + const screenOptions = useModalStackScreenOptions(getScreenOptions); return ( diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalScreenOptions.ts b/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts similarity index 92% rename from src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalScreenOptions.ts rename to src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts index e7549cc3f8b7..adef38af97e8 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts @@ -10,7 +10,7 @@ import type {ThemeStyles} from '@src/styles'; type GetModalStackScreenOptions = (styles: ThemeStyles) => PlatformStackNavigationOptions; -function useModalScreenOptions(getScreenOptions?: GetModalStackScreenOptions) { +function useModalStackScreenOptions(getScreenOptions?: GetModalStackScreenOptions) { const styles = useThemeStyles(); const customInterpolator = useModalCardStyleInterpolator(); @@ -35,5 +35,5 @@ function useModalScreenOptions(getScreenOptions?: GetModalStackScreenOptions) { return getScreenOptions?.(styles) ?? defaultSubRouteOptions; } -export default useModalScreenOptions; +export default useModalStackScreenOptions; export type {GetModalStackScreenOptions}; diff --git a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx index a269b4c35270..33e49136861b 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx @@ -3,7 +3,7 @@ import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; -import useModalNavigatorOptions from '@libs/Navigation/AppNavigator/useModalNavigatorOptions'; +import useSideModalScreenOptions from '@libs/Navigation/AppNavigator/useSideModalScreenOptions'; import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, LeftModalNavigatorParamList} from '@libs/Navigation/types'; @@ -21,7 +21,7 @@ const Stack = createPlatformStackNavigator(); function LeftModalNavigator({navigation}: LeftModalNavigatorProps) { const styles = useThemeStyles(); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const screenOptions = useModalNavigatorOptions('horizontal-inverted'); + const screenOptions = useSideModalScreenOptions('horizontal-inverted'); return ( diff --git a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx index b1e5754f1353..69988de6bb43 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx @@ -9,7 +9,7 @@ import {isSafari} from '@libs/Browser'; import hideKeyboardOnSwipe from '@libs/Navigation/AppNavigator/hideKeyboardOnSwipe'; import * as ModalStackNavigators from '@libs/Navigation/AppNavigator/ModalStackNavigators'; import useModalCardStyleInterpolator from '@libs/Navigation/AppNavigator/useModalCardStyleInterpolator'; -import useModalNavigatorOptions from '@libs/Navigation/AppNavigator/useModalNavigatorOptions'; +import useSideModalScreenOptions from '@libs/Navigation/AppNavigator/useSideModalScreenOptions'; import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, RightModalNavigatorParamList} from '@navigation/types'; @@ -26,7 +26,7 @@ function RightModalNavigator({navigation, route}: RightModalNavigatorProps) { const {shouldUseNarrowLayout} = useResponsiveLayout(); const isExecutingRef = useRef(false); const customInterpolator = useModalCardStyleInterpolator(); - const modalNavigatorOptions = useModalNavigatorOptions(); + const modalNavigatorOptions = useSideModalScreenOptions(); const screenOptions = useMemo(() => { // The .forHorizontalIOS interpolator from `@react-navigation` is misbehaving on Safari, so we override it with Expensify custom interpolator diff --git a/src/libs/Navigation/AppNavigator/useModalNavigatorOptions.ts b/src/libs/Navigation/AppNavigator/useSideModalScreenOptions.ts similarity index 78% rename from src/libs/Navigation/AppNavigator/useModalNavigatorOptions.ts rename to src/libs/Navigation/AppNavigator/useSideModalScreenOptions.ts index 2102d247b079..85e467ebf691 100644 --- a/src/libs/Navigation/AppNavigator/useModalNavigatorOptions.ts +++ b/src/libs/Navigation/AppNavigator/useSideModalScreenOptions.ts @@ -5,12 +5,12 @@ import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptio import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; /** - * Modal stack navigator screen options generator function + * Side modal screen options generator function * @param gestureDirection - The gesture direction of dismissing the modal * @returns The screen options object */ -const useModalNavigatorOptions = (gestureDirection: GestureDirection = 'horizontal'): PlatformStackNavigationOptions => { - const themeStyles = useThemeStyles(); +const useSideModalScreenOptions = (gestureDirection: GestureDirection = 'horizontal'): PlatformStackNavigationOptions => { + const styles = useThemeStyles(); let universalGestureDirection: PlatformStackNavigationOptions['gestureDirection'] | undefined; let webGestureDirection: GestureDirection | undefined; @@ -25,11 +25,11 @@ const useModalNavigatorOptions = (gestureDirection: GestureDirection = 'horizont animation: Animations.SLIDE_FROM_RIGHT, gestureDirection: universalGestureDirection, web: { - cardStyle: themeStyles.navigationScreenCardStyle, + cardStyle: styles.navigationScreenCardStyle, cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, ...(webGestureDirection && {gestureDirection: webGestureDirection}), }, }; }; -export default useModalNavigatorOptions; +export default useSideModalScreenOptions; From 028b62a24d01c579168423bdd141bdc818616d1d Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 28 Oct 2024 13:05:34 +0100 Subject: [PATCH 018/145] fix: further improve naming --- .../ModalStackNavigators/useModalStackScreenOptions.ts | 3 +++ .../AppNavigator/Navigators/LeftModalNavigator.tsx | 4 ++-- .../AppNavigator/Navigators/RightModalNavigator.tsx | 4 ++-- ...alScreenOptions.ts => useSideModalStackScreenOptions.ts} | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) rename src/libs/Navigation/AppNavigator/{useSideModalScreenOptions.ts => useSideModalStackScreenOptions.ts} (85%) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts b/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts index adef38af97e8..0d8befb2b0f7 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts @@ -24,6 +24,9 @@ function useModalStackScreenOptions(getScreenOptions?: GetModalStackScreenOption (): PlatformStackNavigationOptions => ({ ...hideKeyboardOnSwipe, headerShown: false, + native: { + contentStyle: {...styles.navigationScreenCardStyle, backgroundColor: 'red'}, + }, web: { cardStyle: styles.navigationScreenCardStyle, cardStyleInterpolator, diff --git a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx index 33e49136861b..aaf40a62f99e 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx @@ -3,7 +3,7 @@ import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; -import useSideModalScreenOptions from '@libs/Navigation/AppNavigator/useSideModalScreenOptions'; +import useSideModalStackScreenOptions from '@libs/Navigation/AppNavigator/useSideModalStackScreenOptions'; import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, LeftModalNavigatorParamList} from '@libs/Navigation/types'; @@ -21,7 +21,7 @@ const Stack = createPlatformStackNavigator(); function LeftModalNavigator({navigation}: LeftModalNavigatorProps) { const styles = useThemeStyles(); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const screenOptions = useSideModalScreenOptions('horizontal-inverted'); + const screenOptions = useSideModalStackScreenOptions('horizontal-inverted'); return ( diff --git a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx index 69988de6bb43..c996f380e98c 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx @@ -9,7 +9,7 @@ import {isSafari} from '@libs/Browser'; import hideKeyboardOnSwipe from '@libs/Navigation/AppNavigator/hideKeyboardOnSwipe'; import * as ModalStackNavigators from '@libs/Navigation/AppNavigator/ModalStackNavigators'; import useModalCardStyleInterpolator from '@libs/Navigation/AppNavigator/useModalCardStyleInterpolator'; -import useSideModalScreenOptions from '@libs/Navigation/AppNavigator/useSideModalScreenOptions'; +import useSideModalStackScreenOptions from '@libs/Navigation/AppNavigator/useSideModalStackScreenOptions'; import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {AuthScreensParamList, RightModalNavigatorParamList} from '@navigation/types'; @@ -26,7 +26,7 @@ function RightModalNavigator({navigation, route}: RightModalNavigatorProps) { const {shouldUseNarrowLayout} = useResponsiveLayout(); const isExecutingRef = useRef(false); const customInterpolator = useModalCardStyleInterpolator(); - const modalNavigatorOptions = useSideModalScreenOptions(); + const modalNavigatorOptions = useSideModalStackScreenOptions(); const screenOptions = useMemo(() => { // The .forHorizontalIOS interpolator from `@react-navigation` is misbehaving on Safari, so we override it with Expensify custom interpolator diff --git a/src/libs/Navigation/AppNavigator/useSideModalScreenOptions.ts b/src/libs/Navigation/AppNavigator/useSideModalStackScreenOptions.ts similarity index 85% rename from src/libs/Navigation/AppNavigator/useSideModalScreenOptions.ts rename to src/libs/Navigation/AppNavigator/useSideModalStackScreenOptions.ts index 85e467ebf691..6b6fb46e4122 100644 --- a/src/libs/Navigation/AppNavigator/useSideModalScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/useSideModalStackScreenOptions.ts @@ -5,11 +5,11 @@ import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptio import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; /** - * Side modal screen options generator function + * Side modal stack screen options generator function * @param gestureDirection - The gesture direction of dismissing the modal * @returns The screen options object */ -const useSideModalScreenOptions = (gestureDirection: GestureDirection = 'horizontal'): PlatformStackNavigationOptions => { +const useSideModalStackScreenOptions = (gestureDirection: GestureDirection = 'horizontal'): PlatformStackNavigationOptions => { const styles = useThemeStyles(); let universalGestureDirection: PlatformStackNavigationOptions['gestureDirection'] | undefined; @@ -32,4 +32,4 @@ const useSideModalScreenOptions = (gestureDirection: GestureDirection = 'horizon }; }; -export default useSideModalScreenOptions; +export default useSideModalStackScreenOptions; From 1250fc48a61c2273762a319376a36a22d6a834fe Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 30 Oct 2024 19:39:40 +0100 Subject: [PATCH 019/145] fix: background flashing inverse color --- src/styles/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/index.ts b/src/styles/index.ts index 5b04a7a8eace..1b82647638c7 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -3701,7 +3701,7 @@ const styles = (theme: ThemeColors) => } satisfies AnchorPosition), iPhoneXSafeArea: { - backgroundColor: theme.inverse, + backgroundColor: theme.appBG, flex: 1, }, From f6409c48dde81984d0ea8982801807b49912de15 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 30 Oct 2024 20:11:32 +0100 Subject: [PATCH 020/145] fix: use correct Navigation theme based on theme --- src/libs/Navigation/NavigationRoot.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index bb005fc6b763..23eb40686461 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -1,5 +1,5 @@ import type {NavigationState} from '@react-navigation/native'; -import {DefaultTheme, findFocusedRoute, NavigationContainer} from '@react-navigation/native'; +import {DarkTheme, DefaultTheme, findFocusedRoute, NavigationContainer} from '@react-navigation/native'; import React, {useContext, useEffect, useMemo, useRef} from 'react'; import {NativeModules} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -8,6 +8,7 @@ import useActiveWorkspace from '@hooks/useActiveWorkspace'; import useCurrentReportID from '@hooks/useCurrentReportID'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; +import useThemePreference from '@hooks/useThemePreference'; import Firebase from '@libs/Firebase'; import {FSPage} from '@libs/Fullstory'; import Log from '@libs/Log'; @@ -83,6 +84,7 @@ function parseAndLogRoute(state: NavigationState) { function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady, shouldShowRequire2FAModal}: NavigationRootProps) { const firstRenderRef = useRef(true); + const themePreference = useThemePreference(); const theme = useTheme(); const {cleanStaleScrollOffsets} = useContext(ScrollOffsetContext); @@ -129,16 +131,17 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady, sh }, []); // https://reactnavigation.org/docs/themes - const navigationTheme = useMemo( - () => ({ - ...DefaultTheme, + const navigationTheme = useMemo(() => { + const defaultNavigationTheme = themePreference === CONST.THEME.DARK ? DarkTheme : DefaultTheme; + + return { + ...defaultNavigationTheme, colors: { - ...DefaultTheme.colors, + ...defaultNavigationTheme.colors, background: theme.appBG, }, - }), - [theme], - ); + }; + }, [theme.appBG, themePreference]); useEffect(() => { if (firstRenderRef.current) { From 6a7b1668816494d8b98fcc877fc9a9a1ca5a5a4e Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 30 Oct 2024 20:11:46 +0100 Subject: [PATCH 021/145] remove unused onSubmit prop --- src/components/ConfirmModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ConfirmModal.tsx b/src/components/ConfirmModal.tsx index fd2013c6bde7..637a514b53f3 100755 --- a/src/components/ConfirmModal.tsx +++ b/src/components/ConfirmModal.tsx @@ -143,7 +143,6 @@ function ConfirmModal({ return ( Date: Wed, 30 Oct 2024 20:11:56 +0100 Subject: [PATCH 022/145] fix: remove onSubmit prop type --- src/components/Modal/types.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/Modal/types.ts b/src/components/Modal/types.ts index 6ced829e93d6..36bcf17fe3fa 100644 --- a/src/components/Modal/types.ts +++ b/src/components/Modal/types.ts @@ -36,9 +36,6 @@ type BaseModalProps = Partial & { /** State that determines whether to display the modal or not */ isVisible: boolean; - /** Callback method fired when the user requests to submit the modal content. */ - onSubmit?: () => void; - /** Callback method fired when the modal is hidden */ onModalHide?: () => void; From 4b420a51af17aeea6f700767d805d5c42775207e Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 30 Oct 2024 20:12:36 +0100 Subject: [PATCH 023/145] fix: modal stack background style --- .../ModalStackNavigators/useModalStackScreenOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts b/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts index 0d8befb2b0f7..3dc189cb8dcd 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/useModalStackScreenOptions.ts @@ -25,7 +25,7 @@ function useModalStackScreenOptions(getScreenOptions?: GetModalStackScreenOption ...hideKeyboardOnSwipe, headerShown: false, native: { - contentStyle: {...styles.navigationScreenCardStyle, backgroundColor: 'red'}, + contentStyle: styles.navigationScreenCardStyle, }, web: { cardStyle: styles.navigationScreenCardStyle, From 756fd6046a1461cbe507830f2ff776171435c263 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 30 Oct 2024 21:31:54 +0100 Subject: [PATCH 024/145] fix: use `shouldUseNarrowLayout` instead of `isSmallScreenWidth` --- .../AppNavigator/useRootNavigatorOptions.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts b/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts index 4490cffa1e2f..5cdb6e5e4e00 100644 --- a/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts +++ b/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts @@ -28,7 +28,7 @@ const commonScreenOptions: PlatformStackNavigationOptions = { const useRootNavigatorOptions = () => { const themeStyles = useThemeStyles(); const StyleUtils = useStyleUtils(); - const {isSmallScreenWidth} = useResponsiveLayout(); + const {shouldUseNarrowLayout} = useResponsiveLayout(); const modalCardStyleInterpolator = useModalCardStyleInterpolator(); return { @@ -43,7 +43,7 @@ const useRootNavigatorOptions = () => { cardStyle: { ...StyleUtils.getNavigationModalCardStyle(), // This is necessary to cover translated sidebar with overlay. - width: isSmallScreenWidth ? '100%' : '200%', + width: shouldUseNarrowLayout ? '100%' : '200%', // Excess space should be on the left so we need to position from right. right: 0, }, @@ -80,10 +80,10 @@ const useRootNavigatorOptions = () => { ...StyleUtils.getNavigationModalCardStyle(), // This is necessary to cover translated sidebar with overlay. - width: isSmallScreenWidth ? '100%' : '200%', + width: shouldUseNarrowLayout ? '100%' : '200%', // LHP should be displayed in place of the sidebar - left: isSmallScreenWidth ? 0 : -variables.sideBarWidth, + left: shouldUseNarrowLayout ? 0 : -variables.sideBarWidth, }, }, }, @@ -96,11 +96,11 @@ const useRootNavigatorOptions = () => { cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props}), cardStyle: { ...StyleUtils.getNavigationModalCardStyle(), - width: isSmallScreenWidth ? '100%' : variables.sideBarWidth, + width: shouldUseNarrowLayout ? '100%' : variables.sideBarWidth, // We need to shift the sidebar to not be covered by the StackNavigator so it can be clickable. - marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, - ...(isSmallScreenWidth ? {} : themeStyles.borderRight), + marginLeft: shouldUseNarrowLayout ? 0 : -variables.sideBarWidth, + ...(shouldUseNarrowLayout ? {} : themeStyles.borderRight), }, }, }, @@ -108,14 +108,14 @@ const useRootNavigatorOptions = () => { fullScreen: { ...commonScreenOptions, // We need to turn off animation for the full screen to avoid delay when closing screens. - animation: isSmallScreenWidth ? Animations.SLIDE_FROM_RIGHT : Animations.NONE, + animation: shouldUseNarrowLayout ? Animations.SLIDE_FROM_RIGHT : Animations.NONE, web: { cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isFullScreenModal: true}), cardStyle: { ...StyleUtils.getNavigationModalCardStyle(), // This is necessary to cover whole screen. Including translated sidebar. - marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, + marginLeft: shouldUseNarrowLayout ? 0 : -variables.sideBarWidth, }, }, }, @@ -125,12 +125,12 @@ const useRootNavigatorOptions = () => { ...hideKeyboardOnSwipe, headerShown: false, title: CONFIG.SITE_TITLE, - animation: isSmallScreenWidth ? undefined : Animations.NONE, + animation: shouldUseNarrowLayout ? undefined : Animations.NONE, web: { cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isFullScreenModal: true}), cardStyle: { ...StyleUtils.getNavigationModalCardStyle(), - paddingRight: isSmallScreenWidth ? 0 : variables.sideBarWidth, + paddingRight: shouldUseNarrowLayout ? 0 : variables.sideBarWidth, }, }, }, @@ -141,11 +141,11 @@ const useRootNavigatorOptions = () => { cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props}), cardStyle: { ...StyleUtils.getNavigationModalCardStyle(), - width: isSmallScreenWidth ? '100%' : variables.sideBarWidth, + width: shouldUseNarrowLayout ? '100%' : variables.sideBarWidth, // We need to shift the sidebar to not be covered by the StackNavigator so it can be clickable. - marginLeft: isSmallScreenWidth ? 0 : -variables.sideBarWidth, - ...(isSmallScreenWidth ? {} : themeStyles.borderRight), + marginLeft: shouldUseNarrowLayout ? 0 : -variables.sideBarWidth, + ...(shouldUseNarrowLayout ? {} : themeStyles.borderRight), }, }, }, From 8538b308ec64e1943e8df4aa885c4fb243206ccd Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 31 Oct 2024 15:24:39 +0100 Subject: [PATCH 025/145] fix: typo --- src/pages/workspace/tags/TagSettingsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/tags/TagSettingsPage.tsx b/src/pages/workspace/tags/TagSettingsPage.tsx index d1caf120d6db..cb37a6402490 100644 --- a/src/pages/workspace/tags/TagSettingsPage.tsx +++ b/src/pages/workspace/tags/TagSettingsPage.tsx @@ -188,7 +188,7 @@ function TagSettingsPage({route, navigation}: TagSettingsPageProps) { /> {approverDisabled && ( - {translate('workspace.rules.categoryRules.goTo')}{' '} + {translate('workspace.rules.categoryRules.goTo')} Navigation.navigate(ROUTES.WORKSPACE_MORE_FEATURES.getRoute(policyID))} From 00a9c75491b921bfcaccc80198d98025b2d337ba Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 31 Oct 2024 15:26:14 +0100 Subject: [PATCH 026/145] fix: unused onSubmit --- src/components/AttachmentModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/AttachmentModal.tsx b/src/components/AttachmentModal.tsx index 0bc233812ca7..b4d28c640bd8 100644 --- a/src/components/AttachmentModal.tsx +++ b/src/components/AttachmentModal.tsx @@ -486,7 +486,6 @@ function AttachmentModal({ <> { From 5485e44842a681099e0877766ab3450757faba3a Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Fri, 1 Nov 2024 16:01:29 +0100 Subject: [PATCH 027/145] add empty line at the end --- ios/Podfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile b/ios/Podfile index 4d139711ef01..1d0b4dcfd901 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -122,4 +122,4 @@ target 'NotificationServiceExtension' do pod 'AppLogs', :path => '../node_modules/react-native-app-logs/AppLogsPod' end -pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.52.0-xcframework.tar.gz' \ No newline at end of file +pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.52.0-xcframework.tar.gz' From 88cd73d91430f2aff2790718b8300b2f4262c3b7 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 7 Nov 2024 16:48:25 +0100 Subject: [PATCH 028/145] fix: prettier --- src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx b/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx index 3aed3f920dd0..697e64bf8608 100644 --- a/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx +++ b/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx @@ -28,8 +28,8 @@ import * as TwoFactorAuthActions from '@userActions/TwoFactorAuthActions'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import type SCREENS from '@src/SCREENS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import SCREENS from '@src/SCREENS'; type CodesStepProps = BackToParams; From d29e08f1c700972618e1c648f4e13fdb636e2b27 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 7 Nov 2024 17:51:36 +0100 Subject: [PATCH 029/145] fix: Podfile.lock --- ios/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6494782a6ec0..fbda847a60ba 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -3283,6 +3283,6 @@ SPEC CHECKSUMS: VisionCamera: c6c8aa4b028501fc87644550fbc35a537d4da3fb Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8 -PODFILE CHECKSUM: 15e2f095b9c80d658459723edf84005a6867debf +PODFILE CHECKSUM: bf538ad3cea170c0bde913f0530618bf7f098f99 COCOAPODS: 1.15.2 From 44c238d91226d2f7556eeaf237f60eecaf8f3392 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 7 Nov 2024 17:52:23 +0100 Subject: [PATCH 030/145] fix: remove unused code --- .../settings/Security/TwoFactorAuth/Steps/CodesStep.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx b/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx index 697e64bf8608..0e0d1919423d 100644 --- a/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx +++ b/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx @@ -1,4 +1,3 @@ -import {useRoute} from '@react-navigation/native'; import React, {useEffect, useMemo, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -19,8 +18,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Clipboard from '@libs/Clipboard'; import * as ErrorUtils from '@libs/ErrorUtils'; import localFileDownload from '@libs/localFileDownload'; -import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; -import type {BackToParams, SettingsNavigatorParamList} from '@libs/Navigation/types'; +import type {BackToParams} from '@libs/Navigation/types'; import StepWrapper from '@pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper'; import useTwoFactorAuthContext from '@pages/settings/Security/TwoFactorAuth/TwoFactorAuthContext/useTwoFactorAuth'; import * as Session from '@userActions/Session'; @@ -28,7 +26,6 @@ import * as TwoFactorAuthActions from '@userActions/TwoFactorAuthActions'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type SCREENS from '@src/SCREENS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; type CodesStepProps = BackToParams; @@ -47,7 +44,6 @@ function CodesStep({backTo}: CodesStepProps) { const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); const isUserValidated = user?.validated; - const route = useRoute>(); const contactMethod = account?.primaryLogin ?? ''; const loginData = useMemo(() => loginList?.[contactMethod], [loginList, contactMethod]); From 3640bf2d72fbde1eecddfbc98a9842c03ba4cc4c Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 7 Nov 2024 17:56:19 +0100 Subject: [PATCH 031/145] fix: add `react-native-screens` patch for ios modal unmount flicker --- ...+fix-screen-flicker-on-modal-unmount.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patches/react-native-screens+3.34.0+005+fix-screen-flicker-on-modal-unmount.patch diff --git a/patches/react-native-screens+3.34.0+005+fix-screen-flicker-on-modal-unmount.patch b/patches/react-native-screens+3.34.0+005+fix-screen-flicker-on-modal-unmount.patch new file mode 100644 index 000000000000..bbeedbc57873 --- /dev/null +++ b/patches/react-native-screens+3.34.0+005+fix-screen-flicker-on-modal-unmount.patch @@ -0,0 +1,22 @@ +diff --git a/node_modules/react-native-screens/ios/RNSScreenStack.mm b/node_modules/react-native-screens/ios/RNSScreenStack.mm +index ea27b03..8f1d005 100644 +--- a/node_modules/react-native-screens/ios/RNSScreenStack.mm ++++ b/node_modules/react-native-screens/ios/RNSScreenStack.mm +@@ -1121,16 +1121,7 @@ - (void)mountChildComponentView:(UIView *)childCompone + - (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index + { + RNSScreenView *screenChildComponent = (RNSScreenView *)childComponentView; +- +- // We should only do a snapshot of a screen that is on the top. +- // We also check `_presentedModals` since if you push 2 modals, second one is not a "child" of _controller. +- // Also, when dissmised with a gesture, the screen already is not under the window, so we don't need to apply +- // snapshot. +- if (screenChildComponent.window != nil && +- ((screenChildComponent == _controller.visibleViewController.view && _presentedModals.count < 2) || +- screenChildComponent == [_presentedModals.lastObject view])) { +- [screenChildComponent.controller setViewToSnapshot]; +- } ++ [screenChildComponent.controller setViewToSnapshot]; + + RCTAssert( + screenChildComponent.reactSuperview == self, From 039fc64426d1d1c58bd37959e0e4d17e628fd97f Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Thu, 7 Nov 2024 23:44:11 +0530 Subject: [PATCH 032/145] Feature: Import/Export Per Diem Rates --- src/CONST.ts | 1 + src/ROUTES.ts | 8 + src/SCREENS.ts | 2 + src/components/ImportColumn.tsx | 2 +- src/components/ImportSpreadsheet.tsx | 8 +- src/languages/en.ts | 4 + src/languages/es.ts | 4 + src/languages/params.ts | 5 + .../API/parameters/ExportPerDiemCSVParams.ts | 6 + .../parameters/ImportPerDiemRatesParams.ts | 26 +++ src/libs/API/parameters/index.ts | 2 + src/libs/API/types.ts | 4 + .../ModalStackNavigators/index.tsx | 2 + .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 + src/libs/Navigation/linkingConfig/config.ts | 6 + src/libs/Navigation/types.ts | 6 + src/libs/actions/Policy/PerDiem.ts | 65 ++++++- .../categories/ImportCategoriesPage.tsx | 4 +- .../workspace/members/ImportMembersPage.tsx | 4 +- .../workspace/perDiem/ImportPerDiemPage.tsx | 21 +++ .../workspace/perDiem/ImportedPerDiemPage.tsx | 171 ++++++++++++++++++ .../perDiem/WorkspacePerDiemPage.tsx | 35 ++-- src/pages/workspace/tags/ImportTagsPage.tsx | 4 +- 23 files changed, 365 insertions(+), 26 deletions(-) create mode 100644 src/libs/API/parameters/ExportPerDiemCSVParams.ts create mode 100644 src/libs/API/parameters/ImportPerDiemRatesParams.ts create mode 100644 src/pages/workspace/perDiem/ImportPerDiemPage.tsx create mode 100644 src/pages/workspace/perDiem/ImportedPerDiemPage.tsx diff --git a/src/CONST.ts b/src/CONST.ts index 72dff8c87b17..b686ca491aa4 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -6153,6 +6153,7 @@ const CONST = { RATE_ID: 'rateID', ENABLED: 'enabled', IGNORE: 'ignore', + DESTINATION: 'destination', }, IMPORT_SPREADSHEET: { diff --git a/src/ROUTES.ts b/src/ROUTES.ts index cd94035e0fff..6a3d43313c77 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1277,6 +1277,14 @@ const ROUTES = { route: 'settings/workspaces/:policyID/per-diem', getRoute: (policyID: string) => `settings/workspaces/${policyID}/per-diem` as const, }, + WORKSPACE_PER_DIEM_IMPORT: { + route: 'settings/workspaces/:policyID/per-diem/import', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/per-diem/import` as const, + }, + WORKSPACE_PER_DIEM_IMPORTED: { + route: 'settings/workspaces/:policyID/per-diem/imported', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/per-diem/imported` as const, + }, RULES_CUSTOM_NAME: { route: 'settings/workspaces/:policyID/rules/name', getRoute: (policyID: string) => `settings/workspaces/${policyID}/rules/name` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 9b8fe54111cf..a3d4c570851d 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -543,6 +543,8 @@ const SCREENS = { RULES_MAX_EXPENSE_AGE: 'Rules_Max_Expense_Age', RULES_BILLABLE_DEFAULT: 'Rules_Billable_Default', PER_DIEM: 'Per_Diem', + PER_DIEM_IMPORT: 'Per_Diem_Import', + PER_DIEM_IMPORTED: 'Per_Diem_Imported', }, EDIT_REQUEST: { diff --git a/src/components/ImportColumn.tsx b/src/components/ImportColumn.tsx index d3f5eb75f7e8..0e1ae935a2b7 100644 --- a/src/components/ImportColumn.tsx +++ b/src/components/ImportColumn.tsx @@ -87,7 +87,7 @@ function findColumnName(header: string): string { break; case 'destination': - attribute = CONST.CSV_IMPORT_COLUMNS.NAME; + attribute = CONST.CSV_IMPORT_COLUMNS.DESTINATION; break; case 'subrate': diff --git a/src/components/ImportSpreadsheet.tsx b/src/components/ImportSpreadsheet.tsx index 6865e8ae6c82..09f8c1d5b925 100644 --- a/src/components/ImportSpreadsheet.tsx +++ b/src/components/ImportSpreadsheet.tsx @@ -33,7 +33,7 @@ type ImportSpreedsheetProps = { goTo: Routes; }; -function ImportSpreedsheet({backTo, goTo}: ImportSpreedsheetProps) { +function ImportSpreadsheet({backTo, goTo}: ImportSpreedsheetProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const [isReadingFile, setIsReadingFIle] = useState(false); @@ -160,7 +160,7 @@ function ImportSpreedsheet({backTo, goTo}: ImportSpreedsheetProps) { @@ -214,6 +214,6 @@ function ImportSpreedsheet({backTo, goTo}: ImportSpreedsheetProps) { ); } -ImportSpreedsheet.displayName = 'ImportSpreedsheet'; +ImportSpreadsheet.displayName = 'ImportSpreadsheet'; -export default ImportSpreedsheet; +export default ImportSpreadsheet; diff --git a/src/languages/en.ts b/src/languages/en.ts index 92bed5ecf1f0..242365dbaf1d 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -73,6 +73,7 @@ import type { ImportedTypesParams, ImportFieldParams, ImportMembersSuccessfullDescriptionParams, + ImportPerDiemRatesSuccessfullDescriptionParams, ImportTagsSuccessfullDescriptionParams, IncorrectZipFormatParams, InstantSummaryParams, @@ -764,6 +765,8 @@ const translations = { importCategoriesSuccessfullDescription: ({categories}: SpreadCategoriesParams) => (categories > 1 ? `${categories} categories have been added.` : '1 category has been added.'), importMembersSuccessfullDescription: ({members}: ImportMembersSuccessfullDescriptionParams) => (members > 1 ? `${members} members have been added.` : '1 member has been added.'), importTagsSuccessfullDescription: ({tags}: ImportTagsSuccessfullDescriptionParams) => (tags > 1 ? `${tags} tags have been added.` : '1 tag has been added.'), + importPerDiemRatesSuccessfullDescription: ({rates}: ImportPerDiemRatesSuccessfullDescriptionParams) => + rates > 1 ? `${rates} per diem rates have been added.` : '1 per diem rate has been added.', importFailedTitle: 'Import failed', importFailedDescription: 'Please ensure all fields are filled out correctly and try again. If the problem persists, please reach out to Concierge.', importDescription: 'Choose which fields to map from your spreadsheet by clicking the dropdown next to each imported column below.', @@ -2420,6 +2423,7 @@ const translations = { title: 'Per diem', subtitle: 'Set per diem rates to control daily employee spend. Import rates from a spreadsheet to get started.', }, + importPerDiemRates: 'Import per diem rates', }, qbd: { exportOutOfPocketExpensesDescription: 'Set how out-of-pocket expenses export to QuickBooks Desktop.', diff --git a/src/languages/es.ts b/src/languages/es.ts index eefbb16870b5..8cdb1e9ed311 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -71,6 +71,7 @@ import type { ImportedTypesParams, ImportFieldParams, ImportMembersSuccessfullDescriptionParams, + ImportPerDiemRatesSuccessfullDescriptionParams, ImportTagsSuccessfullDescriptionParams, IncorrectZipFormatParams, InstantSummaryParams, @@ -759,6 +760,8 @@ const translations = { importCategoriesSuccessfullDescription: ({categories}: SpreadCategoriesParams) => (categories > 1 ? `Se han agregado ${categories} categorías.` : 'Se ha agregado 1 categoría.'), importMembersSuccessfullDescription: ({members}: ImportMembersSuccessfullDescriptionParams) => (members > 1 ? `Se han agregado ${members} miembros.` : 'Se ha agregado 1 miembro.'), importTagsSuccessfullDescription: ({tags}: ImportTagsSuccessfullDescriptionParams) => (tags > 1 ? `Se han agregado ${tags} etiquetas.` : 'Se ha agregado 1 etiqueta.'), + importPerDiemRatesSuccessfullDescription: ({rates}: ImportPerDiemRatesSuccessfullDescriptionParams) => + rates > 1 ? `Se han añadido ${rates} tasas de per diem.` : 'Se ha añadido 1 tasa de per diem.', importSuccessfullTitle: 'Importar categorías', importDescription: 'Elige qué campos mapear desde tu hoja de cálculo haciendo clic en el menú desplegable junto a cada columna importada a continuación.', sizeNotMet: 'El archivo adjunto debe ser más grande que 0 bytes.', @@ -2443,6 +2446,7 @@ const translations = { title: 'Per diem', subtitle: 'Establece dietas per diem para controlar el gasto diario de los empleados. Importa las tarifas desde una hoja de cálculo para comenzar.', }, + importPerDiemRates: 'Importar tasas de per diem', }, qbd: { exportOutOfPocketExpensesDescription: 'Establezca cómo se exportan los gastos de bolsillo a QuickBooks Desktop.', diff --git a/src/languages/params.ts b/src/languages/params.ts index e9f0c4370357..0dc6e1b75198 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -531,6 +531,10 @@ type ImportMembersSuccessfullDescriptionParams = { members: number; }; +type ImportPerDiemRatesSuccessfullDescriptionParams = { + rates: number; +}; + type AuthenticationErrorParams = { connectionName: string; }; @@ -746,4 +750,5 @@ export type { OptionalParam, AssignCardParams, ImportedTypesParams, + ImportPerDiemRatesSuccessfullDescriptionParams, }; diff --git a/src/libs/API/parameters/ExportPerDiemCSVParams.ts b/src/libs/API/parameters/ExportPerDiemCSVParams.ts new file mode 100644 index 000000000000..553621534df5 --- /dev/null +++ b/src/libs/API/parameters/ExportPerDiemCSVParams.ts @@ -0,0 +1,6 @@ +type ExportPerDiemCSVParams = { + /** ID of the policy */ + policyID: string; +}; + +export default ExportPerDiemCSVParams; diff --git a/src/libs/API/parameters/ImportPerDiemRatesParams.ts b/src/libs/API/parameters/ImportPerDiemRatesParams.ts new file mode 100644 index 000000000000..b67517150f2d --- /dev/null +++ b/src/libs/API/parameters/ImportPerDiemRatesParams.ts @@ -0,0 +1,26 @@ +type ImportPerDiemRatesParams = { + /** ID of the policy */ + policyID: string; + + /** Custom Unit ID of the per diem unit */ + customUnitID: string; + + /** + * Stringified JSON object with type of following structure: + * Array<{ + * customUnitRateID: ; + * name: “Spain”; + * currency: “EUR”; + * enabled: true (since we are importing); + * rate: 0 (since we have subrates); + * Attributes: []; + * subRates: An array with each element in the following shape: + * id: “66d5ae9a0379d”; + * name: “Full Day”; + * rate: 3000 (in cents); + * }> + */ + customUnitRates: string; +}; + +export default ImportPerDiemRatesParams; diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index fb5558fb0350..f03539e78d13 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -349,3 +349,5 @@ export type {default as UpdateQuickbooksDesktopCompanyCardExpenseAccountTypePara export type {default as TogglePolicyPerDiemParams} from './TogglePolicyPerDiemParams'; export type {default as OpenPolicyPerDiemRatesPageParams} from './OpenPolicyPerDiemRatesPageParams'; export type {default as TogglePlatformMuteParams} from './TogglePlatformMuteParams'; +export type {default as ImportPerDiemRatesParams} from './ImportPerDiemRatesParams'; +export type {default as ExportPerDiemCSVParams} from './ExportPerDiemCSVParams'; diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index b8b4bb749701..b6eb17d7be33 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -148,9 +148,11 @@ const WRITE_COMMANDS = { IMPORT_CATEGORIES_SPREADSHEET: 'ImportCategoriesSpreadsheet', IMPORT_MEMBERS_SPREADSHEET: 'ImportMembersSpreadsheet', IMPORT_TAGS_SPREADSHEET: 'ImportTagsSpreadsheet', + IMPORT_PER_DIEM_RATES: 'ImportPerDiemRates', EXPORT_CATEGORIES_CSV: 'ExportCategoriesCSV', EXPORT_MEMBERS_CSV: 'ExportMembersCSV', EXPORT_TAGS_CSV: 'ExportTagsCSV', + EXPORT_PER_DIEM_CSV: 'ExportPerDiemCSV', EXPORT_REPORT_TO_CSV: 'ExportReportToCSV', RENAME_WORKSPACE_CATEGORY: 'RenameWorkspaceCategory', CREATE_POLICY_TAG: 'CreatePolicyTag', @@ -572,11 +574,13 @@ type WriteCommandParameters = { [WRITE_COMMANDS.SET_WORKSPACE_CATEGORIES_ENABLED]: Parameters.SetWorkspaceCategoriesEnabledParams; [WRITE_COMMANDS.CREATE_WORKSPACE_CATEGORIES]: Parameters.CreateWorkspaceCategoriesParams; [WRITE_COMMANDS.IMPORT_CATEGORIES_SPREADSHEET]: Parameters.ImportCategoriesSpreadsheetParams; + [WRITE_COMMANDS.IMPORT_PER_DIEM_RATES]: Parameters.ImportPerDiemRatesParams; [WRITE_COMMANDS.IMPORT_MEMBERS_SPREADSHEET]: Parameters.ImportMembersSpreadsheetParams; [WRITE_COMMANDS.IMPORT_TAGS_SPREADSHEET]: Parameters.ImportTagsSpreadsheetParams; [WRITE_COMMANDS.EXPORT_CATEGORIES_CSV]: Parameters.ExportCategoriesSpreadsheetParams; [WRITE_COMMANDS.EXPORT_MEMBERS_CSV]: Parameters.ExportMembersSpreadsheetParams; [WRITE_COMMANDS.EXPORT_TAGS_CSV]: Parameters.ExportTagsSpreadsheetParams; + [WRITE_COMMANDS.EXPORT_PER_DIEM_CSV]: Parameters.ExportPerDiemCSVParams; [WRITE_COMMANDS.RENAME_WORKSPACE_CATEGORY]: Parameters.RenameWorkspaceCategoriesParams; [WRITE_COMMANDS.SET_WORKSPACE_REQUIRES_CATEGORY]: Parameters.SetWorkspaceRequiresCategoryParams; [WRITE_COMMANDS.DELETE_WORKSPACE_CATEGORIES]: Parameters.DeleteWorkspaceCategoriesParams; diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 8a64424c8f7d..68c711583c25 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -566,6 +566,8 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/rules/RulesMaxExpenseAmountPage').default, [SCREENS.WORKSPACE.RULES_MAX_EXPENSE_AGE]: () => require('../../../../pages/workspace/rules/RulesMaxExpenseAgePage').default, [SCREENS.WORKSPACE.RULES_BILLABLE_DEFAULT]: () => require('../../../../pages/workspace/rules/RulesBillableDefaultPage').default, + [SCREENS.WORKSPACE.PER_DIEM_IMPORT]: () => require('../../../../pages/workspace/perDiem/ImportPerDiemPage').default, + [SCREENS.WORKSPACE.PER_DIEM_IMPORTED]: () => require('../../../../pages/workspace/perDiem/ImportedPerDiemPage').default, }); const EnablePaymentsStackNavigator = createModalStackNavigator({ diff --git a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts index d282bab770c6..c4ce9eac7fa6 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -243,6 +243,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.RULES_MAX_EXPENSE_AGE, SCREENS.WORKSPACE.RULES_BILLABLE_DEFAULT, ], + [SCREENS.WORKSPACE.PER_DIEM]: [SCREENS.WORKSPACE.PER_DIEM_IMPORT, SCREENS.WORKSPACE.PER_DIEM_IMPORTED], }; export default FULL_SCREEN_TO_RHP_MAPPING; diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 7a5b31489764..383cf41ddbac 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -935,6 +935,12 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.RULES_BILLABLE_DEFAULT]: { path: ROUTES.RULES_BILLABLE_DEFAULT.route, }, + [SCREENS.WORKSPACE.PER_DIEM_IMPORT]: { + path: ROUTES.WORKSPACE_PER_DIEM_IMPORT.route, + }, + [SCREENS.WORKSPACE.PER_DIEM_IMPORTED]: { + path: ROUTES.WORKSPACE_PER_DIEM_IMPORTED.route, + }, }, }, [SCREENS.RIGHT_MODAL.PRIVATE_NOTES]: { diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index ba859efff944..89f4c321b16e 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -896,6 +896,12 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.RULES_BILLABLE_DEFAULT]: { policyID: string; }; + [SCREENS.WORKSPACE.PER_DIEM_IMPORT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.PER_DIEM_IMPORTED]: { + policyID: string; + }; } & ReimbursementAccountNavigatorParamList; type NewChatNavigatorParamList = { diff --git a/src/libs/actions/Policy/PerDiem.ts b/src/libs/actions/Policy/PerDiem.ts index 2ce31fd4c921..beb109b04c8f 100644 --- a/src/libs/actions/Policy/PerDiem.ts +++ b/src/libs/actions/Policy/PerDiem.ts @@ -2,13 +2,18 @@ import type {NullishDeep, OnyxCollection} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import * as API from '@libs/API'; import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types'; +import * as ApiUtils from '@libs/ApiUtils'; +import fileDownload from '@libs/fileDownload'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; +import {translateLocal} from '@libs/Localize'; +import enhanceParameters from '@libs/Network/enhanceParameters'; import * as NumberUtils from '@libs/NumberUtils'; import {navigateWhenEnableFeature} from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Policy, Report} from '@src/types/onyx'; +import type {Rate} from '@src/types/onyx/Policy'; import type {OnyxData} from '@src/types/onyx/Request'; const allPolicies: OnyxCollection = {}; @@ -119,4 +124,62 @@ function openPolicyPerDiemPage(policyID?: string) { API.read(READ_COMMANDS.OPEN_POLICY_PER_DIEM_RATES_PAGE, params); } -export {enablePerDiem, openPolicyPerDiemPage}; +function updateImportSpreadsheetData(ratesLength: number) { + const onyxData: OnyxData = { + successData: [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.IMPORTED_SPREADSHEET, + value: { + shouldFinalModalBeOpened: true, + importFinalModal: { + title: translateLocal('spreadsheet.importSuccessfullTitle'), + prompt: translateLocal('spreadsheet.importPerDiemRatesSuccessfullDescription', {rates: ratesLength}), + }, + }, + }, + ], + + failureData: [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.IMPORTED_SPREADSHEET, + value: { + shouldFinalModalBeOpened: true, + importFinalModal: {title: translateLocal('spreadsheet.importFailedTitle'), prompt: translateLocal('spreadsheet.importFailedDescription')}, + }, + }, + ], + }; + + return onyxData; +} + +function importPerDiemRates(policyID: string, customUnitID: string, rates: Rate[]) { + const onyxData = updateImportSpreadsheetData(rates.length); + + const parameters = { + policyID, + customUnitID, + customUnitRates: JSON.stringify(rates), + }; + + API.write(WRITE_COMMANDS.IMPORT_PER_DIEM_RATES, parameters, onyxData); +} + +function downloadPerDiemCSV(policyID: string, onDownloadFailed: () => void) { + const finalParameters = enhanceParameters(WRITE_COMMANDS.EXPORT_PER_DIEM_CSV, { + policyID, + }); + + const fileName = 'PerDiem.csv'; + + const formData = new FormData(); + Object.entries(finalParameters).forEach(([key, value]) => { + formData.append(key, String(value)); + }); + + fileDownload(ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_PER_DIEM_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed); +} + +export {generateCustomUnitID, enablePerDiem, openPolicyPerDiemPage, importPerDiemRates, downloadPerDiemCSV}; diff --git a/src/pages/workspace/categories/ImportCategoriesPage.tsx b/src/pages/workspace/categories/ImportCategoriesPage.tsx index 82afe6dfc812..c6a3065dbfb5 100644 --- a/src/pages/workspace/categories/ImportCategoriesPage.tsx +++ b/src/pages/workspace/categories/ImportCategoriesPage.tsx @@ -1,6 +1,6 @@ import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; -import ImportSpreedsheet from '@components/ImportSpreadsheet'; +import ImportSpreadsheet from '@components/ImportSpreadsheet'; import usePolicy from '@hooks/usePolicy'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -22,7 +22,7 @@ function ImportCategoriesPage({route}: ImportCategoriesPageProps) { } return ( - diff --git a/src/pages/workspace/members/ImportMembersPage.tsx b/src/pages/workspace/members/ImportMembersPage.tsx index 6fff3085b472..b85ea25a617a 100644 --- a/src/pages/workspace/members/ImportMembersPage.tsx +++ b/src/pages/workspace/members/ImportMembersPage.tsx @@ -1,6 +1,6 @@ import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; -import ImportSpreedsheet from '@components/ImportSpreadsheet'; +import ImportSpreadsheet from '@components/ImportSpreadsheet'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; @@ -11,7 +11,7 @@ function ImportMembersPage({route}: ImportMembersPageProps) { const policyID = route.params.policyID; return ( - diff --git a/src/pages/workspace/perDiem/ImportPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportPerDiemPage.tsx new file mode 100644 index 000000000000..4d20c0fdbff9 --- /dev/null +++ b/src/pages/workspace/perDiem/ImportPerDiemPage.tsx @@ -0,0 +1,21 @@ +import type {StackScreenProps} from '@react-navigation/stack'; +import React from 'react'; +import ImportSpreadsheet from '@components/ImportSpreadsheet'; +import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; +import ROUTES from '@src/ROUTES'; +import type SCREENS from '@src/SCREENS'; + +type ImportPerDiemPageProps = StackScreenProps; + +function ImportPerDiemPage({route}: ImportPerDiemPageProps) { + const policyID = route.params.policyID; + + return ( + + ); +} + +export default ImportPerDiemPage; diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx new file mode 100644 index 000000000000..2eedc53a9558 --- /dev/null +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -0,0 +1,171 @@ +import type {StackScreenProps} from '@react-navigation/stack'; +import React, {useCallback, useState} from 'react'; +import {useOnyx} from 'react-native-onyx'; +import ConfirmModal from '@components/ConfirmModal'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import type {ColumnRole} from '@components/ImportColumn'; +import ImportSpreadsheetColumns from '@components/ImportSpreadsheetColumns'; +import ScreenWrapper from '@components/ScreenWrapper'; +import useLocalize from '@hooks/useLocalize'; +import usePolicy from '@hooks/usePolicy'; +import {closeImportPage} from '@libs/actions/ImportSpreadsheet'; +import {generateCustomUnitID, importPerDiemRates} from '@libs/actions/Policy/PerDiem'; +import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; +import Navigation from '@libs/Navigation/Navigation'; +import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; +import {getPerDiemCustomUnit} from '@libs/PolicyUtils'; +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; +import type SCREENS from '@src/SCREENS'; +import type {Errors} from '@src/types/onyx/OnyxCommon'; +import type {Rate} from '@src/types/onyx/Policy'; + +function generatePerDiemUnits(perDiemDestination: string[], perDiemSubRate: string[], perDiemCurrency: string[], perDiemAmount: string[]) { + const perDiemUnits: Record = {}; + for (let i = 0; i < perDiemDestination.length; i++) { + perDiemUnits[perDiemDestination[i]] = perDiemUnits[perDiemDestination[i]] ?? { + customUnitRateID: perDiemDestination.at(i), + name: perDiemDestination.at(i), + rate: 0, + currency: perDiemCurrency.at(i), + enabled: true, + attributes: [], + subRates: [], + }; + perDiemUnits[perDiemDestination[i]].subRates?.push({ + id: generateCustomUnitID(), + name: perDiemSubRate.at(i) ?? '', + rate: Number(perDiemAmount.at(i)) ?? 0, + }); + } + return Object.values(perDiemUnits); +} + +type ImportedPerDiemPageProps = StackScreenProps; +function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { + const {translate} = useLocalize(); + const [spreadsheet] = useOnyx(ONYXKEYS.IMPORTED_SPREADSHEET); + const [isImportingPerDiemRates, setIsImportingPerDiemRates] = useState(false); + const {containsHeader = true} = spreadsheet ?? {}; + const [isValidationEnabled, setIsValidationEnabled] = useState(false); + const policyID = route.params.policyID; + const policy = usePolicy(policyID); + const perDiemCustomUnit = getPerDiemCustomUnit(policy); + const columnNames = generateColumnNames(spreadsheet?.data?.length ?? 0); + + const getColumnRoles = (): ColumnRole[] => { + const roles = []; + roles.push( + {text: translate('common.ignore'), value: CONST.CSV_IMPORT_COLUMNS.IGNORE}, + {text: translate('workspace.perDiem.destination'), value: CONST.CSV_IMPORT_COLUMNS.DESTINATION, isRequired: true}, + {text: translate('workspace.perDiem.subrate'), value: CONST.CSV_IMPORT_COLUMNS.SUBRATE, isRequired: true}, + {text: translate('common.currency'), value: CONST.CSV_IMPORT_COLUMNS.CURRENCY, isRequired: true}, + {text: translate('workspace.perDiem.amount'), value: CONST.CSV_IMPORT_COLUMNS.AMOUNT, isRequired: true}, + ); + + return roles; + }; + + const columnRoles = getColumnRoles(); + + const requiredColumns = columnRoles.filter((role) => role.isRequired).map((role) => role); + + const validate = useCallback(() => { + const columns = Object.values(spreadsheet?.columns ?? {}); + let errors: Errors = {}; + + if (!requiredColumns.every((requiredColumn) => columns.includes(requiredColumn.value))) { + // eslint-disable-next-line rulesdir/prefer-early-return + requiredColumns.forEach((requiredColumn) => { + if (!columns.includes(requiredColumn.value)) { + errors.required = translate('spreadsheet.fieldNotMapped', {fieldName: requiredColumn.text}); + } + }); + } else { + const duplicate = findDuplicate(columns); + const duplicateColumn = columnRoles.find((role) => role.value === duplicate); + if (duplicateColumn) { + errors.duplicates = translate('spreadsheet.singleFieldMultipleColumns', {fieldName: duplicateColumn.text}); + } else { + errors = {}; + } + } + return errors; + }, [requiredColumns, spreadsheet?.columns, translate, columnRoles]); + + const importCategories = useCallback(() => { + setIsValidationEnabled(true); + const errors = validate(); + if (Object.keys(errors).length > 0) { + return; + } + + const columns = Object.values(spreadsheet?.columns ?? {}); + const perDiemDestinationColumn = columns.findIndex((column) => column === CONST.CSV_IMPORT_COLUMNS.DESTINATION); + const perDiemSubRateColumn = columns.findIndex((column) => column === CONST.CSV_IMPORT_COLUMNS.SUBRATE); + const perDiemCurrencyColumn = columns.findIndex((column) => column === CONST.CSV_IMPORT_COLUMNS.CURRENCY); + const perDiemAmountColumn = columns.findIndex((column) => column === CONST.CSV_IMPORT_COLUMNS.AMOUNT); + const perDiemDestination = spreadsheet?.data[perDiemDestinationColumn].map((destination) => destination) ?? []; + const perDiemSubRate = spreadsheet?.data[perDiemSubRateColumn].map((subRate) => subRate) ?? []; + const perDiemCurrency = spreadsheet?.data[perDiemCurrencyColumn].map((currency) => currency) ?? []; + const perDiemAmount = spreadsheet?.data[perDiemAmountColumn].map((amount) => amount) ?? []; + const perDiemUnits = generatePerDiemUnits( + perDiemDestination?.slice(containsHeader ? 1 : 0), + perDiemSubRate?.slice(containsHeader ? 1 : 0), + perDiemCurrency?.slice(containsHeader ? 1 : 0), + perDiemAmount?.slice(containsHeader ? 1 : 0), + ); + + if (perDiemUnits) { + setIsImportingPerDiemRates(true); + importPerDiemRates(policyID, perDiemCustomUnit?.customUnitID ?? '', perDiemUnits); + } + }, [validate, spreadsheet?.columns, spreadsheet?.data, containsHeader, policyID, perDiemCustomUnit?.customUnitID]); + + const spreadsheetColumns = spreadsheet?.data; + if (!spreadsheetColumns) { + return; + } + + const closeImportPageAndModal = () => { + setIsImportingPerDiemRates(false); + closeImportPage(); + Navigation.navigate(ROUTES.WORKSPACE_PER_DIEM.getRoute(policyID)); + }; + + return ( + + Navigation.goBack(ROUTES.WORKSPACE_PER_DIEM_IMPORT.getRoute(policyID))} + /> + + + + + ); +} + +ImportedPerDiemPage.displayName = 'ImportedPerDiemPage'; + +export default ImportedPerDiemPage; diff --git a/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx b/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx index 9430cfd911b5..63c473b86095 100644 --- a/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx +++ b/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx @@ -7,6 +7,7 @@ import Button from '@components/Button'; import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu'; import type {DropdownOption} from '@components/ButtonWithDropdownMenu/types'; import ConfirmModal from '@components/ConfirmModal'; +import DecisionModal from '@components/DecisionModal'; import EmptyStateComponent from '@components/EmptyStateComponent'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import * as Expensicons from '@components/Icon/Expensicons'; @@ -39,7 +40,7 @@ import * as Link from '@userActions/Link'; import * as Modal from '@userActions/Modal'; import * as PerDiem from '@userActions/Policy/PerDiem'; import CONST from '@src/CONST'; -// import ROUTES from '@src/ROUTES'; +import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {PendingAction} from '@src/types/onyx/OnyxCommon'; import type {Rate} from '@src/types/onyx/Policy'; @@ -107,7 +108,9 @@ function generateSingleSubRateData(customUnitRates: Rate[], rateID: string, subR type WorkspacePerDiemPageProps = StackScreenProps; function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) { - const {shouldUseNarrowLayout} = useResponsiveLayout(); + // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to apply the correct modal type for the decision modal + // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth + const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout(); const {windowWidth} = useWindowDimensions(); const styles = useThemeStyles(); const theme = useTheme(); @@ -115,6 +118,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) { const [isOfflineModalVisible, setIsOfflineModalVisible] = useState(false); const [selectedPerDiem, setSelectedPerDiem] = useState([]); const [deletePerDiemConfirmModalVisible, setDeletePerDiemConfirmModalVisible] = useState(false); + const [isDownloadFailureModalVisible, setIsDownloadFailureModalVisible] = useState(false); const isFocused = useIsFocused(); const policyID = route.params.policyID ?? '-1'; const backTo = route.params?.backTo; @@ -305,34 +309,31 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) { { icon: Expensicons.Table, text: translate('spreadsheet.importSpreadsheet'), - // eslint-disable-next-line rulesdir/prefer-early-return onSelected: () => { if (isOffline) { Modal.close(() => setIsOfflineModalVisible(true)); - // eslint-disable-next-line no-useless-return return; } - // TODO: Uncomment this when the import feature is ready - // Navigation.navigate(ROUTES.WORKSPACE_PER_DIEM_IMPORT.getRoute(policyID)); + Navigation.navigate(ROUTES.WORKSPACE_PER_DIEM_IMPORT.getRoute(policyID)); }, }, { icon: Expensicons.Download, text: translate('spreadsheet.downloadCSV'), - // eslint-disable-next-line rulesdir/prefer-early-return onSelected: () => { if (isOffline) { Modal.close(() => setIsOfflineModalVisible(true)); - // eslint-disable-next-line no-useless-return return; } - // Category.downloadPerDiemCSV(policyID); + PerDiem.downloadPerDiemCSV(policyID, () => { + setIsDownloadFailureModalVisible(true); + }); }, }, ]; return menuItems; - }, [translate, isOffline]); + }, [translate, isOffline, policyID]); const selectionModeHeader = selectionMode?.isEnabled && shouldUseNarrowLayout; @@ -400,15 +401,12 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) { buttons={[ { buttonText: translate('spreadsheet.importSpreadsheet'), - // eslint-disable-next-line rulesdir/prefer-early-return buttonAction: () => { if (isOffline) { setIsOfflineModalVisible(true); - // eslint-disable-next-line no-useless-return return; } - // TODO: Uncomment this when the import feature is ready - // Navigation.navigate(ROUTES.WORKSPACE_PER_DIEM_IMPORT.getRoute(policyID)); + Navigation.navigate(ROUTES.WORKSPACE_PER_DIEM_IMPORT.getRoute(policyID)); }, success: true, }, @@ -442,6 +440,15 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) { confirmText={translate('common.buttonConfirm')} shouldShowCancelButton={false} /> + setIsDownloadFailureModalVisible(false)} + secondOptionText={translate('common.buttonConfirm')} + isVisible={isDownloadFailureModalVisible} + onClose={() => setIsDownloadFailureModalVisible(false)} + /> ); diff --git a/src/pages/workspace/tags/ImportTagsPage.tsx b/src/pages/workspace/tags/ImportTagsPage.tsx index 1bbe22750210..693eede60161 100644 --- a/src/pages/workspace/tags/ImportTagsPage.tsx +++ b/src/pages/workspace/tags/ImportTagsPage.tsx @@ -1,6 +1,6 @@ import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; -import ImportSpreedsheet from '@components/ImportSpreadsheet'; +import ImportSpreadsheet from '@components/ImportSpreadsheet'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; @@ -13,7 +13,7 @@ function ImportTagsPage({route}: ImportTagsPageProps) { const isQuickSettingsFlow = !!backTo; return ( - From 01061611adde2463c689d9eca25ac6b6b78eeed8 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Fri, 8 Nov 2024 16:30:51 +0100 Subject: [PATCH 033/145] fix: add RNS patch for android keyboard resizing fix --- ....0+006+android-keyboard-adjustResize.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/react-native-screens+3.34.0+006+android-keyboard-adjustResize.patch diff --git a/patches/react-native-screens+3.34.0+006+android-keyboard-adjustResize.patch b/patches/react-native-screens+3.34.0+006+android-keyboard-adjustResize.patch new file mode 100644 index 000000000000..f38b3ad17ad0 --- /dev/null +++ b/patches/react-native-screens+3.34.0+006+android-keyboard-adjustResize.patch @@ -0,0 +1,29 @@ +diff --git a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +index edcfa7d..afa6874 100644 +--- a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt ++++ b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +@@ -17,6 +17,7 @@ import com.facebook.react.bridge.GuardedRunnable + import com.facebook.react.bridge.ReactContext + import com.facebook.react.bridge.UiThreadUtil + import com.swmansion.rnscreens.Screen.WindowTraits ++import kotlin.math.max + + object ScreenWindowTraits { + // Methods concerning statusBar management were taken from `react-native`'s status bar module: +@@ -130,6 +131,7 @@ object ScreenWindowTraits { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + val windowInsets = + defaultInsets.getInsets(WindowInsetsCompat.Type.statusBars()) ++ val imeInsets = defaultInsets.getInsets(WindowInsetsCompat.Type.ime()) + + WindowInsetsCompat + .Builder() +@@ -139,7 +141,7 @@ object ScreenWindowTraits { + windowInsets.left, + 0, + windowInsets.right, +- windowInsets.bottom, ++ max(windowInsets.bottom, imeInsets.bottom), + ), + ).build() + } else { From de6e6816e077647fc75c3a9abcffe46366e18d36 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Mon, 11 Nov 2024 10:16:43 +0800 Subject: [PATCH 034/145] Make sure the first result in most recents is highlighted when user uses CMD+K --- src/components/Search/SearchRouter/SearchRouter.tsx | 12 +++++++++++- src/components/SelectionList/BaseSelectionList.tsx | 3 ++- src/components/SelectionList/types.ts | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index e65b12deb64b..15f9fc94410f 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -325,6 +325,16 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { Report.searchInServer(debouncedInputValue.trim()); }, [debouncedInputValue]); + const setInitialFocus = useCallback(() => { + const initialFocusIndex = sortedRecentSearches?.slice(0, 5).length + (contextualReportData ? 1 : 0); + listRef.current?.setFocusedIndex(initialFocusIndex); + listRef.current?.scrollToIndex(0, false); + }, [sortedRecentSearches, contextualReportData]); + + useEffect(() => { + setInitialFocus(); + }, [sortedRecentSearches]); + const onSearchChange = useCallback( (userQuery: string) => { let newUserQuery = userQuery; @@ -341,7 +351,7 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { if (newUserQuery) { listRef.current?.updateAndScrollToFocusedIndex(0); } else { - listRef.current?.updateAndScrollToFocusedIndex(-1); + setInitialFocus(); } }, [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete], diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index b7bef18896d1..8893360673fd 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -713,12 +713,13 @@ function BaseSelectionList( isTextInputFocusedRef.current = isTextInputFocused; }, []); - useImperativeHandle(ref, () => ({scrollAndHighlightItem, clearInputAfterSelect, updateAndScrollToFocusedIndex, updateExternalTextInputFocus, scrollToIndex}), [ + useImperativeHandle(ref, () => ({scrollAndHighlightItem, clearInputAfterSelect, updateAndScrollToFocusedIndex, updateExternalTextInputFocus, scrollToIndex, setFocusedIndex}), [ scrollAndHighlightItem, clearInputAfterSelect, updateAndScrollToFocusedIndex, updateExternalTextInputFocus, scrollToIndex, + setFocusedIndex, ]); /** Selects row when pressing Enter */ diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 4c7fd330ec18..09a1ca1f8b15 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -618,6 +618,7 @@ type SelectionListHandle = { scrollAndHighlightItem?: (items: string[], timeout: number) => void; clearInputAfterSelect?: () => void; scrollToIndex: (index: number, animated?: boolean) => void; + setFocusedIndex: (index: number) => void; updateAndScrollToFocusedIndex: (newFocusedIndex: number) => void; updateExternalTextInputFocus: (isTextInputFocused: boolean) => void; }; From ac997b5a16cb15472f70e654bc10818035699a31 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Mon, 11 Nov 2024 11:46:11 +0800 Subject: [PATCH 035/145] lint fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 15f9fc94410f..3aeb6a4c76d2 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -326,14 +326,14 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { }, [debouncedInputValue]); const setInitialFocus = useCallback(() => { - const initialFocusIndex = sortedRecentSearches?.slice(0, 5).length + (contextualReportData ? 1 : 0); + const initialFocusIndex = (sortedRecentSearches?.slice(0, 5).length ?? 0) + (contextualReportData ? 1 : 0); listRef.current?.setFocusedIndex(initialFocusIndex); listRef.current?.scrollToIndex(0, false); }, [sortedRecentSearches, contextualReportData]); useEffect(() => { setInitialFocus(); - }, [sortedRecentSearches]); + }, [sortedRecentSearches, setInitialFocus]); const onSearchChange = useCallback( (userQuery: string) => { @@ -354,7 +354,7 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { setInitialFocus(); } }, - [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete], + [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete, setInitialFocus], ); const onSearchSubmit = useCallback( From 50abafcd9fa273dbe5d7c8fabf263236cf0a58b0 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 11 Nov 2024 14:23:52 +0100 Subject: [PATCH 036/145] fix: description field not automatically focused --- .../step/IOURequestStepDescription.tsx | 38 +++---------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepDescription.tsx b/src/pages/iou/request/step/IOURequestStepDescription.tsx index 758770698d06..a39261f08b8c 100644 --- a/src/pages/iou/request/step/IOURequestStepDescription.tsx +++ b/src/pages/iou/request/step/IOURequestStepDescription.tsx @@ -1,14 +1,13 @@ -import {useFocusEffect} from '@react-navigation/native'; import lodashIsEmpty from 'lodash/isEmpty'; -import React, {useCallback, useRef} from 'react'; +import React, {useCallback} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; -import InputWrapperWithRef from '@components/Form/InputWrapper'; +import InputWrapper from '@components/Form/InputWrapper'; import type {FormInputErrors, FormOnyxValues} from '@components/Form/types'; -import type {AnimatedTextInputRef} from '@components/RNTextInput'; import TextInput from '@components/TextInput'; +import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ErrorUtils from '@libs/ErrorUtils'; @@ -17,7 +16,6 @@ import Navigation from '@libs/Navigation/Navigation'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; -import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import variables from '@styles/variables'; import * as IOU from '@userActions/IOU'; import CONST from '@src/CONST'; @@ -71,26 +69,10 @@ function IOURequestStepDescription({ }: IOURequestStepDescriptionProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); - const inputRef = useRef(null); - const focusTimeoutRef = useRef(null); + const {inputCallbackRef} = useAutoFocusInput(true); // In the split flow, when editing we use SPLIT_TRANSACTION_DRAFT to save draft value const isEditingSplitBill = iouType === CONST.IOU.TYPE.SPLIT && action === CONST.IOU.ACTION.EDIT; const currentDescription = isEditingSplitBill && !lodashIsEmpty(splitDraftTransaction) ? splitDraftTransaction?.comment?.comment ?? '' : transaction?.comment?.comment ?? ''; - useFocusEffect( - useCallback(() => { - focusTimeoutRef.current = setTimeout(() => { - if (inputRef.current) { - inputRef.current.focus(); - } - return () => { - if (!focusTimeoutRef.current) { - return; - } - clearTimeout(focusTimeoutRef.current); - }; - }, CONST.ANIMATED_TRANSITION); - }, []), - ); /** * @returns - An object containing the errors for each inputID @@ -168,7 +150,7 @@ function IOURequestStepDescription({ enabledWhenOffline > - { - if (!el) { - return; - } - if (!inputRef.current) { - updateMultilineInputRange(el); - } - inputRef.current = el; - }} autoGrowHeight maxAutoGrowHeight={variables.textInputAutoGrowMaxHeight} shouldSubmitForm isMarkdownEnabled excludedMarkdownStyles={!isReportInGroupPolicy ? ['mentionReport'] : []} + ref={inputCallbackRef} /> From 6437a86e5f2ae3316ec99f9821d08945e4124243 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 11 Nov 2024 15:32:13 +0100 Subject: [PATCH 037/145] fix: outdated BottomTabBar --- .../BottomTabBar.tsx | 124 ++++++++---------- 1 file changed, 53 insertions(+), 71 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx index 7b9422e9045a..34bdf866dbb8 100644 --- a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx @@ -1,22 +1,19 @@ -import {useNavigation} from '@react-navigation/native'; import React, {memo, useCallback, useEffect, useState} from 'react'; -import {NativeModules, View} from 'react-native'; +import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import {PressableWithFeedback} from '@components/Pressable'; import type {SearchQueryString} from '@components/Search/types'; -import Tooltip from '@components/Tooltip'; +import Text from '@components/Text'; import useActiveWorkspace from '@hooks/useActiveWorkspace'; import useCurrentReportID from '@hooks/useCurrentReportID'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as Session from '@libs/actions/Session'; import interceptAnonymousUser from '@libs/interceptAnonymousUser'; import Navigation from '@libs/Navigation/Navigation'; -import type {AuthScreensParamList} from '@libs/Navigation/types'; -import {isCentralPaneName} from '@libs/NavigationUtils'; +import type {AuthScreensParamList, RootStackParamList, State} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as SearchQueryUtils from '@libs/SearchQueryUtils'; import type {BrickRoad} from '@libs/WorkspacesSettingsUtils'; @@ -25,10 +22,7 @@ import navigationRef from '@navigation/navigationRef'; import BottomTabAvatar from '@pages/home/sidebar/BottomTabAvatar'; import BottomTabBarFloatingActionButton from '@pages/home/sidebar/BottomTabBarFloatingActionButton'; import variables from '@styles/variables'; -import * as Welcome from '@userActions/Welcome'; -import * as OnboardingFlow from '@userActions/Welcome/OnboardingFlow'; import CONST from '@src/CONST'; -import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; @@ -71,9 +65,7 @@ function BottomTabBar({selectedTab}: BottomTabBarProps) { const theme = useTheme(); const styles = useThemeStyles(); const {translate} = useLocalize(); - const navigation = useNavigation(); const {activeWorkspaceID} = useActiveWorkspace(); - const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP); const {currentReportID} = useCurrentReportID() ?? {currentReportID: null}; const [user] = useOnyx(ONYXKEYS.USER); const [betas] = useOnyx(ONYXKEYS.BETAS); @@ -92,28 +84,6 @@ function BottomTabBar({selectedTab}: BottomTabBarProps) { // That's why reportActions is added as a dependency here }, [activeWorkspaceID, transactionViolations, reports, reportActions, betas, policies, priorityMode, currentReportID]); - useEffect(() => { - const navigationState = navigation.getState(); - const routes = navigationState?.routes; - const currentRoute = routes?.at(navigationState?.index ?? 0); - // When we are redirected to the Settings tab from the OldDot, we don't want to call the Welcome.show() method. - // To prevent this, the value of the bottomTabRoute?.name is checked here - if (!!(currentRoute && currentRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR && !isCentralPaneName(currentRoute.name)) || Session.isAnonymousUser()) { - return; - } - - // HybridApp has own entry point when we decide whether to display onboarding and explanation modal. - if (NativeModules.HybridAppModule) { - return; - } - - Welcome.isOnboardingFlowCompleted({ - onNotCompleted: () => OnboardingFlow.startOnboardingFlow(), - }); - - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, [isLoadingApp]); - const navigateToChats = useCallback(() => { if (selectedTab === SCREENS.HOME) { return; @@ -127,7 +97,7 @@ function BottomTabBar({selectedTab}: BottomTabBarProps) { return; } interceptAnonymousUser(() => { - const rootState = navigationRef.getRootState(); + const rootState = navigationRef.getRootState() as State; const lastSearchRoute = rootState.routes.filter((route) => route.name === SCREENS.SEARCH.CENTRAL_PANE).at(-1); if (lastSearchRoute) { @@ -166,45 +136,57 @@ function BottomTabBar({selectedTab}: BottomTabBarProps) { /> )} - - + + + {!!chatTabBrickRoad && ( + + )} + + - - - {!!chatTabBrickRoad && ( - - )} - - - - - + + + + + + - - - - - + {translate('common.search')} + + From 2210863f14521f45e095fd44882bd5e4c09ce59d Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 11 Nov 2024 16:44:16 +0100 Subject: [PATCH 038/145] fix: improve navigation options file structure --- .../navigationOptions/animation/index.ts | 11 +++++++++-- .../animation/slideFromBottom/index.native.ts | 6 +++--- .../animation/slideFromBottom/index.ts | 4 ++-- .../animation/slideFromBottom/types.ts | 5 ----- .../animation/slideFromLeft/index.android.ts | 6 +++--- .../animation/slideFromLeft/index.ios.ts | 6 +++--- .../animation/slideFromLeft/index.ts | 4 ++-- .../animation/slideFromLeft/types.ts | 5 ----- .../animation/slideFromRight/index.android.ts | 6 +++--- .../animation/slideFromRight/index.ios.ts | 6 +++--- .../animation/slideFromRight/index.ts | 4 ++-- .../animation/slideFromRight/types.ts | 5 ----- .../navigationOptions/animation/withAnimation.ts | 2 +- .../buildPlatformSpecificNavigationOptions.ts | 10 +++------- .../navigationOptions/presentation/index.ts | 2 ++ .../types/NavigationOptions.ts | 8 +++++--- 16 files changed, 41 insertions(+), 49 deletions(-) delete mode 100644 src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/types.ts delete mode 100644 src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/types.ts delete mode 100644 src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/types.ts diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/index.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/index.ts index 7368a4d1de79..17796333cdda 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/index.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/index.ts @@ -1,11 +1,18 @@ -const TRANSITION_ANIMATIONS = { +const InternalPlatformAnimations = { SLIDE_FROM_LEFT: 'slide_from_left', SLIDE_FROM_RIGHT: 'slide_from_right', SLIDE_FROM_BOTTOM: 'slide_from_bottom', IOS_FROM_LEFT: 'ios_from_left', IOS_FROM_RIGHT: 'ios_from_right', SIMPLE_PUSH: 'simple_push', +} as const; + +const Animations = { + SLIDE_FROM_LEFT: 'slide_from_left', + SLIDE_FROM_RIGHT: 'slide_from_right', + MODAL: 'modal', NONE: 'none', } as const; -export default TRANSITION_ANIMATIONS; +export default Animations; +export {InternalPlatformAnimations}; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/index.native.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/index.native.ts index c38bca7b520b..c5e236e9c27d 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/index.native.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/index.native.ts @@ -1,7 +1,7 @@ import type {NativeStackNavigationOptions} from '@react-navigation/native-stack'; -import Animations from '..'; -import type SlideFromBottomTransitionNavigationOptions from './types'; +import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; +import {InternalPlatformAnimations} from '..'; -const slideFromBottom: SlideFromBottomTransitionNavigationOptions = {animation: Animations.SLIDE_FROM_BOTTOM} satisfies NativeStackNavigationOptions; +const slideFromBottom: PlatformSpecificNavigationOptions = {animation: InternalPlatformAnimations.SLIDE_FROM_BOTTOM} satisfies NativeStackNavigationOptions; export default slideFromBottom; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/index.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/index.ts index ab0ea51081a1..4862c60629a5 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/index.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/index.ts @@ -1,7 +1,7 @@ import type {StackNavigationOptions} from '@react-navigation/stack'; import GestureDirection from '@libs/Navigation/PlatformStackNavigation/navigationOptions/gestureDirection'; -import type SlideFromBottomTransitionNavigationOptions from './types'; +import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; -const slideFromBottom: SlideFromBottomTransitionNavigationOptions = {animationEnabled: true, gestureDirection: GestureDirection.VERTICAL} satisfies StackNavigationOptions; +const slideFromBottom: PlatformSpecificNavigationOptions = {animationEnabled: true, gestureDirection: GestureDirection.VERTICAL} satisfies StackNavigationOptions; export default slideFromBottom; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/types.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/types.ts deleted file mode 100644 index 7e76f03db881..000000000000 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromBottom/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; - -type SlideFromBottomTransitionNavigationOptions = PlatformSpecificNavigationOptions; - -export default SlideFromBottomTransitionNavigationOptions; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.android.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.android.ts index bc00eabd828a..5350cbf967ab 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.android.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.android.ts @@ -1,8 +1,8 @@ import type {NativeStackNavigationOptions} from '@react-navigation/native-stack'; -import Animations from '..'; -import type SlideFromLeftTransitionNavigationOptions from './types'; +import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; +import {InternalPlatformAnimations} from '..'; // `slide_from_right` is resolved to `default` transition on iOS, but this transition causes issues on iOS -const slideFromLeft: SlideFromLeftTransitionNavigationOptions = {animation: Animations.IOS_FROM_LEFT} satisfies NativeStackNavigationOptions; +const slideFromLeft: PlatformSpecificNavigationOptions = {animation: InternalPlatformAnimations.IOS_FROM_LEFT} satisfies NativeStackNavigationOptions; export default slideFromLeft; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.ios.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.ios.ts index 3969719ca6b1..261cd5f451af 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.ios.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.ios.ts @@ -1,9 +1,9 @@ import type {NativeStackNavigationOptions} from '@react-navigation/native-stack'; -import Animations from '..'; -import type SlideFromLeftTransitionNavigationOptions from './types'; +import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; +import {InternalPlatformAnimations} from '..'; // default transition is causing weird keyboard appearance: - https://github.com/Expensify/App/issues/37257 // so we are using `slide_from_left` which is similar to default and not causing keyboard transition issues -const slideFromLeft: SlideFromLeftTransitionNavigationOptions = {animation: Animations.SLIDE_FROM_LEFT} satisfies NativeStackNavigationOptions; +const slideFromLeft: PlatformSpecificNavigationOptions = {animation: InternalPlatformAnimations.SLIDE_FROM_LEFT} satisfies NativeStackNavigationOptions; export default slideFromLeft; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.ts index 05faefd0be0a..0d87ce5864a8 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/index.ts @@ -1,7 +1,7 @@ import type {StackNavigationOptions} from '@react-navigation/stack'; import GestureDirection from '@libs/Navigation/PlatformStackNavigation/navigationOptions/gestureDirection'; -import type SlideFromLeftTransitionNavigationOptions from './types'; +import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; -const slideFromLeft: SlideFromLeftTransitionNavigationOptions = {animationEnabled: true, gestureDirection: GestureDirection.HORIZONTAL_INVERTED} satisfies StackNavigationOptions; +const slideFromLeft: PlatformSpecificNavigationOptions = {animationEnabled: true, gestureDirection: GestureDirection.HORIZONTAL_INVERTED} satisfies StackNavigationOptions; export default slideFromLeft; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/types.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/types.ts deleted file mode 100644 index f170562c3b7a..000000000000 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromLeft/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; - -type SlideFromLeftTransitionNavigationOptions = PlatformSpecificNavigationOptions; - -export default SlideFromLeftTransitionNavigationOptions; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.android.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.android.ts index da58d4d964a5..a42d5075b443 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.android.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.android.ts @@ -1,7 +1,7 @@ import type {NativeStackNavigationOptions} from '@react-navigation/native-stack'; -import Animations from '..'; -import type SlideFromRightTransitionNavigationOptions from './types'; +import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; +import {InternalPlatformAnimations} from '..'; -const transition: SlideFromRightTransitionNavigationOptions = {animation: Animations.IOS_FROM_RIGHT} satisfies NativeStackNavigationOptions; +const transition: PlatformSpecificNavigationOptions = {animation: InternalPlatformAnimations.IOS_FROM_RIGHT} satisfies NativeStackNavigationOptions; export default transition; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.ios.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.ios.ts index 7b4677b2bf2f..287fe4ccbe12 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.ios.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.ios.ts @@ -1,9 +1,9 @@ import type {NativeStackNavigationOptions} from '@react-navigation/native-stack'; -import Animations from '..'; -import type SlideFromRightTransitionNavigationOptions from './types'; +import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; +import {InternalPlatformAnimations} from '..'; // default transition is causing weird keyboard appearance: - https://github.com/Expensify/App/issues/37257 // so we are using `simple_push` which is similar to default and not causing keyboard transition issues -const transition: SlideFromRightTransitionNavigationOptions = {animation: Animations.SIMPLE_PUSH} satisfies NativeStackNavigationOptions; +const transition: PlatformSpecificNavigationOptions = {animation: InternalPlatformAnimations.SIMPLE_PUSH} satisfies NativeStackNavigationOptions; export default transition; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.ts index 2bc6b96b944f..8b6bdf9a323e 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/index.ts @@ -1,6 +1,6 @@ import type {StackNavigationOptions} from '@react-navigation/stack'; -import type SlideFromRightTransitionNavigationOptions from './types'; +import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; -const slideFromRight: SlideFromRightTransitionNavigationOptions = {animationEnabled: true, gestureDirection: 'horizontal'} satisfies StackNavigationOptions; +const slideFromRight: PlatformSpecificNavigationOptions = {animationEnabled: true, gestureDirection: 'horizontal'} satisfies StackNavigationOptions; export default slideFromRight; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/types.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/types.ts deleted file mode 100644 index d1afa32d0dcf..000000000000 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/slideFromRight/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; - -type SlideFromRightTransitionNavigationOptions = PlatformSpecificNavigationOptions; - -export default SlideFromRightTransitionNavigationOptions; diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/withAnimation.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/withAnimation.ts index d485c62ea463..9fafa1f14bad 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/withAnimation.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/withAnimation.ts @@ -15,7 +15,7 @@ function withAnimation screenOptions === undefined ? {} : (({animation, keyboardHandlingEnabled, web, native, ...rest}: PlatformStackNavigationOptions) => rest)(screenOptions); -const buildPlatformSpecificNavigationOptions = ( - screenOptions: PlatformStackNavigationOptions, -): PlatformSpecificNavigationOptions => ({ +const buildPlatformSpecificNavigationOptions = (screenOptions: PlatformStackNavigationOptions): NavigationOptions => ({ keyboardHandlingEnabled: screenOptions.keyboardHandlingEnabled, - ...withAnimation(screenOptions), + ...withAnimation(screenOptions), ...getCommonNavigationOptions(screenOptions), }); diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/presentation/index.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/presentation/index.ts index 0454b87427f1..0d768f269d58 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/presentation/index.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/presentation/index.ts @@ -1,5 +1,7 @@ const Presentation = { CARD: 'card', + MODAL: 'modal', + TRANSPARENT_MODAL: 'transparentModal', } as const; export default Presentation; diff --git a/src/libs/Navigation/PlatformStackNavigation/types/NavigationOptions.ts b/src/libs/Navigation/PlatformStackNavigation/types/NavigationOptions.ts index eab3bc313b37..b4e1ab3252cf 100644 --- a/src/libs/Navigation/PlatformStackNavigation/types/NavigationOptions.ts +++ b/src/libs/Navigation/PlatformStackNavigation/types/NavigationOptions.ts @@ -1,5 +1,7 @@ import type {NativeStackNavigationOptions} from '@react-navigation/native-stack'; import type {StackNavigationOptions} from '@react-navigation/stack'; +import type Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; +import type Presentation from '@libs/Navigation/PlatformStackNavigation/navigationOptions/presentation'; import type CommonProperties from '@src/types/utils/CommonProperties'; // Navigation properties that are only available in web or native stack navigations. @@ -14,14 +16,14 @@ type GeneralPlatformStackNavigationOptions = { native?: NativeOnlyNavigationOptions; keyboardHandlingEnabled?: boolean; - animation?: 'slide_from_left' | 'slide_from_right' | 'modal' | 'none'; - presentation?: 'card' | 'modal' | 'transparentModal'; + animation?: (typeof Animations)[keyof typeof Animations]; + presentation?: (typeof Presentation)[keyof typeof Presentation]; }; // Combines common and general platform-specific options for PlatformStackNavigation. type PlatformStackNavigationOptions = CommonStackNavigationOptions & GeneralPlatformStackNavigationOptions; -// Used to represent platform-specific navigation options. +// Used to represent navigation options specific to the native implementation/platform (`stack` or `native-stack`). type PlatformSpecificNavigationOptions = StackNavigationOptions | NativeStackNavigationOptions; export type { From 55d1eef8be3db8eace8fd33c4db68d7d4f41dc63 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 11 Nov 2024 17:13:27 +0100 Subject: [PATCH 039/145] fix: fix animation direction and simplify code --- .../Navigators/OnboardingModalNavigator.tsx | 12 ++++++++++-- .../OnboardingModalNavigatorScreenOptions.ts | 17 ----------------- 2 files changed, 10 insertions(+), 19 deletions(-) delete mode 100644 src/libs/Navigation/AppNavigator/OnboardingModalNavigatorScreenOptions.ts diff --git a/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx index dbe7f70e9628..aff8f9744c76 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx @@ -1,3 +1,4 @@ +import {CardStyleInterpolators} from '@react-navigation/stack'; import React, {useCallback} from 'react'; import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; @@ -5,8 +6,8 @@ import FocusTrapForScreens from '@components/FocusTrap/FocusTrapForScreen'; import useKeyboardShortcut from '@hooks/useKeyboardShortcut'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; -import OnboardingModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/OnboardingModalNavigatorScreenOptions'; import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator'; +import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; import type {OnboardingModalNavigatorParamList} from '@libs/Navigation/types'; import OnboardingRefManager from '@libs/OnboardingRefManager'; import OnboardingAccounting from '@pages/OnboardingAccounting'; @@ -17,6 +18,13 @@ import CONST from '@src/CONST'; import SCREENS from '@src/SCREENS'; import Overlay from './Overlay'; +const defaultScreenOptions: PlatformStackNavigationOptions = { + headerShown: false, + web: { + cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, + }, +}; + const Stack = createPlatformStackNavigator(); function OnboardingModalNavigator() { @@ -43,7 +51,7 @@ function OnboardingModalNavigator() { onClick={(e) => e.stopPropagation()} style={styles.OnboardingNavigatorInnerView(onboardingIsMediumOrLargerScreenWidth)} > - + ({ - headerShown: false, - gestureDirection: 'horizontal', - presentation: 'transparentModal', - web: { - cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, - }, -}); - -export default OnboardingModalNavigatorScreenOptions; From 3e02e4d3b6eb36e7046abfe3b7d0e4b531725439 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 11 Nov 2024 17:13:42 +0100 Subject: [PATCH 040/145] fix: use const Presentation values --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 13 +++++++------ .../getModalPresentationStyle/index.android.ts | 6 ------ .../AppNavigator/getModalPresentationStyle/index.ts | 5 ----- .../AppNavigator/useRootNavigatorOptions.ts | 7 ++++--- 4 files changed, 11 insertions(+), 20 deletions(-) delete mode 100644 src/libs/Navigation/AppNavigator/getModalPresentationStyle/index.android.ts delete mode 100644 src/libs/Navigation/AppNavigator/getModalPresentationStyle/index.ts diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 8f71e653aeba..11750b632fe7 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -21,6 +21,7 @@ import KeyboardShortcut from '@libs/KeyboardShortcut'; import Log from '@libs/Log'; import getCurrentUrl from '@libs/Navigation/currentUrl'; import Navigation from '@libs/Navigation/Navigation'; +import Presentation from '@libs/Navigation/PlatformStackNavigation/navigationOptions/presentation'; import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom'; import type {AuthScreensParamList, CentralPaneName, CentralPaneScreensParamList} from '@libs/Navigation/types'; import NetworkConnection from '@libs/NetworkConnection'; @@ -453,7 +454,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie name={SCREENS.ATTACHMENTS} options={{ headerShown: false, - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, }} getComponent={loadReportAttachments} listeners={modalScreenListeners} @@ -462,7 +463,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie name={SCREENS.PROFILE_AVATAR} options={{ headerShown: false, - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, animation: 'none', }} getComponent={loadProfileAvatar} @@ -472,7 +473,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie name={SCREENS.WORKSPACE_AVATAR} options={{ headerShown: false, - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, }} getComponent={loadWorkspaceAvatar} listeners={modalScreenListeners} @@ -481,7 +482,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie name={SCREENS.REPORT_AVATAR} options={{ headerShown: false, - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, }} getComponent={loadReportAvatar} listeners={modalScreenListeners} @@ -546,7 +547,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie name={SCREENS.WORKSPACE_JOIN_USER} options={{ headerShown: false, - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, }} listeners={modalScreenListeners} getComponent={loadWorkspaceJoinUser} @@ -555,7 +556,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie name={SCREENS.TRANSACTION_RECEIPT} options={{ headerShown: false, - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, }} getComponent={loadReceiptView} listeners={modalScreenListeners} diff --git a/src/libs/Navigation/AppNavigator/getModalPresentationStyle/index.android.ts b/src/libs/Navigation/AppNavigator/getModalPresentationStyle/index.android.ts deleted file mode 100644 index ad498a36302e..000000000000 --- a/src/libs/Navigation/AppNavigator/getModalPresentationStyle/index.android.ts +++ /dev/null @@ -1,6 +0,0 @@ -// a temporary workaround for the modals opening below the current screen on Android -function getModalPresentationStyle(): 'modal' { - return 'modal'; -} - -export default getModalPresentationStyle; diff --git a/src/libs/Navigation/AppNavigator/getModalPresentationStyle/index.ts b/src/libs/Navigation/AppNavigator/getModalPresentationStyle/index.ts deleted file mode 100644 index 830bf1e5b857..000000000000 --- a/src/libs/Navigation/AppNavigator/getModalPresentationStyle/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -function getModalPresentationStyle(): 'transparentModal' { - return 'transparentModal'; -} - -export default getModalPresentationStyle; diff --git a/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts b/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts index 5cdb6e5e4e00..de7971213526 100644 --- a/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts +++ b/src/libs/Navigation/AppNavigator/useRootNavigatorOptions.ts @@ -3,6 +3,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; +import Presentation from '@libs/Navigation/PlatformStackNavigation/navigationOptions/presentation'; import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; import variables from '@styles/variables'; import CONFIG from '@src/CONFIG'; @@ -39,7 +40,7 @@ const useRootNavigatorOptions = () => { // We want pop in RHP since there are some flows that would work weird otherwise animationTypeForReplace: 'pop', web: { - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, cardStyle: { ...StyleUtils.getNavigationModalCardStyle(), // This is necessary to cover translated sidebar with overlay. @@ -52,7 +53,7 @@ const useRootNavigatorOptions = () => { }, onboardingModalNavigator: { web: { - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, cardOverlayEnabled: false, cardStyle: { ...StyleUtils.getNavigationModalCardStyle(), @@ -73,7 +74,7 @@ const useRootNavigatorOptions = () => { customAnimationOnGesture: true, }, web: { - presentation: 'transparentModal', + presentation: Presentation.TRANSPARENT_MODAL, cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props}), // We want pop in LHP since there are some flows that would work weird otherwise cardStyle: { From c5004dc283eb678f7f72757bf1e466cd0508733e Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 11 Nov 2024 17:18:47 +0100 Subject: [PATCH 041/145] fix: disallow gesture in onboarding modal --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 11750b632fe7..3e345914e566 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -533,7 +533,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie {isOnboardingCompleted === false && ( { From 997f26e80a295d44428c4243da6006753576a22e Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 12 Nov 2024 16:41:08 +0530 Subject: [PATCH 042/145] fix: Search - Workspace switcher resets to Expensify after manually searching via search input. Signed-off-by: krishna2323 --- src/components/Search/SearchPageHeader.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/Search/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader.tsx index d73937aeadd9..2cca5ac8e4d1 100644 --- a/src/components/Search/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader.tsx @@ -344,6 +344,9 @@ function SearchPageHeader({queryJSON, hash}: SearchPageHeaderProps) { // After https://github.com/Expensify/App/pull/51633 is merged, autocomplete functionality will be included into this component, and `getFindIDFromDisplayValue` can be removed const computeNodeValueFn = SearchQueryUtils.getFindIDFromDisplayValue(cardList, taxRates); const standardizedQuery = SearchQueryUtils.traverseAndUpdatedQuery(inputQueryJSON, computeNodeValueFn); + if (queryJSON.policyID) { + standardizedQuery.policyID = queryJSON.policyID; + } const query = SearchQueryUtils.buildSearchQueryString(standardizedQuery); SearchActions.clearAllFilters(); Navigation.navigate(ROUTES.SEARCH_CENTRAL_PANE.getRoute({query})); From 8e78f3033ed952cfddfe78ae959f3040d131ee65 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Tue, 12 Nov 2024 14:40:51 +0100 Subject: [PATCH 043/145] fix: prevent unnecessary home screen re-mount --- src/components/WorkspaceSwitcherButton.tsx | 10 ++++++++-- .../createCustomBottomTabNavigator/TopBar.tsx | 20 ++++++++++++++++--- src/libs/Navigation/switchPolicyID.ts | 13 +++++++++++- .../SidebarScreen/BaseSidebarScreen.tsx | 19 ++++++++++++++++-- 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/src/components/WorkspaceSwitcherButton.tsx b/src/components/WorkspaceSwitcherButton.tsx index 9ad0ffefafa1..d47f243af736 100644 --- a/src/components/WorkspaceSwitcherButton.tsx +++ b/src/components/WorkspaceSwitcherButton.tsx @@ -18,9 +18,14 @@ type WorkspaceSwitcherButtonOnyxProps = { policy: OnyxEntry; }; -type WorkspaceSwitcherButtonProps = WorkspaceSwitcherButtonOnyxProps; +type WorkspaceSwitcherButtonProps = WorkspaceSwitcherButtonOnyxProps & { + /** + * Callback used to keep track of the workspace switching process in the BaseSidebarScreen. + */ + onSwitchWorkspace?: () => void; +}; -function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) { +function WorkspaceSwitcherButton({policy, onSwitchWorkspace}: WorkspaceSwitcherButtonProps) { const {translate} = useLocalize(); const theme = useTheme(); @@ -48,6 +53,7 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) { accessibilityLabel={translate('common.workspaces')} accessible onPress={() => { + onSwitchWorkspace?.(); pressableRef?.current?.blur(); interceptAnonymousUser(() => { Navigation.navigate(ROUTES.WORKSPACE_SWITCHER); diff --git a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar.tsx b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar.tsx index eba7a7448ad0..01caa79692f1 100644 --- a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar.tsx @@ -17,9 +17,20 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -type TopBarProps = {breadcrumbLabel: string; activeWorkspaceID?: string; shouldDisplaySearch?: boolean; shouldDisplayCancelSearch?: boolean}; +type TopBarProps = { + breadcrumbLabel: string; + activeWorkspaceID?: string; + shouldDisplaySearch?: boolean; + shouldDisplayCancelSearch?: boolean; -function TopBar({breadcrumbLabel, activeWorkspaceID, shouldDisplaySearch = true, shouldDisplayCancelSearch = false}: TopBarProps) { + /** + * Callback used to keep track of the workspace switching process in the BaseSidebarScreen. + * Passed to the WorkspaceSwitcherButton component. + */ + onSwitchWorkspace?: () => void; +}; + +function TopBar({breadcrumbLabel, activeWorkspaceID, shouldDisplaySearch = true, shouldDisplayCancelSearch = false, onSwitchWorkspace}: TopBarProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const policy = usePolicy(activeWorkspaceID); @@ -42,7 +53,10 @@ function TopBar({breadcrumbLabel, activeWorkspaceID, shouldDisplaySearch = true, dataSet={{dragArea: true}} > - + { - if (!!activeWorkspace || activeWorkspaceID === undefined) { + // Whether the active workspace or the "Everything" page is loaded + const isWorkspaceOrEverythingLoaded = !!activeWorkspace || activeWorkspaceID === undefined; + + // If we are currently switching workspaces, we don't want to do anything until the target workspace is loaded + if (isSwitchingWorkspace.current) { + if (isWorkspaceOrEverythingLoaded) { + isSwitchingWorkspace.current = false; + } + return; + } + + // Otherwise, if the workspace is already loaded, we don't need to do anything + if (isWorkspaceOrEverythingLoaded) { return; } + isSwitchingWorkspace.current = true; Navigation.navigateWithSwitchPolicyID({policyID: undefined}); updateLastAccessedWorkspace(undefined); }, [activeWorkspace, activeWorkspaceID]); @@ -61,6 +75,7 @@ function BaseSidebarScreen() { breadcrumbLabel={translate('common.inbox')} activeWorkspaceID={activeWorkspaceID} shouldDisplaySearch={shouldDisplaySearch} + onSwitchWorkspace={() => (isSwitchingWorkspace.current = true)} /> Date: Tue, 12 Nov 2024 15:02:22 +0100 Subject: [PATCH 044/145] fix: remove Podfile change --- ios/Podfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile b/ios/Podfile index 1d0b4dcfd901..4d139711ef01 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -122,4 +122,4 @@ target 'NotificationServiceExtension' do pod 'AppLogs', :path => '../node_modules/react-native-app-logs/AppLogsPod' end -pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.52.0-xcframework.tar.gz' +pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.52.0-xcframework.tar.gz' \ No newline at end of file From a98fcef6b6ea70e401a6f13accccd8f1a47e6b62 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Tue, 12 Nov 2024 15:02:52 +0100 Subject: [PATCH 045/145] fix: remove Podfile.lock change --- ios/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 224f4f3a1637..18d030a38ce9 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -3283,6 +3283,6 @@ SPEC CHECKSUMS: VisionCamera: c6c8aa4b028501fc87644550fbc35a537d4da3fb Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8 -PODFILE CHECKSUM: bf538ad3cea170c0bde913f0530618bf7f098f99 +PODFILE CHECKSUM: 15e2f095b9c80d658459723edf84005a6867debf COCOAPODS: 1.15.2 From 23e995391c19cfddbd185ca48a648f5fadf6179f Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Tue, 12 Nov 2024 15:15:47 +0100 Subject: [PATCH 046/145] remove unused patch --- ....0+006+android-keyboard-adjustResize.patch | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 patches/react-native-screens+3.34.0+006+android-keyboard-adjustResize.patch diff --git a/patches/react-native-screens+3.34.0+006+android-keyboard-adjustResize.patch b/patches/react-native-screens+3.34.0+006+android-keyboard-adjustResize.patch deleted file mode 100644 index f38b3ad17ad0..000000000000 --- a/patches/react-native-screens+3.34.0+006+android-keyboard-adjustResize.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt -index edcfa7d..afa6874 100644 ---- a/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt -+++ b/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt -@@ -17,6 +17,7 @@ import com.facebook.react.bridge.GuardedRunnable - import com.facebook.react.bridge.ReactContext - import com.facebook.react.bridge.UiThreadUtil - import com.swmansion.rnscreens.Screen.WindowTraits -+import kotlin.math.max - - object ScreenWindowTraits { - // Methods concerning statusBar management were taken from `react-native`'s status bar module: -@@ -130,6 +131,7 @@ object ScreenWindowTraits { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - val windowInsets = - defaultInsets.getInsets(WindowInsetsCompat.Type.statusBars()) -+ val imeInsets = defaultInsets.getInsets(WindowInsetsCompat.Type.ime()) - - WindowInsetsCompat - .Builder() -@@ -139,7 +141,7 @@ object ScreenWindowTraits { - windowInsets.left, - 0, - windowInsets.right, -- windowInsets.bottom, -+ max(windowInsets.bottom, imeInsets.bottom), - ), - ).build() - } else { From df33cef7c231fe0b5aa3a3ba2c6e35ec91411220 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Tue, 12 Nov 2024 16:01:42 +0100 Subject: [PATCH 047/145] fix: update Podfile.lock checksum --- ios/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 18d030a38ce9..224f4f3a1637 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -3283,6 +3283,6 @@ SPEC CHECKSUMS: VisionCamera: c6c8aa4b028501fc87644550fbc35a537d4da3fb Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8 -PODFILE CHECKSUM: 15e2f095b9c80d658459723edf84005a6867debf +PODFILE CHECKSUM: bf538ad3cea170c0bde913f0530618bf7f098f99 COCOAPODS: 1.15.2 From 10077168a4ff51dea577302fccbd779c41afb0fc Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Thu, 14 Nov 2024 21:39:57 +0800 Subject: [PATCH 048/145] initial focus only for web and desktop, and don't scroll on initial focus --- .../Search/SearchRouter/SearchRouter.tsx | 16 ++++++++--- .../Search/SearchRouter/SearchRouterList.tsx | 1 + .../SelectionList/BaseSelectionList.tsx | 13 ++++++--- src/components/SelectionList/types.ts | 5 +++- src/hooks/useArrowKeyFocusManager.ts | 27 +++++++++++++------ 5 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 3aeb6a4c76d2..fa253050912a 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -17,6 +17,7 @@ import usePolicy from '@hooks/usePolicy'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; +import getPlatform from '@libs/getPlatform'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import {getAllTaxRates} from '@libs/PolicyUtils'; import type {OptionData} from '@libs/ReportUtils'; @@ -57,6 +58,9 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { const [autocompleteSuggestions, setAutocompleteSuggestions] = useState([]); const [autocompleteSubstitutions, setAutocompleteSubstitutions] = useState({}); + const isWeb = getPlatform() === CONST.PLATFORM.WEB; + const isDesktop = getPlatform() === CONST.PLATFORM.DESKTOP; + const {shouldUseNarrowLayout} = useResponsiveLayout(); const listRef = useRef(null); @@ -327,13 +331,15 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { const setInitialFocus = useCallback(() => { const initialFocusIndex = (sortedRecentSearches?.slice(0, 5).length ?? 0) + (contextualReportData ? 1 : 0); - listRef.current?.setFocusedIndex(initialFocusIndex); - listRef.current?.scrollToIndex(0, false); + listRef.current?.setFocusedIndex(initialFocusIndex, false); }, [sortedRecentSearches, contextualReportData]); useEffect(() => { + if (!isWeb && !isDesktop) { + return; + } setInitialFocus(); - }, [sortedRecentSearches, setInitialFocus]); + }, [sortedRecentSearches, setInitialFocus, isWeb, isDesktop]); const onSearchChange = useCallback( (userQuery: string) => { @@ -350,11 +356,13 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { if (newUserQuery) { listRef.current?.updateAndScrollToFocusedIndex(0); + } else if (!isWeb && !isDesktop) { + listRef.current?.updateAndScrollToFocusedIndex(-1); } else { setInitialFocus(); } }, - [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete, setInitialFocus], + [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete, setInitialFocus, isWeb, isDesktop], ); const onSearchSubmit = useCallback( diff --git a/src/components/Search/SearchRouter/SearchRouterList.tsx b/src/components/Search/SearchRouter/SearchRouterList.tsx index cc854ff926c3..c28128bb2133 100644 --- a/src/components/Search/SearchRouter/SearchRouterList.tsx +++ b/src/components/Search/SearchRouter/SearchRouterList.tsx @@ -273,6 +273,7 @@ function SearchRouterList( sectionTitleStyles={styles.mhn2} shouldSingleExecuteRowSelect onArrowFocus={onArrowFocus} + shouldScrollToFocusedIndexOnFirstRender={false} /> ); } diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 8893360673fd..cb5e8eb4f86c 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -114,6 +114,7 @@ function BaseSelectionList( shouldKeepFocusedItemAtTopOfViewableArea = false, shouldDebounceScrolling = false, shouldPreventActiveCellVirtualization = false, + shouldScrollToFocusedIndexOnFirstRender = true, }: BaseSelectionListProps, ref: ForwardedRef, ) { @@ -316,12 +317,14 @@ function BaseSelectionList( maxIndex: Math.min(flattenedSections.allOptions.length - 1, CONST.MAX_SELECTION_LIST_PAGE_LENGTH * currentPage - 1), disabledIndexes: disabledArrowKeyIndexes, isActive: isFocused, - onFocusedIndexChange: (index: number) => { + onFocusedIndexChange: (index: number, shouldScrollToIndex = true) => { const focusedItem = flattenedSections.allOptions.at(index); if (focusedItem) { onArrowFocus(focusedItem); } - (shouldDebounceScrolling ? debouncedScrollToIndex : scrollToIndex)(index, true); + if (shouldScrollToIndex) { + (shouldDebounceScrolling ? debouncedScrollToIndex : scrollToIndex)(index, true); + } }, isFocused, }); @@ -586,10 +589,12 @@ function BaseSelectionList( if (!isInitialSectionListRender) { return; } - scrollToIndex(focusedIndex, false); + if (shouldScrollToFocusedIndexOnFirstRender) { + scrollToIndex(focusedIndex, false); + } setIsInitialSectionListRender(false); }, - [focusedIndex, isInitialSectionListRender, scrollToIndex, shouldUseDynamicMaxToRenderPerBatch], + [focusedIndex, isInitialSectionListRender, scrollToIndex, shouldUseDynamicMaxToRenderPerBatch, shouldScrollToFocusedIndexOnFirstRender], ); const onSectionListLayout = useCallback( diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 09a1ca1f8b15..7b889228332f 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -612,13 +612,16 @@ type BaseSelectionListProps = Partial & { /** Whether to prevent the active cell from being virtualized and losing focus in browsers */ shouldPreventActiveCellVirtualization?: boolean; + + /** Whether to scroll to the focused index on the first render. */ + shouldScrollToFocusedIndexOnFirstRender?: boolean; } & TRightHandSideComponent; type SelectionListHandle = { scrollAndHighlightItem?: (items: string[], timeout: number) => void; clearInputAfterSelect?: () => void; scrollToIndex: (index: number, animated?: boolean) => void; - setFocusedIndex: (index: number) => void; + setFocusedIndex: (index: number, shouldScrollToIndex?: boolean) => void; updateAndScrollToFocusedIndex: (newFocusedIndex: number) => void; updateExternalTextInputFocus: (isTextInputFocused: boolean) => void; }; diff --git a/src/hooks/useArrowKeyFocusManager.ts b/src/hooks/useArrowKeyFocusManager.ts index 2de6cc251560..5691223c3c7e 100644 --- a/src/hooks/useArrowKeyFocusManager.ts +++ b/src/hooks/useArrowKeyFocusManager.ts @@ -5,7 +5,7 @@ import usePrevious from './usePrevious'; type Config = { maxIndex: number; - onFocusedIndexChange?: (index: number) => void; + onFocusedIndexChange?: (index: number, shouldScrollToIndex?: boolean) => void; initialFocusedIndex?: number; disabledIndexes?: readonly number[]; shouldExcludeTextAreaNodes?: boolean; @@ -17,7 +17,7 @@ type Config = { isFocused?: boolean; }; -type UseArrowKeyFocusManager = [number, (index: number) => void]; +type UseArrowKeyFocusManager = [number, (index: number, shouldScrollToIndex?: boolean) => void]; /** * A hook that makes it easy to use the arrow keys to manage focus of items in a list @@ -51,8 +51,15 @@ export default function useArrowKeyFocusManager({ allowNegativeIndexes = false, isFocused = true, }: Config): UseArrowKeyFocusManager { - const [focusedIndex, setFocusedIndex] = useState(initialFocusedIndex); + const [focusedIndex, setFocusedIndexState] = useState(initialFocusedIndex); + const [shouldScrollToIndex, setShouldScrollToIndex] = useState(true); const prevIsFocusedIndex = usePrevious(focusedIndex); + + const setFocusedIndex = useCallback((index: number, shouldScroll = true) => { + setFocusedIndexState(index); + setShouldScrollToIndex(shouldScroll); + }, []); + const arrowConfig = useMemo( () => ({ excludedNodes: shouldExcludeTextAreaNodes ? ['TEXTAREA'] : [], @@ -73,7 +80,7 @@ export default function useArrowKeyFocusManager({ if (prevIsFocusedIndex === focusedIndex) { return; } - onFocusedIndexChange(focusedIndex); + onFocusedIndexChange(focusedIndex, shouldScrollToIndex); // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps }, [focusedIndex, prevIsFocusedIndex]); @@ -83,7 +90,8 @@ export default function useArrowKeyFocusManager({ } const nextIndex = disableCyclicTraversal ? -1 : maxIndex; - setFocusedIndex((actualIndex) => { + setShouldScrollToIndex(true); + setFocusedIndexState((actualIndex) => { const currentFocusedIndex = actualIndex > 0 ? actualIndex - (itemsPerRow ?? 1) : nextIndex; let newFocusedIndex = currentFocusedIndex; @@ -116,7 +124,8 @@ export default function useArrowKeyFocusManager({ const nextIndex = disableCyclicTraversal ? maxIndex : 0; - setFocusedIndex((actualIndex) => { + setShouldScrollToIndex(true); + setFocusedIndexState((actualIndex) => { let currentFocusedIndex = -1; if (actualIndex === -1) { @@ -161,7 +170,8 @@ export default function useArrowKeyFocusManager({ const nextIndex = disableCyclicTraversal ? -1 : maxIndex; - setFocusedIndex((actualIndex) => { + setShouldScrollToIndex(true); + setFocusedIndexState((actualIndex) => { const currentFocusedIndex = actualIndex > 0 ? actualIndex - 1 : nextIndex; let newFocusedIndex = currentFocusedIndex; @@ -187,7 +197,8 @@ export default function useArrowKeyFocusManager({ const nextIndex = disableCyclicTraversal ? maxIndex : 0; - setFocusedIndex((actualIndex) => { + setShouldScrollToIndex(true); + setFocusedIndexState((actualIndex) => { const currentFocusedIndex = actualIndex < maxIndex ? actualIndex + 1 : nextIndex; let newFocusedIndex = currentFocusedIndex; From f03e1e0bdc778772a4ead8c34b5d79ba5a800259 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Thu, 14 Nov 2024 22:02:27 +0800 Subject: [PATCH 049/145] minor fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index fa253050912a..ae9a1ce135be 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -339,7 +339,9 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { return; } setInitialFocus(); - }, [sortedRecentSearches, setInitialFocus, isWeb, isDesktop]); + // eslint-disable-next-line react-compiler/react-compiler + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [sortedRecentSearches]); const onSearchChange = useCallback( (userQuery: string) => { From dd17a400e01061e45bce7d42df35a530d4bf9ff8 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Thu, 14 Nov 2024 22:08:42 +0800 Subject: [PATCH 050/145] minor fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index ae9a1ce135be..255abbec966d 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -341,7 +341,7 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { setInitialFocus(); // eslint-disable-next-line react-compiler/react-compiler // eslint-disable-next-line react-hooks/exhaustive-deps - }, [sortedRecentSearches]); + }, [sortedRecentSearches, contextualReportData]); const onSearchChange = useCallback( (userQuery: string) => { From fe78ba687b64d9e59c45456106128b41e9e01d93 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Thu, 14 Nov 2024 22:15:03 +0800 Subject: [PATCH 051/145] minor fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 255abbec966d..1c3c47b7cf98 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -335,13 +335,11 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { }, [sortedRecentSearches, contextualReportData]); useEffect(() => { - if (!isWeb && !isDesktop) { + if ((!isWeb && !isDesktop) || textInputValue) { return; } setInitialFocus(); - // eslint-disable-next-line react-compiler/react-compiler - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [sortedRecentSearches, contextualReportData]); + }, [setInitialFocus, textInputValue, isWeb, isDesktop]); const onSearchChange = useCallback( (userQuery: string) => { From fab9a8b52f83242aa34f09c171414806bffad674 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 18 Nov 2024 23:19:08 +0100 Subject: [PATCH 052/145] chore: update pager view patches --- ....5.0.patch => react-native-pager-view+6.5.0+001+initial.patch} | 0 ...-native-pager-view+6.5.0+002+native-stack-recycle-crash.patch} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename patches/{react-native-pager-view+6.5.0.patch => react-native-pager-view+6.5.0+001+initial.patch} (100%) rename patches/{react-native-pager-view+6.4.1+001+native-stack-recycle-crash.patch => react-native-pager-view+6.5.0+002+native-stack-recycle-crash.patch} (100%) diff --git a/patches/react-native-pager-view+6.5.0.patch b/patches/react-native-pager-view+6.5.0+001+initial.patch similarity index 100% rename from patches/react-native-pager-view+6.5.0.patch rename to patches/react-native-pager-view+6.5.0+001+initial.patch diff --git a/patches/react-native-pager-view+6.4.1+001+native-stack-recycle-crash.patch b/patches/react-native-pager-view+6.5.0+002+native-stack-recycle-crash.patch similarity index 100% rename from patches/react-native-pager-view+6.4.1+001+native-stack-recycle-crash.patch rename to patches/react-native-pager-view+6.5.0+002+native-stack-recycle-crash.patch From 1c574ac5316d4a5f9d683da3ec698cdbe27f0326 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Tue, 19 Nov 2024 11:04:24 +0100 Subject: [PATCH 053/145] Revert "Merge branch 'feat/edge-to-edge' into @chrispader/use-platform-stack-navigation-in-app" This reverts commit 78d3bd58299e4c708fd275619bf0753533bfe13e, reversing changes made to df33cef7c231fe0b5aa3a3ba2c6e35ec91411220. --- android/app/src/main/res/values/styles.xml | 2 - ...ontroller+1.14.1+001+disable-android.patch | 62 ++++++++ src/App.tsx | 2 +- .../KeyboardAvoidingView/index.android.tsx | 132 ------------------ src/components/KeyboardAvoidingView/index.tsx | 12 +- src/components/KeyboardProvider/index.tsx | 15 -- 6 files changed, 72 insertions(+), 153 deletions(-) create mode 100644 patches/react-native-keyboard-controller+1.14.1+001+disable-android.patch delete mode 100644 src/components/KeyboardAvoidingView/index.android.tsx delete mode 100644 src/components/KeyboardProvider/index.tsx diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 610524fb130f..75126afbd407 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -7,7 +7,6 @@ diff --git a/patches/react-native-keyboard-controller+1.14.1+001+disable-android.patch b/patches/react-native-keyboard-controller+1.14.1+001+disable-android.patch new file mode 100644 index 000000000000..6bb62155a98c --- /dev/null +++ b/patches/react-native-keyboard-controller+1.14.1+001+disable-android.patch @@ -0,0 +1,62 @@ +diff --git a/node_modules/react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt b/node_modules/react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +index 7ef8b36..f4d44ff 100644 +--- a/node_modules/react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt ++++ b/node_modules/react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +@@ -74,7 +74,7 @@ class EdgeToEdgeReactViewGroup( + } + + override fun onConfigurationChanged(newConfig: Configuration?) { +- this.reApplyWindowInsets() ++ // this.reApplyWindowInsets() + } + // endregion + +@@ -124,12 +124,12 @@ class EdgeToEdgeReactViewGroup( + } + + private fun goToEdgeToEdge(edgeToEdge: Boolean) { +- reactContext.currentActivity?.let { +- WindowCompat.setDecorFitsSystemWindows( +- it.window, +- !edgeToEdge, +- ) +- } ++ // reactContext.currentActivity?.let { ++ // WindowCompat.setDecorFitsSystemWindows( ++ // it.window, ++ // !edgeToEdge, ++ // ) ++ // } + } + + private fun setupKeyboardCallbacks() { +@@ -182,16 +182,16 @@ class EdgeToEdgeReactViewGroup( + // region State managers + private fun enable() { + this.goToEdgeToEdge(true) +- this.setupWindowInsets() ++ // this.setupWindowInsets() + this.setupKeyboardCallbacks() +- modalAttachedWatcher.enable() ++ // modalAttachedWatcher.enable() + } + + private fun disable() { + this.goToEdgeToEdge(false) +- this.setupWindowInsets() ++ // this.setupWindowInsets() + this.removeKeyboardCallbacks() +- modalAttachedWatcher.disable() ++ // modalAttachedWatcher.disable() + } + // endregion + +@@ -219,7 +219,7 @@ class EdgeToEdgeReactViewGroup( + fun forceStatusBarTranslucent(isStatusBarTranslucent: Boolean) { + if (active && this.isStatusBarTranslucent != isStatusBarTranslucent) { + this.isStatusBarTranslucent = isStatusBarTranslucent +- this.reApplyWindowInsets() ++ // this.reApplyWindowInsets() + } + } + // endregion diff --git a/src/App.tsx b/src/App.tsx index 52904e0a06c4..643e2146e501 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,6 +2,7 @@ import {PortalProvider} from '@gorhom/portal'; import React from 'react'; import {LogBox} from 'react-native'; import {GestureHandlerRootView} from 'react-native-gesture-handler'; +import {KeyboardProvider} from 'react-native-keyboard-controller'; import {PickerStateProvider} from 'react-native-picker-select'; import {SafeAreaProvider} from 'react-native-safe-area-context'; import '../wdyr'; @@ -14,7 +15,6 @@ import CustomStatusBarAndBackgroundContextProvider from './components/CustomStat import ErrorBoundary from './components/ErrorBoundary'; import HTMLEngineProvider from './components/HTMLEngineProvider'; import InitialURLContextProvider from './components/InitialURLContextProvider'; -import KeyboardProvider from './components/KeyboardProvider'; import {LocaleContextProvider} from './components/LocaleContextProvider'; import OnyxProvider from './components/OnyxProvider'; import PopoverContextProvider from './components/PopoverProvider'; diff --git a/src/components/KeyboardAvoidingView/index.android.tsx b/src/components/KeyboardAvoidingView/index.android.tsx deleted file mode 100644 index 6330fecba9fe..000000000000 --- a/src/components/KeyboardAvoidingView/index.android.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import React, {forwardRef, useCallback, useMemo, useState} from 'react'; -import type {LayoutRectangle, View, ViewProps} from 'react-native'; -import {useKeyboardContext, useKeyboardHandler} from 'react-native-keyboard-controller'; -import Reanimated, {interpolate, runOnUI, useAnimatedStyle, useDerivedValue, useSharedValue} from 'react-native-reanimated'; -import {useSafeAreaFrame} from 'react-native-safe-area-context'; -import type {KeyboardAvoidingViewProps} from './types'; - -const useKeyboardAnimation = () => { - const {reanimated} = useKeyboardContext(); - - // calculate it only once on mount, to avoid `SharedValue` reads during a render - const [initialHeight] = useState(() => -reanimated.height.value); - const [initialProgress] = useState(() => reanimated.progress.value); - - const heightWhenOpened = useSharedValue(initialHeight); - const height = useSharedValue(initialHeight); - const progress = useSharedValue(initialProgress); - const isClosed = useSharedValue(initialProgress === 0); - - useKeyboardHandler( - { - onStart: (e) => { - 'worklet'; - - progress.value = e.progress; - height.value = e.height; - - if (e.height > 0) { - // eslint-disable-next-line react-compiler/react-compiler - isClosed.value = false; - heightWhenOpened.value = e.height; - } - }, - onEnd: (e) => { - 'worklet'; - - isClosed.value = e.height === 0; - - height.value = e.height; - progress.value = e.progress; - }, - }, - [], - ); - - return {height, progress, heightWhenOpened, isClosed}; -}; - -const defaultLayout: LayoutRectangle = { - x: 0, - y: 0, - width: 0, - height: 0, -}; - -/** - * View that moves out of the way when the keyboard appears by automatically - * adjusting its height, position, or bottom padding. - * - * This `KeyboardAvoidingView` acts as a backward compatible layer for the previous Android behavior (prior to edge-to-edge mode). - * We can use `KeyboardAvoidingView` directly from the `react-native-keyboard-controller` package, but in this case animations are stuttering and it's better to handle as a separate task. - */ -const KeyboardAvoidingView = forwardRef>( - ({behavior, children, contentContainerStyle, enabled = true, keyboardVerticalOffset = 0, style, onLayout: onLayoutProps, ...props}, ref) => { - const initialFrame = useSharedValue(null); - const frame = useDerivedValue(() => initialFrame.value ?? defaultLayout); - - const keyboard = useKeyboardAnimation(); - const {height: screenHeight} = useSafeAreaFrame(); - - const relativeKeyboardHeight = useCallback(() => { - 'worklet'; - - const keyboardY = screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset; - - return Math.max(frame.value.y + frame.value.height - keyboardY, 0); - }, [screenHeight, keyboardVerticalOffset]); - - const onLayoutWorklet = useCallback((layout: LayoutRectangle) => { - 'worklet'; - - if (keyboard.isClosed.value || initialFrame.value === null) { - // eslint-disable-next-line react-compiler/react-compiler - initialFrame.value = layout; - } - }, []); - const onLayout = useCallback>( - (e) => { - runOnUI(onLayoutWorklet)(e.nativeEvent.layout); - onLayoutProps?.(e); - }, - [onLayoutProps], - ); - - const animatedStyle = useAnimatedStyle(() => { - const bottom = interpolate(keyboard.progress.value, [0, 1], [0, relativeKeyboardHeight()]); - const bottomHeight = enabled ? bottom : 0; - - switch (behavior) { - case 'height': - if (!keyboard.isClosed.value) { - return { - height: frame.value.height - bottomHeight, - flex: 0, - }; - } - - return {}; - - case 'padding': - return {paddingBottom: bottomHeight}; - - default: - return {}; - } - }, [behavior, enabled, relativeKeyboardHeight]); - const combinedStyles = useMemo(() => [style, animatedStyle], [style, animatedStyle]); - - return ( - - {children} - - ); - }, -); - -export default KeyboardAvoidingView; diff --git a/src/components/KeyboardAvoidingView/index.tsx b/src/components/KeyboardAvoidingView/index.tsx index 4a24d6cab618..c0882ae1e9cc 100644 --- a/src/components/KeyboardAvoidingView/index.tsx +++ b/src/components/KeyboardAvoidingView/index.tsx @@ -1,10 +1,16 @@ +/* + * The KeyboardAvoidingView is only used on ios + */ import React from 'react'; -import {KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native-keyboard-controller'; +import {View} from 'react-native'; import type {KeyboardAvoidingViewProps} from './types'; function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { - // eslint-disable-next-line react/jsx-props-no-spreading - return ; + const {behavior, contentContainerStyle, enabled, keyboardVerticalOffset, ...rest} = props; + return ( + // eslint-disable-next-line react/jsx-props-no-spreading + + ); } KeyboardAvoidingView.displayName = 'KeyboardAvoidingView'; diff --git a/src/components/KeyboardProvider/index.tsx b/src/components/KeyboardProvider/index.tsx deleted file mode 100644 index bf2b003abea3..000000000000 --- a/src/components/KeyboardProvider/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import type {PropsWithChildren} from 'react'; -import {KeyboardProvider} from 'react-native-keyboard-controller'; - -function KeyboardProviderWrapper({children}: PropsWithChildren>) { - return ( - - {children} - - ); -} - -export default KeyboardProviderWrapper; From f474be7c7009fda63019e60d1a5d2dd98e261d75 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 20 Nov 2024 19:09:36 +0100 Subject: [PATCH 054/145] docs: add JSDoc comments --- src/libs/Navigation/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index eae4388b019e..4d4446d64bf4 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1177,6 +1177,7 @@ type MoneyRequestNavigatorParamList = { /** Link to previous page */ backTo: ExpensifyRoute; + /** Hash that includes info about what is searched for */ searchHash?: number; }; [SCREENS.MONEY_REQUEST.STEP_ATTENDEES]: { @@ -1616,6 +1617,7 @@ type SearchReportParamList = { /** Link to previous page */ backTo: ExpensifyRoute; + /** Hash that includes info about what is searched for */ searchHash?: number; }; }; From a851cd7cb9510e062cb7443aaf68e77ade067d6f Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 20 Nov 2024 19:13:10 +0100 Subject: [PATCH 055/145] fix: migrate RouteProp in CodesStep component --- src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx b/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx index 1e89734fa459..5049bfe3d5ca 100644 --- a/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx +++ b/src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.tsx @@ -1,4 +1,3 @@ -import type {RouteProp} from '@react-navigation/native'; import {useRoute} from '@react-navigation/native'; import React, {useEffect, useMemo, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; @@ -21,6 +20,7 @@ import {READ_COMMANDS} from '@libs/API/types'; import Clipboard from '@libs/Clipboard'; import * as ErrorUtils from '@libs/ErrorUtils'; import localFileDownload from '@libs/localFileDownload'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {BackToParams, SettingsNavigatorParamList} from '@libs/Navigation/types'; import StepWrapper from '@pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper'; import useTwoFactorAuthContext from '@pages/settings/Security/TwoFactorAuth/TwoFactorAuthContext/useTwoFactorAuth'; @@ -50,7 +50,7 @@ function CodesStep({backTo}: CodesStepProps) { const isUserValidated = user?.validated; const contactMethod = account?.primaryLogin ?? ''; - const route = useRoute>(); + const route = useRoute>(); const loginData = useMemo(() => loginList?.[contactMethod], [loginList, contactMethod]); const validateLoginError = ErrorUtils.getEarliestErrorField(loginData, 'validateLogin'); From 64a302d5b23c448b55c9060ec4fd3337d83966ed Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 20 Nov 2024 19:17:24 +0100 Subject: [PATCH 056/145] chore(deps): update `react-native-pager-view` to 6.5.1 --- package-lock.json | 8 ++--- package.json | 2 +- ...6.5.0+002+native-stack-recycle-crash.patch | 29 ------------------- ...native-pager-view+6.5.1+001+initial.patch} | 0 4 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 patches/react-native-pager-view+6.5.0+002+native-stack-recycle-crash.patch rename patches/{react-native-pager-view+6.5.0+001+initial.patch => react-native-pager-view+6.5.1+001+initial.patch} (100%) diff --git a/package-lock.json b/package-lock.json index 351b622e1ce0..3fbd192692d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -96,7 +96,7 @@ "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", "react-native-onyx": "2.0.81", - "react-native-pager-view": "6.5.0", + "react-native-pager-view": "6.5.1", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", "react-native-permissions": "^3.10.0", @@ -35792,9 +35792,9 @@ } }, "node_modules/react-native-pager-view": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/react-native-pager-view/-/react-native-pager-view-6.5.0.tgz", - "integrity": "sha512-Buqc5mjCgIem7aIQU/seMKqhQr98YvBqRNilnoBb8hNGhCaQTE2yvYDwUhOytowyOkjCstLv7Fap2jcLm/k3Bw==", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/react-native-pager-view/-/react-native-pager-view-6.5.1.tgz", + "integrity": "sha512-YdX7bP+rPYvATMU7HzlMq9JaG3ui/+cVRbFZFGW+QshDULANFg9ECR1BA7H7JTIcO/ZgWCwF+1aVmYG5yBA9Og==", "license": "MIT", "peerDependencies": { "react": "*", diff --git a/package.json b/package.json index 5f354550455f..2584c9a668db 100644 --- a/package.json +++ b/package.json @@ -153,7 +153,7 @@ "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", "react-native-onyx": "2.0.81", - "react-native-pager-view": "6.5.0", + "react-native-pager-view": "6.5.1", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", "react-native-permissions": "^3.10.0", diff --git a/patches/react-native-pager-view+6.5.0+002+native-stack-recycle-crash.patch b/patches/react-native-pager-view+6.5.0+002+native-stack-recycle-crash.patch deleted file mode 100644 index da849c43bb32..000000000000 --- a/patches/react-native-pager-view+6.5.0+002+native-stack-recycle-crash.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/node_modules/react-native-pager-view/android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt b/node_modules/react-native-pager-view/android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt -index 0abf668..0bfca0a 100644 ---- a/node_modules/react-native-pager-view/android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt -+++ b/node_modules/react-native-pager-view/android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt -@@ -151,10 +151,20 @@ object PagerViewViewManagerImpl { - - private fun refreshViewChildrenLayout(view: View) { - view.post { -- view.measure( -+ try { -+ view.measure( - View.MeasureSpec.makeMeasureSpec(view.width, View.MeasureSpec.EXACTLY), -- View.MeasureSpec.makeMeasureSpec(view.height, View.MeasureSpec.EXACTLY)) -- view.layout(view.left, view.top, view.right, view.bottom) -+ View.MeasureSpec.makeMeasureSpec(view.height, View.MeasureSpec.EXACTLY) -+ ) -+ view.layout(view.left, view.top, view.right, view.bottom) -+ } catch (e: Exception) { -+ // no-op -+ // fixes a crash: java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true -+ // It looks like we can not force layout on a recycled views. The safer solution would be simply call .requestLayout(), but I believe that -+ // force layouting was added intentionally and fixes some issues, so we simply wrap the operation with try/catch to not crash the app -+ // patch can be removed when https://github.com/callstack/react-native-pager-view/issues/882 or https://github.com/callstack/react-native-pager-view/issues/859 -+ // will be fixed -+ } - } - } - } -\ No newline at end of file diff --git a/patches/react-native-pager-view+6.5.0+001+initial.patch b/patches/react-native-pager-view+6.5.1+001+initial.patch similarity index 100% rename from patches/react-native-pager-view+6.5.0+001+initial.patch rename to patches/react-native-pager-view+6.5.1+001+initial.patch From 863c2f7c2b9517c4ca12bd27ca12883de3a3b005 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 20 Nov 2024 19:58:33 +0100 Subject: [PATCH 057/145] chore: update Podfile.lock --- ios/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9f12be234ac5..01aefab63378 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -3305,6 +3305,6 @@ SPEC CHECKSUMS: VisionCamera: c6c8aa4b028501fc87644550fbc35a537d4da3fb Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8 -PODFILE CHECKSUM: bf538ad3cea170c0bde913f0530618bf7f098f99 +PODFILE CHECKSUM: 15e2f095b9c80d658459723edf84005a6867debf COCOAPODS: 1.15.2 From f05c2b694d424bd0e377e3fc5148151dc31d6cee Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Thu, 21 Nov 2024 01:06:07 +0530 Subject: [PATCH 058/145] keep active workspace selected when searching in search router modal. Signed-off-by: krishna2323 --- src/components/Search/SearchPageHeader.tsx | 4 ++-- src/components/Search/SearchRouter/SearchRouter.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Search/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader.tsx index a3d4a578400b..e43bd410c063 100644 --- a/src/components/Search/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader.tsx @@ -343,10 +343,10 @@ function SearchPageHeader({queryJSON, hash}: SearchPageHeaderProps) { // Todo traverse the tree to update all the display values into id values; this is only temporary until autocomplete code from SearchRouter is implement here // After https://github.com/Expensify/App/pull/51633 is merged, autocomplete functionality will be included into this component, and `getFindIDFromDisplayValue` can be removed const computeNodeValueFn = SearchQueryUtils.getFindIDFromDisplayValue(cardList, taxRates); - const standardizedQuery = SearchQueryUtils.traverseAndUpdatedQuery(inputQueryJSON, computeNodeValueFn); if (queryJSON.policyID) { - standardizedQuery.policyID = queryJSON.policyID; + inputQueryJSON.policyID = queryJSON.policyID; } + const standardizedQuery = SearchQueryUtils.traverseAndUpdatedQuery(inputQueryJSON, computeNodeValueFn); const query = SearchQueryUtils.buildSearchQueryString(standardizedQuery); SearchActions.clearAllFilters(); Navigation.navigate(ROUTES.SEARCH_CENTRAL_PANE.getRoute({query})); diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index b05d34b2351b..7b85e3cecbcc 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -361,7 +361,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps) if (!queryJSON) { return; } - + queryJSON.policyID = activeWorkspaceID; onRouterClose(); const standardizedQuery = SearchQueryUtils.traverseAndUpdatedQuery(queryJSON, SearchQueryUtils.getUpdatedAmountValue); @@ -370,7 +370,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps) setTextInputValue(''); }, - [autocompleteSubstitutions, onRouterClose, setTextInputValue], + [autocompleteSubstitutions, onRouterClose, setTextInputValue, activeWorkspaceID], ); const onAutocompleteSuggestionClick = (autocompleteKey: string, autocompleteID: string) => { From 7f2aba9e9eb11d15017482685726acd5e5a35da8 Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Thu, 21 Nov 2024 09:24:08 +0700 Subject: [PATCH 059/145] add formDataResult to isOnyxLoading to ensure invite message not restored to default when refreshed --- src/pages/workspace/WorkspaceInviteMessagePage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.tsx b/src/pages/workspace/WorkspaceInviteMessagePage.tsx index 4b437e1ffd78..3405cd520c04 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.tsx +++ b/src/pages/workspace/WorkspaceInviteMessagePage.tsx @@ -48,7 +48,7 @@ type WorkspaceInviteMessagePageProps = WithPolicyAndFullscreenLoadingProps & function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}: WorkspaceInviteMessagePageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); - const [formData] = useOnyx(ONYXKEYS.FORMS.WORKSPACE_INVITE_MESSAGE_FORM_DRAFT); + const [formData, formDataResult] = useOnyx(ONYXKEYS.FORMS.WORKSPACE_INVITE_MESSAGE_FORM_DRAFT); const viewportOffsetTop = useViewportOffsetTop(); const [welcomeNote, setWelcomeNote] = useState(); @@ -58,7 +58,7 @@ function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}: const [invitedEmailsToAccountIDsDraft, invitedEmailsToAccountIDsDraftResult] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${route.params.policyID.toString()}`); const [workspaceInviteMessageDraft, workspaceInviteMessageDraftResult] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MESSAGE_DRAFT}${route.params.policyID.toString()}`); const [allPersonalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); - const isOnyxLoading = isLoadingOnyxValue(workspaceInviteMessageDraftResult, invitedEmailsToAccountIDsDraftResult); + const isOnyxLoading = isLoadingOnyxValue(workspaceInviteMessageDraftResult, invitedEmailsToAccountIDsDraftResult, formDataResult); const welcomeNoteSubject = useMemo( () => `# ${currentUserPersonalDetails?.displayName ?? ''} invited you to ${policy?.name ?? 'a workspace'}`, From b86b260df700c618239bd25f58c63e1147cb188a Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Thu, 21 Nov 2024 16:17:05 +0800 Subject: [PATCH 060/145] Render SearchRouterList in SearchRouter component only after fetching all data --- .../Search/SearchRouter/SearchRouter.tsx | 68 +++++++++++-------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 1c3c47b7cf98..3f82a6582085 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -38,6 +38,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type PersonalDetails from '@src/types/onyx/PersonalDetails'; +import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; import {getQueryWithSubstitutions} from './getQueryWithSubstitutions'; import type {SubstitutionMap} from './getQueryWithSubstitutions'; import {getUpdatedSubstitutionsMap} from './getUpdatedSubstitutionsMap'; @@ -53,7 +54,7 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const [betas] = useOnyx(ONYXKEYS.BETAS); - const [recentSearches] = useOnyx(ONYXKEYS.RECENT_SEARCHES); + const [recentSearches, recentSearchesMetadata] = useOnyx(ONYXKEYS.RECENT_SEARCHES); const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false}); const [autocompleteSuggestions, setAutocompleteSuggestions] = useState([]); const [autocompleteSubstitutions, setAutocompleteSubstitutions] = useState({}); @@ -358,8 +359,6 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { listRef.current?.updateAndScrollToFocusedIndex(0); } else if (!isWeb && !isDesktop) { listRef.current?.updateAndScrollToFocusedIndex(-1); - } else { - setInitialFocus(); } }, [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete, setInitialFocus, isWeb, isDesktop], @@ -396,6 +395,10 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { const modalWidth = shouldUseNarrowLayout ? styles.w100 : {width: variables.searchRouterPopoverWidth}; + const isDataLoaded = useMemo(() => { + return (!contextualReportID || contextualReportData !== undefined) && !isLoadingOnyxValue(recentSearchesMetadata) && recentReports.length > 0; + }, [contextualReportID, contextualReportData, recentSearchesMetadata, recentReports]); + return ( onRouterClose()} /> )} - { - onSearchSubmit(textInputValue); - }} - routerListRef={listRef} - shouldShowOfflineMessage - wrapperStyle={[styles.border, styles.alignItemsCenter]} - outerWrapperStyle={[shouldUseNarrowLayout ? styles.mv3 : styles.mv2, shouldUseNarrowLayout ? styles.mh5 : styles.mh2]} - wrapperFocusedStyle={[styles.borderColorFocus]} - isSearchingForReports={isSearchingForReports} - /> - + + {(isDataLoaded || !!textInputValue) && ( + <> + { + onSearchSubmit(textInputValue); + }} + routerListRef={listRef} + shouldShowOfflineMessage + wrapperStyle={[styles.border, styles.alignItemsCenter]} + outerWrapperStyle={[shouldUseNarrowLayout ? styles.mv3 : styles.mv2, shouldUseNarrowLayout ? styles.mh5 : styles.mh2]} + wrapperFocusedStyle={[styles.borderColorFocus]} + isSearchingForReports={isSearchingForReports} + /> + + + )} ); } From 2312a87fd5c9267f2e67ceeb315a6a1ec10c48ca Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Thu, 21 Nov 2024 17:07:46 +0800 Subject: [PATCH 061/145] dont scroll to focused index in initial render search router list --- .../Search/SearchRouter/SearchRouterList.tsx | 18 ++++++++++--- .../SelectionList/BaseSelectionList.tsx | 10 +++---- src/components/SelectionList/types.ts | 4 +-- src/hooks/useArrowKeyFocusManager.ts | 26 ++++++------------- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchRouterList.tsx b/src/components/Search/SearchRouter/SearchRouterList.tsx index c28128bb2133..9b034871ebff 100644 --- a/src/components/Search/SearchRouter/SearchRouterList.tsx +++ b/src/components/Search/SearchRouter/SearchRouterList.tsx @@ -1,4 +1,4 @@ -import React, {forwardRef, useCallback} from 'react'; +import React, {forwardRef, useCallback, useEffect, useState} from 'react'; import type {ForwardedRef} from 'react'; import {useOnyx} from 'react-native-onyx'; import * as Expensicons from '@components/Icon/Expensicons'; @@ -137,6 +137,8 @@ function SearchRouterList( const [cardList = {}] = useOnyx(ONYXKEYS.CARD_LIST); const sections: Array> = []; + const [isInitialRender, setIsInitialRender] = useState(true); + if (textInputValue) { sections.push({ data: [ @@ -258,6 +260,13 @@ function SearchRouterList( [setTextInputValue, textInputValue, onAutocompleteSuggestionClick], ); + useEffect(() => { + if (textInputValue) { + return; + } + setIsInitialRender(true); + }, [textInputValue]); + return ( sections={sections} @@ -267,13 +276,16 @@ function SearchRouterList( sectionListStyle={[shouldUseNarrowLayout ? styles.ph5 : styles.ph2, styles.pb2]} listItemWrapperStyle={[styles.pr3, styles.pl3]} getItemHeight={getItemHeight} - onLayout={setPerformanceTimersEnd} + onLayout={() => { + setPerformanceTimersEnd(); + setIsInitialRender(false); + }} ref={ref} showScrollIndicator={!shouldUseNarrowLayout} sectionTitleStyles={styles.mhn2} shouldSingleExecuteRowSelect onArrowFocus={onArrowFocus} - shouldScrollToFocusedIndexOnFirstRender={false} + shouldScrollToFocusedIndex={!isInitialRender} /> ); } diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index cb5e8eb4f86c..43b60505f1eb 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -114,7 +114,7 @@ function BaseSelectionList( shouldKeepFocusedItemAtTopOfViewableArea = false, shouldDebounceScrolling = false, shouldPreventActiveCellVirtualization = false, - shouldScrollToFocusedIndexOnFirstRender = true, + shouldScrollToFocusedIndex = true, }: BaseSelectionListProps, ref: ForwardedRef, ) { @@ -317,12 +317,12 @@ function BaseSelectionList( maxIndex: Math.min(flattenedSections.allOptions.length - 1, CONST.MAX_SELECTION_LIST_PAGE_LENGTH * currentPage - 1), disabledIndexes: disabledArrowKeyIndexes, isActive: isFocused, - onFocusedIndexChange: (index: number, shouldScrollToIndex = true) => { + onFocusedIndexChange: (index: number) => { const focusedItem = flattenedSections.allOptions.at(index); if (focusedItem) { onArrowFocus(focusedItem); } - if (shouldScrollToIndex) { + if (shouldScrollToFocusedIndex) { (shouldDebounceScrolling ? debouncedScrollToIndex : scrollToIndex)(index, true); } }, @@ -589,12 +589,12 @@ function BaseSelectionList( if (!isInitialSectionListRender) { return; } - if (shouldScrollToFocusedIndexOnFirstRender) { + if (shouldScrollToFocusedIndex) { scrollToIndex(focusedIndex, false); } setIsInitialSectionListRender(false); }, - [focusedIndex, isInitialSectionListRender, scrollToIndex, shouldUseDynamicMaxToRenderPerBatch, shouldScrollToFocusedIndexOnFirstRender], + [focusedIndex, isInitialSectionListRender, scrollToIndex, shouldUseDynamicMaxToRenderPerBatch, shouldScrollToFocusedIndex], ); const onSectionListLayout = useCallback( diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 7b889228332f..680004745440 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -613,8 +613,8 @@ type BaseSelectionListProps = Partial & { /** Whether to prevent the active cell from being virtualized and losing focus in browsers */ shouldPreventActiveCellVirtualization?: boolean; - /** Whether to scroll to the focused index on the first render. */ - shouldScrollToFocusedIndexOnFirstRender?: boolean; + /** Whether to scroll to the focused index */ + shouldScrollToFocusedIndex?: boolean; } & TRightHandSideComponent; type SelectionListHandle = { diff --git a/src/hooks/useArrowKeyFocusManager.ts b/src/hooks/useArrowKeyFocusManager.ts index 5691223c3c7e..40c63c509b30 100644 --- a/src/hooks/useArrowKeyFocusManager.ts +++ b/src/hooks/useArrowKeyFocusManager.ts @@ -5,7 +5,7 @@ import usePrevious from './usePrevious'; type Config = { maxIndex: number; - onFocusedIndexChange?: (index: number, shouldScrollToIndex?: boolean) => void; + onFocusedIndexChange?: (index: number) => void; initialFocusedIndex?: number; disabledIndexes?: readonly number[]; shouldExcludeTextAreaNodes?: boolean; @@ -17,7 +17,7 @@ type Config = { isFocused?: boolean; }; -type UseArrowKeyFocusManager = [number, (index: number, shouldScrollToIndex?: boolean) => void]; +type UseArrowKeyFocusManager = [number, (index: number) => void]; /** * A hook that makes it easy to use the arrow keys to manage focus of items in a list @@ -51,15 +51,9 @@ export default function useArrowKeyFocusManager({ allowNegativeIndexes = false, isFocused = true, }: Config): UseArrowKeyFocusManager { - const [focusedIndex, setFocusedIndexState] = useState(initialFocusedIndex); - const [shouldScrollToIndex, setShouldScrollToIndex] = useState(true); + const [focusedIndex, setFocusedIndex] = useState(initialFocusedIndex); const prevIsFocusedIndex = usePrevious(focusedIndex); - const setFocusedIndex = useCallback((index: number, shouldScroll = true) => { - setFocusedIndexState(index); - setShouldScrollToIndex(shouldScroll); - }, []); - const arrowConfig = useMemo( () => ({ excludedNodes: shouldExcludeTextAreaNodes ? ['TEXTAREA'] : [], @@ -80,7 +74,7 @@ export default function useArrowKeyFocusManager({ if (prevIsFocusedIndex === focusedIndex) { return; } - onFocusedIndexChange(focusedIndex, shouldScrollToIndex); + onFocusedIndexChange(focusedIndex); // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps }, [focusedIndex, prevIsFocusedIndex]); @@ -90,8 +84,7 @@ export default function useArrowKeyFocusManager({ } const nextIndex = disableCyclicTraversal ? -1 : maxIndex; - setShouldScrollToIndex(true); - setFocusedIndexState((actualIndex) => { + setFocusedIndex((actualIndex) => { const currentFocusedIndex = actualIndex > 0 ? actualIndex - (itemsPerRow ?? 1) : nextIndex; let newFocusedIndex = currentFocusedIndex; @@ -124,8 +117,7 @@ export default function useArrowKeyFocusManager({ const nextIndex = disableCyclicTraversal ? maxIndex : 0; - setShouldScrollToIndex(true); - setFocusedIndexState((actualIndex) => { + setFocusedIndex((actualIndex) => { let currentFocusedIndex = -1; if (actualIndex === -1) { @@ -170,8 +162,7 @@ export default function useArrowKeyFocusManager({ const nextIndex = disableCyclicTraversal ? -1 : maxIndex; - setShouldScrollToIndex(true); - setFocusedIndexState((actualIndex) => { + setFocusedIndex((actualIndex) => { const currentFocusedIndex = actualIndex > 0 ? actualIndex - 1 : nextIndex; let newFocusedIndex = currentFocusedIndex; @@ -197,8 +188,7 @@ export default function useArrowKeyFocusManager({ const nextIndex = disableCyclicTraversal ? maxIndex : 0; - setShouldScrollToIndex(true); - setFocusedIndexState((actualIndex) => { + setFocusedIndex((actualIndex) => { const currentFocusedIndex = actualIndex < maxIndex ? actualIndex + 1 : nextIndex; let newFocusedIndex = currentFocusedIndex; From fd76ed70de5e3b70e1207117dd1141b634c5d751 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Thu, 21 Nov 2024 17:11:41 +0800 Subject: [PATCH 062/145] minor fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 2 +- src/components/SelectionList/types.ts | 2 +- src/hooks/useArrowKeyFocusManager.ts | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 3f82a6582085..69bdeca10215 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -332,7 +332,7 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { const setInitialFocus = useCallback(() => { const initialFocusIndex = (sortedRecentSearches?.slice(0, 5).length ?? 0) + (contextualReportData ? 1 : 0); - listRef.current?.setFocusedIndex(initialFocusIndex, false); + listRef.current?.setFocusedIndex(initialFocusIndex); }, [sortedRecentSearches, contextualReportData]); useEffect(() => { diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 680004745440..ac5dab87354c 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -621,7 +621,7 @@ type SelectionListHandle = { scrollAndHighlightItem?: (items: string[], timeout: number) => void; clearInputAfterSelect?: () => void; scrollToIndex: (index: number, animated?: boolean) => void; - setFocusedIndex: (index: number, shouldScrollToIndex?: boolean) => void; + setFocusedIndex: (index: number) => void; updateAndScrollToFocusedIndex: (newFocusedIndex: number) => void; updateExternalTextInputFocus: (isTextInputFocused: boolean) => void; }; diff --git a/src/hooks/useArrowKeyFocusManager.ts b/src/hooks/useArrowKeyFocusManager.ts index 40c63c509b30..2de6cc251560 100644 --- a/src/hooks/useArrowKeyFocusManager.ts +++ b/src/hooks/useArrowKeyFocusManager.ts @@ -53,7 +53,6 @@ export default function useArrowKeyFocusManager({ }: Config): UseArrowKeyFocusManager { const [focusedIndex, setFocusedIndex] = useState(initialFocusedIndex); const prevIsFocusedIndex = usePrevious(focusedIndex); - const arrowConfig = useMemo( () => ({ excludedNodes: shouldExcludeTextAreaNodes ? ['TEXTAREA'] : [], From e502f959ca2bd99df64bf83b6d02f31ce2b26b8d Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Thu, 21 Nov 2024 17:22:56 +0800 Subject: [PATCH 063/145] minor fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 69bdeca10215..e788cc8701b9 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -411,7 +411,7 @@ function SearchRouter({onRouterClose}: SearchRouterProps) { /> )} - {(isDataLoaded || !!textInputValue) && ( + {(isDataLoaded || !!debouncedInputValue) && ( <> Date: Thu, 21 Nov 2024 17:43:30 +0800 Subject: [PATCH 064/145] minor fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 5f5a0bbd2f80..24e499643777 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -368,7 +368,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps) // Store the previous newUserQuery prevUserQueryRef.current = newUserQuery; }, - [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete, setInitialFocus, isWeb, isDesktop], + [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete, isWeb, isDesktop], ); const onSearchSubmit = useCallback( From 6334588b6a3e7f4f3a43bf8c958cb1849db3e734 Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Thu, 21 Nov 2024 15:40:59 +0530 Subject: [PATCH 065/145] Fix rows number on successful import --- src/libs/actions/Policy/PerDiem.ts | 4 ++-- src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Policy/PerDiem.ts b/src/libs/actions/Policy/PerDiem.ts index 183e2919f4f2..7872a487c783 100644 --- a/src/libs/actions/Policy/PerDiem.ts +++ b/src/libs/actions/Policy/PerDiem.ts @@ -155,8 +155,8 @@ function updateImportSpreadsheetData(ratesLength: number) { return onyxData; } -function importPerDiemRates(policyID: string, customUnitID: string, rates: Rate[]) { - const onyxData = updateImportSpreadsheetData(rates.length); +function importPerDiemRates(policyID: string, customUnitID: string, rates: Rate[], rowsLength: number) { + const onyxData = updateImportSpreadsheetData(rowsLength); const parameters = { policyID, diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index 2eedc53a9558..2b127f7d0397 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -117,9 +117,11 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { perDiemAmount?.slice(containsHeader ? 1 : 0), ); + const rowsLength = perDiemDestination.length - (containsHeader ? 1 : 0); + if (perDiemUnits) { setIsImportingPerDiemRates(true); - importPerDiemRates(policyID, perDiemCustomUnit?.customUnitID ?? '', perDiemUnits); + importPerDiemRates(policyID, perDiemCustomUnit?.customUnitID ?? '', perDiemUnits, rowsLength); } }, [validate, spreadsheet?.columns, spreadsheet?.data, containsHeader, policyID, perDiemCustomUnit?.customUnitID]); From e9bea23df90f5487cc6a030aefe09632884cd166 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Fri, 22 Nov 2024 11:50:20 +0800 Subject: [PATCH 066/145] minor fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 24e499643777..8e63a60b25e4 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -62,8 +62,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps) const [autocompleteSuggestions, setAutocompleteSuggestions] = useState([]); const [autocompleteSubstitutions, setAutocompleteSubstitutions] = useState({}); - const isWeb = getPlatform() === CONST.PLATFORM.WEB; - const isDesktop = getPlatform() === CONST.PLATFORM.DESKTOP; + const {isLargeScreenWidth} = useResponsiveLayout(); const {shouldUseNarrowLayout} = useResponsiveLayout(); const listRef = useRef(null); @@ -340,11 +339,11 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps) }, [sortedRecentSearches, contextualReportData]); useEffect(() => { - if ((!isWeb && !isDesktop) || textInputValue) { + if (!isLargeScreenWidth || textInputValue) { return; } setInitialFocus(); - }, [setInitialFocus, textInputValue, isWeb, isDesktop]); + }, [setInitialFocus, textInputValue, isLargeScreenWidth]); const onSearchChange = useCallback( (userQuery: string) => { @@ -361,14 +360,14 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps) if (newUserQuery || !isEmpty(prevUserQueryRef.current)) { listRef.current?.updateAndScrollToFocusedIndex(0); - } else if (!isWeb && !isDesktop) { + } else if (!isLargeScreenWidth) { listRef.current?.updateAndScrollToFocusedIndex(-1); } // Store the previous newUserQuery prevUserQueryRef.current = newUserQuery; }, - [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete, isWeb, isDesktop], + [autocompleteSubstitutions, autocompleteSuggestions, setTextInputValue, updateAutocomplete, isLargeScreenWidth], ); const onSearchSubmit = useCallback( From a9ab8027a6a352ad1cc3391964ef2c753279e580 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Fri, 22 Nov 2024 13:14:27 +0800 Subject: [PATCH 067/145] lint fix --- src/components/Search/SearchRouter/SearchRouter.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 8e63a60b25e4..17924fea898d 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -19,7 +19,6 @@ import usePolicy from '@hooks/usePolicy'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CardUtils from '@libs/CardUtils'; -import getPlatform from '@libs/getPlatform'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import {getAllTaxRates} from '@libs/PolicyUtils'; import type {OptionData} from '@libs/ReportUtils'; From 2281b02abbc2b942c974496776fe98980882bc30 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Sat, 23 Nov 2024 21:42:31 +0100 Subject: [PATCH 068/145] improve comments --- src/libs/Navigation/switchPolicyID.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/Navigation/switchPolicyID.ts b/src/libs/Navigation/switchPolicyID.ts index 3d7592fcf057..9a52f0ac5db7 100644 --- a/src/libs/Navigation/switchPolicyID.ts +++ b/src/libs/Navigation/switchPolicyID.ts @@ -52,7 +52,7 @@ function getActionForBottomTabNavigator(action: StackNavigationAction, state: Na params.policyID = policyID; } - // If there already is a 'Home' route, we want to change the params rather than pushing a new 'Home' route, + // If the last route in the BottomTabNavigator is already a 'Home' route, we want to change the params rather than pushing a new 'Home' route, // so that the screen does not get re-mounted. This would cause an empty screen/white flash when navigating back from the workspace switcher. const homeRoute = bottomTabNavigatorRoute.state.routes.at(-1); if (homeRoute && homeRoute.name === SCREENS.HOME) { @@ -62,7 +62,7 @@ function getActionForBottomTabNavigator(action: StackNavigationAction, state: Na }; } - // If there is no 'Home' route, we want to push a new route. + // If there is no 'Home' route in the BottomTabNavigator or if we are updating a different navigator, we want to push a new route. return { type: CONST.NAVIGATION.ACTION_TYPE.PUSH, payload: { From 821bde5f360cfb41255f5108307532a6f910f30a Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Mon, 25 Nov 2024 12:09:37 +0530 Subject: [PATCH 069/145] Fix function naming --- src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index 2b127f7d0397..80559561d003 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -9,7 +9,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import {closeImportPage} from '@libs/actions/ImportSpreadsheet'; -import {generateCustomUnitID, importPerDiemRates} from '@libs/actions/Policy/PerDiem'; +import * as PerDiem from '@libs/actions/Policy/PerDiem'; import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; @@ -34,7 +34,7 @@ function generatePerDiemUnits(perDiemDestination: string[], perDiemSubRate: stri subRates: [], }; perDiemUnits[perDiemDestination[i]].subRates?.push({ - id: generateCustomUnitID(), + id: PerDiem.generateCustomUnitID(), name: perDiemSubRate.at(i) ?? '', rate: Number(perDiemAmount.at(i)) ?? 0, }); @@ -94,7 +94,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { return errors; }, [requiredColumns, spreadsheet?.columns, translate, columnRoles]); - const importCategories = useCallback(() => { + const importPerDiemRates = useCallback(() => { setIsValidationEnabled(true); const errors = validate(); if (Object.keys(errors).length > 0) { @@ -121,7 +121,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { if (perDiemUnits) { setIsImportingPerDiemRates(true); - importPerDiemRates(policyID, perDiemCustomUnit?.customUnitID ?? '', perDiemUnits, rowsLength); + PerDiem.importPerDiemRates(policyID, perDiemCustomUnit?.customUnitID ?? '', perDiemUnits, rowsLength); } }, [validate, spreadsheet?.columns, spreadsheet?.data, containsHeader, policyID, perDiemCustomUnit?.customUnitID]); @@ -148,7 +148,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { Date: Mon, 25 Nov 2024 12:31:07 +0530 Subject: [PATCH 070/145] Fix crash when using invalid currency code --- src/libs/CurrencyUtils.ts | 5 +++++ src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/CurrencyUtils.ts b/src/libs/CurrencyUtils.ts index f9ac681cb468..4786b6f07eab 100644 --- a/src/libs/CurrencyUtils.ts +++ b/src/libs/CurrencyUtils.ts @@ -197,6 +197,10 @@ function isValidCurrencyCode(currencyCode: string): boolean { return !!currency; } +function sanitizeCurrencyCode(currencyCode: string): string { + return isValidCurrencyCode(currencyCode) ? currencyCode : CONST.CURRENCY.USD; +} + export { getCurrencyDecimals, getCurrencyUnit, @@ -211,4 +215,5 @@ export { convertToDisplayStringWithoutCurrency, isValidCurrencyCode, convertToShortDisplayString, + sanitizeCurrencyCode, }; diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index 80559561d003..9a0759b3608a 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -10,6 +10,7 @@ import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import {closeImportPage} from '@libs/actions/ImportSpreadsheet'; import * as PerDiem from '@libs/actions/Policy/PerDiem'; +import {sanitizeCurrencyCode} from '@libs/CurrencyUtils'; import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; @@ -108,7 +109,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { const perDiemAmountColumn = columns.findIndex((column) => column === CONST.CSV_IMPORT_COLUMNS.AMOUNT); const perDiemDestination = spreadsheet?.data[perDiemDestinationColumn].map((destination) => destination) ?? []; const perDiemSubRate = spreadsheet?.data[perDiemSubRateColumn].map((subRate) => subRate) ?? []; - const perDiemCurrency = spreadsheet?.data[perDiemCurrencyColumn].map((currency) => currency) ?? []; + const perDiemCurrency = spreadsheet?.data[perDiemCurrencyColumn].map((currency) => sanitizeCurrencyCode(currency)) ?? []; const perDiemAmount = spreadsheet?.data[perDiemAmountColumn].map((amount) => amount) ?? []; const perDiemUnits = generatePerDiemUnits( perDiemDestination?.slice(containsHeader ? 1 : 0), From a9691ba0f66055d8f526cbeab1162866354cd39b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 25 Nov 2024 10:55:56 +0100 Subject: [PATCH 071/145] remove all filterOptions usages --- .../Search/SearchFiltersChatsSelector.tsx | 2 +- .../Search/SearchRouter/SearchRouter.tsx | 2 +- src/libs/OptionsListUtils.ts | 137 +++--------------- src/pages/InviteReportParticipantsPage.tsx | 2 +- src/pages/NewChatPage.tsx | 20 ++- src/pages/RoomInvitePage.tsx | 2 +- .../MoneyRequestParticipantsSelector.tsx | 42 +++--- .../Security/AddDelegate/AddDelegatePage.tsx | 20 +-- src/pages/tasks/TaskAssigneeSelectorModal.tsx | 19 ++- .../TaskShareDestinationSelectorModal.tsx | 2 +- src/pages/workspace/WorkspaceInvitePage.tsx | 2 +- 11 files changed, 86 insertions(+), 164 deletions(-) diff --git a/src/components/Search/SearchFiltersChatsSelector.tsx b/src/components/Search/SearchFiltersChatsSelector.tsx index 11f53a12b211..1cdbbc341c29 100644 --- a/src/components/Search/SearchFiltersChatsSelector.tsx +++ b/src/components/Search/SearchFiltersChatsSelector.tsx @@ -62,7 +62,7 @@ function SearchFiltersChatsSelector({initialReportIDs, onFiltersUpdate, isScreen if (!areOptionsInitialized || !isScreenTransitionEnd) { return defaultListOptions; } - return OptionsListUtils.getSearchOptions(options, '', undefined, false); + return OptionsListUtils.getSearchOptions(options, undefined, false); }, [areOptionsInitialized, isScreenTransitionEnd, options]); const chatOptions = useMemo(() => { diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx index 87cb065d5c88..3ee0874ff4fe 100644 --- a/src/components/Search/SearchRouter/SearchRouter.tsx +++ b/src/components/Search/SearchRouter/SearchRouter.tsx @@ -77,7 +77,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps) if (!areOptionsInitialized) { return {recentReports: [], personalDetails: [], userToInvite: null, currentUserOption: null}; } - return OptionsListUtils.getSearchOptions(options, '', betas ?? []); + return OptionsListUtils.getSearchOptions(options, betas ?? []); }, [areOptionsInitialized, betas, options]); const filteredOptions = useMemo(() => { diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index e8bbe392e9aa..32a5e1c423ce 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -99,7 +99,6 @@ type GetOptionsConfig = { includeRecentReports?: boolean; includeSelfDM?: boolean; sortByReportTypeInSearch?: boolean; - searchInputValue?: string; showChatPreviewLine?: boolean; sortPersonalDetailsByAlphaAsc?: boolean; forcePolicyNamePreview?: boolean; @@ -973,23 +972,16 @@ function orderOptions( } function canCreateOptimisticPersonalDetailOption({ - searchValue, recentReportOptions, personalDetailsOptions, currentUserOption, }: { - searchValue: string; recentReportOptions: ReportUtils.OptionData[]; personalDetailsOptions: ReportUtils.OptionData[]; currentUserOption?: ReportUtils.OptionData | null; excludeUnknownUsers: boolean; }) { - const noOptions = recentReportOptions.length + personalDetailsOptions.length === 0 && !currentUserOption; - const noOptionsMatchExactly = !personalDetailsOptions - .concat(recentReportOptions) - .find((option) => option.login === PhoneNumber.addSMSDomainIfPhoneNumber(searchValue ?? '').toLowerCase() || option.login === searchValue?.toLowerCase()); - - return noOptions || noOptionsMatchExactly; + return recentReportOptions.length + personalDetailsOptions.length === 0 && !currentUserOption; } /** @@ -1067,7 +1059,6 @@ function getOptions( includeRecentReports = false, // When sortByReportTypeInSearch flag is true, recentReports will include the personalDetails options as well. sortByReportTypeInSearch = false, - searchInputValue = '', showChatPreviewLine = false, sortPersonalDetailsByAlphaAsc = true, forcePolicyNamePreview = false, @@ -1088,8 +1079,6 @@ function getOptions( shouldBoldTitleByDefault = true, }: GetOptionsConfig, ): Options { - const parsedPhoneNumber = PhoneNumber.parsePhoneNumber(LoginUtils.appendCountryCode(Str.removeSMSDomain(searchInputValue))); - const searchValue = parsedPhoneNumber.possible ? parsedPhoneNumber.number?.e164 ?? '' : searchInputValue.toLowerCase(); const topmostReportId = Navigation.getTopmostReportId() ?? '-1'; // Filter out all the reports that shouldn't be displayed @@ -1121,10 +1110,6 @@ function getOptions( return CONST.DATE.UNIX_EPOCH; } - if (searchValue) { - return [option.isSelfDM, report?.lastVisibleActionCreated]; - } - return report?.lastVisibleActionCreated; }); orderedReportOptions.reverse(); @@ -1196,7 +1181,7 @@ function getOptions( // If we're including selected options from the search results, we only want to exclude them if the search input is empty // This is because on certain pages, we show the selected options at the top when the search input is empty // This prevents the issue of seeing the selected option twice if you have them as a recent chat and select them - if (!includeSelectedOptions || searchInputValue === '') { + if (!includeSelectedOptions) { optionsToExclude.push(...selectedOptions); } @@ -1205,7 +1190,7 @@ function getOptions( }); let recentReportOptions: ReportUtils.OptionData[] = []; - let personalDetailsOptions: ReportUtils.OptionData[] = []; + const personalDetailsOptions: ReportUtils.OptionData[] = []; const preferRecentExpenseReports = action === CONST.IOU.ACTION.CREATE; @@ -1306,7 +1291,6 @@ function getOptions( let userToInvite: ReportUtils.OptionData | null = null; if ( canCreateOptimisticPersonalDetailOption({ - searchValue, recentReportOptions, personalDetailsOptions, currentUserOption, @@ -1314,7 +1298,7 @@ function getOptions( }) ) { userToInvite = getUserToInviteOption({ - searchValue, + searchValue: '', excludeUnknownUsers, optionsToExclude, selectedOptions, @@ -1323,20 +1307,23 @@ function getOptions( }); } + // I would remove this because it is only executed in the MoneyRequestFlow i believe because its the only place where we + // pass an action. Instead we should call order on our own in the moneyRequestAttendeeSelector + // If we are prioritizing 1:1 chats in search, do it only once we started searching - if (sortByReportTypeInSearch && (searchValue !== '' || !!action)) { - // When sortByReportTypeInSearch is true, recentReports will be returned with all the reports including personalDetailsOptions in the correct Order. - // If we're in money request flow, we only order the recent report option. - if (!action) { - recentReportOptions.push(...personalDetailsOptions); - personalDetailsOptions = []; - } - recentReportOptions = orderOptions(recentReportOptions, searchValue, { - preferChatroomsOverThreads: true, - preferPolicyExpenseChat: !!action, - preferRecentExpenseReports, - }); - } + // if (sortByReportTypeInSearch && (searchValue !== '' || !!action)) { + // // When sortByReportTypeInSearch is true, recentReports will be returned with all the reports including personalDetailsOptions in the correct Order. + // // If we're in money request flow, we only order the recent report option. + // if (!action) { + // recentReportOptions.push(...personalDetailsOptions); + // personalDetailsOptions = []; + // } + // recentReportOptions = orderOptions(recentReportOptions, searchValue, { + // preferChatroomsOverThreads: true, + // preferPolicyExpenseChat: !!action, + // preferRecentExpenseReports, + // }); + // } return { personalDetails: personalDetailsOptions, @@ -1349,12 +1336,11 @@ function getOptions( /** * Build the options for the Search view */ -function getSearchOptions(options: OptionList, searchValue = '', betas: Beta[] = [], isUsedInChatFinder = true): Options { +function getSearchOptions(options: OptionList, betas: Beta[] = [], isUsedInChatFinder = true): Options { Timing.start(CONST.TIMING.LOAD_SEARCH_OPTIONS); Performance.markStart(CONST.TIMING.LOAD_SEARCH_OPTIONS); const optionList = getOptions(options, { betas, - searchInputValue: searchValue.trim(), includeRecentReports: true, includeMultipleParticipantReports: true, maxRecentReportsToShow: 0, // Unlimited @@ -1375,10 +1361,9 @@ function getSearchOptions(options: OptionList, searchValue = '', betas: Beta[] = return optionList; } -function getShareLogOptions(options: OptionList, searchValue = '', betas: Beta[] = []): Options { +function getShareLogOptions(options: OptionList, betas: Beta[] = []): Options { return getOptions(options, { betas, - searchInputValue: searchValue.trim(), includeRecentReports: true, includeMultipleParticipantReports: true, sortByReportTypeInSearch: true, @@ -1413,77 +1398,6 @@ function getIOUConfirmationOptionsFromPayeePersonalDetail(personalDetail: OnyxEn }; } -/** - * Build the options for the New Group view - */ -type FilteredOptionsParams = { - reports?: Array>; - personalDetails?: Array>; - betas?: OnyxEntry; - searchValue?: string; - selectedOptions?: Array>; - excludeLogins?: string[]; - includeOwnedWorkspaceChats?: boolean; - includeP2P?: boolean; - canInviteUser?: boolean; - includeSelectedOptions?: boolean; - maxRecentReportsToShow?: number; - includeSelfDM?: boolean; - includeInvoiceRooms?: boolean; - action?: IOUAction; - sortByReportTypeInSearch?: boolean; -}; - -// It is not recommended to pass a search value to getFilteredOptions when passing reports and personalDetails. -// If a search value is passed, the search value should be passed to filterOptions. -// When it is necessary to pass a search value when passing reports and personalDetails, follow these steps: -// 1. Use getFilteredOptions with reports and personalDetails only, without the search value. -// 2. Pass the returned options from getFilteredOptions to filterOptions along with the search value. -// The above constraints are enforced with TypeScript. - -type FilteredOptionsParamsWithDefaultSearchValue = Omit & {searchValue?: ''}; - -type FilteredOptionsParamsWithoutOptions = Omit & {reports?: []; personalDetails?: []}; - -function getFilteredOptions(params: FilteredOptionsParamsWithDefaultSearchValue | FilteredOptionsParamsWithoutOptions) { - const { - reports = [], - personalDetails = [], - betas = [], - searchValue = '', - selectedOptions = [], - excludeLogins = [], - includeOwnedWorkspaceChats = false, - includeP2P = true, - canInviteUser = true, - includeSelectedOptions = false, - maxRecentReportsToShow = CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW, - includeSelfDM = false, - includeInvoiceRooms = false, - action, - sortByReportTypeInSearch = false, - } = params; - return getOptions( - {reports, personalDetails}, - { - betas, - searchInputValue: searchValue.trim(), - selectedOptions, - includeRecentReports: true, - maxRecentReportsToShow, - excludeLogins, - includeOwnedWorkspaceChats, - includeP2P, - canInviteUser, - includeSelectedOptions, - includeSelfDM, - includeInvoiceRooms, - action, - sortByReportTypeInSearch, - }, - ); -} - function getAttendeeOptions( reports: Array>, personalDetails: Array>, @@ -1501,7 +1415,6 @@ function getAttendeeOptions( {reports, personalDetails}, { betas, - searchInputValue: '', selectedOptions: attendees, excludeLogins: CONST.EXPENSIFY_EMAILS, includeOwnedWorkspaceChats, @@ -1527,7 +1440,6 @@ function getShareDestinationOptions( reports: Array> = [], personalDetails: Array> = [], betas: OnyxEntry = [], - searchValue = '', selectedOptions: Array> = [], excludeLogins: string[] = [], includeOwnedWorkspaceChats = true, @@ -1537,7 +1449,6 @@ function getShareDestinationOptions( {reports, personalDetails}, { betas, - searchInputValue: searchValue.trim(), selectedOptions, maxRecentReportsToShow: 0, // Unlimited includeRecentReports: true, @@ -1587,7 +1498,6 @@ function formatMemberForList(member: ReportUtils.OptionData): MemberForList { function getMemberInviteOptions( personalDetails: Array>, betas: Beta[] = [], - searchValue = '', excludeLogins: string[] = [], includeSelectedOptions = false, reports: Array> = [], @@ -1597,7 +1507,6 @@ function getMemberInviteOptions( {reports, personalDetails}, { betas, - searchInputValue: searchValue.trim(), includeP2P: true, excludeLogins, sortPersonalDetailsByAlphaAsc: true, @@ -1864,8 +1773,8 @@ export { getAvatarsForAccountIDs, isCurrentUser, isPersonalDetailsReady, + getOptions, getSearchOptions, - getFilteredOptions, getShareDestinationOptions, getMemberInviteOptions, getHeaderMessage, diff --git a/src/pages/InviteReportParticipantsPage.tsx b/src/pages/InviteReportParticipantsPage.tsx index c15afc552810..2b2f7bbe25b8 100644 --- a/src/pages/InviteReportParticipantsPage.tsx +++ b/src/pages/InviteReportParticipantsPage.tsx @@ -66,7 +66,7 @@ function InviteReportParticipantsPage({betas, report, didScreenTransitionEnd}: I return OptionsListUtils.getEmptyOptions(); } - return OptionsListUtils.getMemberInviteOptions(options.personalDetails, betas ?? [], '', excludedUsers, false, options.reports, true); + return OptionsListUtils.getMemberInviteOptions(options.personalDetails, betas ?? [], excludedUsers, false, options.reports, true); }, [areOptionsInitialized, betas, excludedUsers, options.personalDetails, options.reports]); const inviteOptions = useMemo( diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 8ab5e209a904..286dc75cb4f3 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -48,14 +48,18 @@ function useOptions() { }); const defaultOptions = useMemo(() => { - const filteredOptions = OptionsListUtils.getFilteredOptions({ - reports: listOptions.reports ?? [], - personalDetails: listOptions.personalDetails ?? [], - betas: betas ?? [], - selectedOptions, - maxRecentReportsToShow: 0, - includeSelfDM: true, - }); + const filteredOptions = OptionsListUtils.getOptions( + { + reports: listOptions.reports ?? [], + personalDetails: listOptions.personalDetails ?? [], + }, + { + betas: betas ?? [], + selectedOptions, + maxRecentReportsToShow: 0, + includeSelfDM: true, + }, + ); return filteredOptions; }, [betas, listOptions.personalDetails, listOptions.reports, selectedOptions]); diff --git a/src/pages/RoomInvitePage.tsx b/src/pages/RoomInvitePage.tsx index 5294ba3b566d..88e84809224a 100644 --- a/src/pages/RoomInvitePage.tsx +++ b/src/pages/RoomInvitePage.tsx @@ -75,7 +75,7 @@ function RoomInvitePage({ return {recentReports: [], personalDetails: [], userToInvite: null, currentUserOption: null}; } - const inviteOptions = OptionsListUtils.getMemberInviteOptions(options.personalDetails, betas ?? [], '', excludedUsers); + const inviteOptions = OptionsListUtils.getMemberInviteOptions(options.personalDetails, betas ?? [], excludedUsers); // Update selectedOptions with the latest personalDetails information const detailsMap: Record = {}; inviteOptions.personalDetails.forEach((detail) => { diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index 638c58708971..585fc0dc5fe9 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -105,25 +105,29 @@ function MoneyRequestParticipantsSelector({ }; } - const optionList = OptionsListUtils.getFilteredOptions({ - reports: options.reports, - personalDetails: options.personalDetails, - betas, - selectedOptions: participants as Participant[], - excludeLogins: CONST.EXPENSIFY_EMAILS, - - // If we are using this component in the "Submit expense" or the combined submit/track flow then we pass the includeOwnedWorkspaceChats argument so that the current user - // sees the option to submit an expense from their admin on their own Workspace Chat. - includeOwnedWorkspaceChats: (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.CREATE || iouType === CONST.IOU.TYPE.SPLIT) && action !== CONST.IOU.ACTION.SUBMIT, - - includeP2P: !isCategorizeOrShareAction, - canInviteUser: !isCategorizeOrShareAction, - includeInvoiceRooms: iouType === CONST.IOU.TYPE.INVOICE, - action, - sortByReportTypeInSearch: isPaidGroupPolicy, - searchValue: '', - maxRecentReportsToShow: 0, - }); + const optionList = OptionsListUtils.getOptions( + { + reports: options.reports, + personalDetails: options.personalDetails, + }, + { + betas, + selectedOptions: participants as Participant[], + excludeLogins: CONST.EXPENSIFY_EMAILS, + + // If we are using this component in the "Submit expense" or the combined submit/track flow then we pass the includeOwnedWorkspaceChats argument so that the current user + // sees the option to submit an expense from their admin on their own Workspace Chat. + includeOwnedWorkspaceChats: + (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.CREATE || iouType === CONST.IOU.TYPE.SPLIT) && action !== CONST.IOU.ACTION.SUBMIT, + + includeP2P: !isCategorizeOrShareAction, + canInviteUser: !isCategorizeOrShareAction, + includeInvoiceRooms: iouType === CONST.IOU.TYPE.INVOICE, + action, + sortByReportTypeInSearch: isPaidGroupPolicy, + maxRecentReportsToShow: 0, + }, + ); return optionList; }, [action, areOptionsInitialized, betas, didScreenTransitionEnd, iouType, isCategorizeOrShareAction, options.personalDetails, options.reports, participants, isPaidGroupPolicy]); diff --git a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx index 1b5fc3ce246c..efaf6d5e8480 100644 --- a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx @@ -27,15 +27,17 @@ function useOptions() { const existingDelegates = useMemo(() => account?.delegatedAccess?.delegates?.map((delegate) => delegate.email) ?? [], [account?.delegatedAccess?.delegates]); const defaultOptions = useMemo(() => { - const {recentReports, personalDetails, userToInvite, currentUserOption} = OptionsListUtils.getFilteredOptions({ - reports: optionsList.reports, - personalDetails: optionsList.personalDetails, - betas, - - excludeLogins: [...CONST.EXPENSIFY_EMAILS, ...existingDelegates], - - maxRecentReportsToShow: 0, - }); + const {recentReports, personalDetails, userToInvite, currentUserOption} = OptionsListUtils.getOptions( + { + reports: optionsList.reports, + personalDetails: optionsList.personalDetails, + }, + { + betas, + excludeLogins: [...CONST.EXPENSIFY_EMAILS, ...existingDelegates], + maxRecentReportsToShow: 0, + }, + ); const headerMessage = OptionsListUtils.getHeaderMessage((recentReports?.length || 0) + (personalDetails?.length || 0) !== 0, !!userToInvite, ''); diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.tsx b/src/pages/tasks/TaskAssigneeSelectorModal.tsx index 27da040fa654..a13475c3f15d 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.tsx +++ b/src/pages/tasks/TaskAssigneeSelectorModal.tsx @@ -40,14 +40,17 @@ function useOptions() { const {options: optionsList, areOptionsInitialized} = useOptionsList(); const defaultOptions = useMemo(() => { - const {recentReports, personalDetails, userToInvite, currentUserOption} = OptionsListUtils.getFilteredOptions({ - reports: optionsList.reports, - personalDetails: optionsList.personalDetails, - betas, - excludeLogins: CONST.EXPENSIFY_EMAILS, - - maxRecentReportsToShow: 0, - }); + const {recentReports, personalDetails, userToInvite, currentUserOption} = OptionsListUtils.getOptions( + { + reports: optionsList.reports, + personalDetails: optionsList.personalDetails, + }, + { + betas, + excludeLogins: CONST.EXPENSIFY_EMAILS, + maxRecentReportsToShow: 0, + }, + ); const headerMessage = OptionsListUtils.getHeaderMessage((recentReports?.length || 0) + (personalDetails?.length || 0) !== 0 || !!currentUserOption, !!userToInvite, ''); diff --git a/src/pages/tasks/TaskShareDestinationSelectorModal.tsx b/src/pages/tasks/TaskShareDestinationSelectorModal.tsx index 7ce89e666300..9b85337aedcd 100644 --- a/src/pages/tasks/TaskShareDestinationSelectorModal.tsx +++ b/src/pages/tasks/TaskShareDestinationSelectorModal.tsx @@ -67,7 +67,7 @@ function TaskShareDestinationSelectorModal() { }; } const filteredReports = reportFilter(optionList.reports); - const {recentReports} = OptionsListUtils.getShareDestinationOptions(filteredReports, optionList.personalDetails, [], '', [], [], true); + const {recentReports} = OptionsListUtils.getShareDestinationOptions(filteredReports, optionList.personalDetails, [], [], [], true); const header = OptionsListUtils.getHeaderMessage(recentReports && recentReports.length !== 0, false, ''); return { recentReports, diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index 64f60f42bbed..d2ab6199cb90 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -80,7 +80,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { return {recentReports: [], personalDetails: [], userToInvite: null, currentUserOption: null}; } - const inviteOptions = OptionsListUtils.getMemberInviteOptions(options.personalDetails, betas ?? [], '', excludedUsers, true); + const inviteOptions = OptionsListUtils.getMemberInviteOptions(options.personalDetails, betas ?? [], excludedUsers, true); return {...inviteOptions, recentReports: [], currentUserOption: null}; }, [areOptionsInitialized, betas, excludedUsers, options.personalDetails]); From 49c83bef6b46a4667d87a14130db2f19f377902c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 25 Nov 2024 11:58:58 +0100 Subject: [PATCH 072/145] fix tests --- src/libs/OptionsListUtils.ts | 21 +- .../request/MoneyRequestAttendeeSelector.tsx | 2 - .../MoneyRequestParticipantsSelector.tsx | 3 +- tests/unit/OptionsListUtilsTest.ts | 223 +++++++++--------- 4 files changed, 119 insertions(+), 130 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 32a5e1c423ce..b61be0dca283 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -98,7 +98,6 @@ type GetOptionsConfig = { includeMultipleParticipantReports?: boolean; includeRecentReports?: boolean; includeSelfDM?: boolean; - sortByReportTypeInSearch?: boolean; showChatPreviewLine?: boolean; sortPersonalDetailsByAlphaAsc?: boolean; forcePolicyNamePreview?: boolean; @@ -154,13 +153,12 @@ type Options = { type PreviewConfig = {showChatPreviewLine?: boolean; forcePolicyNamePreview?: boolean; showPersonalDetails?: boolean}; -type FilterOptionsConfig = Pick< - GetOptionsConfig, - 'sortByReportTypeInSearch' | 'canInviteUser' | 'selectedOptions' | 'excludeUnknownUsers' | 'excludeLogins' | 'maxRecentReportsToShow' | 'shouldAcceptName' -> & { +type FilterOptionsConfig = Pick & { preferChatroomsOverThreads?: boolean; preferPolicyExpenseChat?: boolean; preferRecentExpenseReports?: boolean; + /* When sortByReportTypeInSearch flag is true, recentReports will include the personalDetails options as well. */ + sortByReportTypeInSearch?: boolean; }; /** @@ -1056,9 +1054,7 @@ function getOptions( maxRecentReportsToShow = 0, excludeLogins = [], includeMultipleParticipantReports = false, - includeRecentReports = false, - // When sortByReportTypeInSearch flag is true, recentReports will include the personalDetails options as well. - sortByReportTypeInSearch = false, + includeRecentReports = true, showChatPreviewLine = false, sortPersonalDetailsByAlphaAsc = true, forcePolicyNamePreview = false, @@ -1077,7 +1073,7 @@ function getOptions( action, recentAttendees, shouldBoldTitleByDefault = true, - }: GetOptionsConfig, + }: GetOptionsConfig = {}, ): Options { const topmostReportId = Navigation.getTopmostReportId() ?? '-1'; @@ -1341,10 +1337,8 @@ function getSearchOptions(options: OptionList, betas: Beta[] = [], isUsedInChatF Performance.markStart(CONST.TIMING.LOAD_SEARCH_OPTIONS); const optionList = getOptions(options, { betas, - includeRecentReports: true, includeMultipleParticipantReports: true, maxRecentReportsToShow: 0, // Unlimited - sortByReportTypeInSearch: true, showChatPreviewLine: isUsedInChatFinder, includeP2P: true, forcePolicyNamePreview: true, @@ -1364,9 +1358,7 @@ function getSearchOptions(options: OptionList, betas: Beta[] = [], isUsedInChatF function getShareLogOptions(options: OptionList, betas: Beta[] = []): Options { return getOptions(options, { betas, - includeRecentReports: true, includeMultipleParticipantReports: true, - sortByReportTypeInSearch: true, includeP2P: true, forcePolicyNamePreview: true, includeOwnedWorkspaceChats: true, @@ -1409,7 +1401,6 @@ function getAttendeeOptions( canInviteUser = true, includeInvoiceRooms = false, action: IOUAction | undefined = undefined, - sortByReportTypeInSearch = false, ) { return getOptions( {reports, personalDetails}, @@ -1426,7 +1417,6 @@ function getAttendeeOptions( includeSelfDM: false, includeInvoiceRooms, action, - sortByReportTypeInSearch, recentAttendees, }, ); @@ -1451,7 +1441,6 @@ function getShareDestinationOptions( betas, selectedOptions, maxRecentReportsToShow: 0, // Unlimited - includeRecentReports: true, includeMultipleParticipantReports: true, showChatPreviewLine: true, forcePolicyNamePreview: true, diff --git a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx index 9d5253385604..832c3ec78ac0 100644 --- a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx +++ b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx @@ -84,7 +84,6 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde !isCategorizeOrShareAction, iouType === CONST.IOU.TYPE.INVOICE, action, - isPaidGroupPolicy, ); if (optionList.currentUserOption && !isCurrentUserAttendee) { optionList.recentReports = [optionList.currentUserOption, ...optionList.personalDetails]; @@ -101,7 +100,6 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde iouType, action, isCategorizeOrShareAction, - isPaidGroupPolicy, isCurrentUserAttendee, ]); diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index 585fc0dc5fe9..26b8e3373767 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -124,13 +124,12 @@ function MoneyRequestParticipantsSelector({ canInviteUser: !isCategorizeOrShareAction, includeInvoiceRooms: iouType === CONST.IOU.TYPE.INVOICE, action, - sortByReportTypeInSearch: isPaidGroupPolicy, maxRecentReportsToShow: 0, }, ); return optionList; - }, [action, areOptionsInitialized, betas, didScreenTransitionEnd, iouType, isCategorizeOrShareAction, options.personalDetails, options.reports, participants, isPaidGroupPolicy]); + }, [action, areOptionsInitialized, betas, didScreenTransitionEnd, iouType, isCategorizeOrShareAction, options.personalDetails, options.reports, participants]); const chatOptions = useMemo(() => { if (!areOptionsInitialized) { diff --git a/tests/unit/OptionsListUtilsTest.ts b/tests/unit/OptionsListUtilsTest.ts index 0e66993bc2cf..cad6c010bb67 100644 --- a/tests/unit/OptionsListUtilsTest.ts +++ b/tests/unit/OptionsListUtilsTest.ts @@ -402,7 +402,7 @@ describe('OptionsListUtils', () => { it('getSearchOptions()', () => { // When we filter in the Search view without providing a searchValue - const results = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]); + const results = OptionsListUtils.getSearchOptions(OPTIONS, [CONST.BETAS.ALL]); // All 2 personalDetails (including those that have reports) should be returned // Filtering of personalDetails that have reports is done in filterOptions @@ -412,14 +412,13 @@ describe('OptionsListUtils', () => { expect(results.recentReports.length).toBe(Object.values(OPTIONS.reports).length); }); - it('getFilteredOptions()', () => { - // maxRecentReportsToShow in src/libs/OptionsListUtils.js + it('getOptions()', () => { const MAX_RECENT_REPORTS = 5; - // When we call getFilteredOptions() with no search value - let results = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + // When we call getOptions() with no search value + let results = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}, {maxRecentReportsToShow: MAX_RECENT_REPORTS}); - // We should expect maximimum of 5 recent reports to be returned + // We should expect maximum of 5 recent reports to be returned expect(results.recentReports.length).toBe(MAX_RECENT_REPORTS); // We should expect all personalDetails except the currently logged in user to be returned @@ -443,7 +442,7 @@ describe('OptionsListUtils', () => { expect(personalDetailWithExistingReport?.reportID).toBe('2'); // When we only pass personal details - results = OptionsListUtils.getFilteredOptions({personalDetails: OPTIONS.personalDetails}); + results = OptionsListUtils.getOptions({personalDetails: OPTIONS.personalDetails, reports: []}); // We should expect personal details sorted alphabetically expect(results.personalDetails.at(0)?.text).toBe('Black Panther'); @@ -452,16 +451,22 @@ describe('OptionsListUtils', () => { expect(results.personalDetails.at(3)?.text).toBe('Invisible Woman'); // When we don't include personal detail to the result - results = OptionsListUtils.getFilteredOptions({ - maxRecentReportsToShow: 0, - }); + results = OptionsListUtils.getOptions( + { + personalDetails: [], + reports: [], + }, + { + maxRecentReportsToShow: 0, + }, + ); // Then no personal detail options will be returned expect(results.personalDetails.length).toBe(0); // Test for Concierge's existence in chat options - results = OptionsListUtils.getFilteredOptions({reports: OPTIONS_WITH_CONCIERGE.reports, personalDetails: OPTIONS_WITH_CONCIERGE.personalDetails}); + results = OptionsListUtils.getOptions({reports: OPTIONS_WITH_CONCIERGE.reports, personalDetails: OPTIONS_WITH_CONCIERGE.personalDetails}); // Concierge is included in the results by default. We should expect all the personalDetails to show // (minus the currently logged in user) @@ -470,11 +475,15 @@ describe('OptionsListUtils', () => { expect(results.recentReports).toEqual(expect.arrayContaining([expect.objectContaining({login: 'concierge@expensify.com'})])); // Test by excluding Concierge from the results - results = OptionsListUtils.getFilteredOptions({ - reports: OPTIONS_WITH_CONCIERGE.reports, - personalDetails: OPTIONS_WITH_CONCIERGE.personalDetails, - excludeLogins: [CONST.EMAIL.CONCIERGE], - }); + results = OptionsListUtils.getOptions( + { + reports: OPTIONS_WITH_CONCIERGE.reports, + personalDetails: OPTIONS_WITH_CONCIERGE.personalDetails, + }, + { + excludeLogins: [CONST.EMAIL.CONCIERGE], + }, + ); // All the personalDetails should be returned minus the currently logged in user and Concierge // Filtering of personalDetails that have reports is done in filterOptions @@ -482,7 +491,7 @@ describe('OptionsListUtils', () => { expect(results.personalDetails).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'concierge@expensify.com'})])); // Test by excluding Chronos from the results - results = OptionsListUtils.getFilteredOptions({reports: OPTIONS_WITH_CHRONOS.reports, personalDetails: OPTIONS_WITH_CHRONOS.personalDetails, excludeLogins: [CONST.EMAIL.CHRONOS]}); + results = OptionsListUtils.getOptions({reports: OPTIONS_WITH_CHRONOS.reports, personalDetails: OPTIONS_WITH_CHRONOS.personalDetails}, {excludeLogins: [CONST.EMAIL.CHRONOS]}); // All the personalDetails should be returned minus the currently logged in user and Concierge // Filtering of personalDetails that have reports is done in filterOptions @@ -490,11 +499,15 @@ describe('OptionsListUtils', () => { expect(results.personalDetails).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'chronos@expensify.com'})])); // Test by excluding Receipts from the results - results = OptionsListUtils.getFilteredOptions({ - reports: OPTIONS_WITH_RECEIPTS.reports, - personalDetails: OPTIONS_WITH_RECEIPTS.personalDetails, - excludeLogins: [CONST.EMAIL.RECEIPTS], - }); + results = OptionsListUtils.getOptions( + { + reports: OPTIONS_WITH_RECEIPTS.reports, + personalDetails: OPTIONS_WITH_RECEIPTS.personalDetails, + }, + { + excludeLogins: [CONST.EMAIL.RECEIPTS], + }, + ); // All the personalDetails should be returned minus the currently logged in user and Concierge // Filtering of personalDetails that have reports is done in filterOptions @@ -502,14 +515,11 @@ describe('OptionsListUtils', () => { expect(results.personalDetails).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'receipts@expensify.com'})])); }); - it('getFilteredOptions() for group Chat', () => { - // When we call getFilteredOptions() with no search value - let results = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); - - // Then we should expect only a maxmimum of 5 recent reports to be returned - expect(results.recentReports.length).toBe(5); + it('getOptions() for group Chat', () => { + // When we call getOptions() with no search value + let results = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); - // And we should expect all the personalDetails to show except the currently logged in user + // We should expect all the personalDetails to show except the currently logged in user // Filtering of personalDetails that have reports is done in filterOptions expect(results.personalDetails.length).toBe(Object.values(OPTIONS.personalDetails).length - 1); @@ -530,23 +540,23 @@ describe('OptionsListUtils', () => { const personalDetailsOverlapWithReports = results.personalDetails.every((personalDetailOption) => reportLogins.includes(personalDetailOption.login)); expect(personalDetailsOverlapWithReports).toBe(false); - // When we provide no selected options to getFilteredOptions() - results = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + // When we provide no selected options to getOptions() + results = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}, {maxRecentReportsToShow: 5}); // Then one of our older report options (not in our five most recent) should appear in the personalDetails // but not in recentReports expect(results.recentReports.every((option) => option.login !== 'peterparker@expensify.com')).toBe(true); expect(results.personalDetails.every((option) => option.login !== 'peterparker@expensify.com')).toBe(false); - // When we provide a "selected" option to getFilteredOptions() - results = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails, excludeLogins: ['peterparker@expensify.com']}); + // When we provide a "selected" option to getOptions() + results = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}, {excludeLogins: ['peterparker@expensify.com']}); // Then the option should not appear anywhere in either list expect(results.recentReports.every((option) => option.login !== 'peterparker@expensify.com')).toBe(true); expect(results.personalDetails.every((option) => option.login !== 'peterparker@expensify.com')).toBe(true); // Test Concierge's existence in new group options - results = OptionsListUtils.getFilteredOptions({reports: OPTIONS_WITH_CONCIERGE.reports, personalDetails: OPTIONS_WITH_CONCIERGE.personalDetails}); + results = OptionsListUtils.getOptions({reports: OPTIONS_WITH_CONCIERGE.reports, personalDetails: OPTIONS_WITH_CONCIERGE.personalDetails}); // Concierge is included in the results by default. We should expect all the personalDetails to show // (minus the currently logged in user) @@ -555,11 +565,15 @@ describe('OptionsListUtils', () => { expect(results.recentReports).toEqual(expect.arrayContaining([expect.objectContaining({login: 'concierge@expensify.com'})])); // Test by excluding Concierge from the results - results = OptionsListUtils.getFilteredOptions({ - reports: OPTIONS_WITH_CONCIERGE.reports, - personalDetails: OPTIONS_WITH_CONCIERGE.personalDetails, - excludeLogins: [CONST.EMAIL.CONCIERGE], - }); + results = OptionsListUtils.getOptions( + { + reports: OPTIONS_WITH_CONCIERGE.reports, + personalDetails: OPTIONS_WITH_CONCIERGE.personalDetails, + }, + { + excludeLogins: [CONST.EMAIL.CONCIERGE], + }, + ); // We should expect all the personalDetails to show (minus // the currently logged in user and Concierge) @@ -569,7 +583,7 @@ describe('OptionsListUtils', () => { expect(results.recentReports).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'concierge@expensify.com'})])); // Test by excluding Chronos from the results - results = OptionsListUtils.getFilteredOptions({reports: OPTIONS_WITH_CHRONOS.reports, personalDetails: OPTIONS_WITH_CHRONOS.personalDetails, excludeLogins: [CONST.EMAIL.CHRONOS]}); + results = OptionsListUtils.getOptions({reports: OPTIONS_WITH_CHRONOS.reports, personalDetails: OPTIONS_WITH_CHRONOS.personalDetails}, {excludeLogins: [CONST.EMAIL.CHRONOS]}); // We should expect all the personalDetails to show (minus // the currently logged in user and Concierge) @@ -579,11 +593,15 @@ describe('OptionsListUtils', () => { expect(results.recentReports).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'chronos@expensify.com'})])); // Test by excluding Receipts from the results - results = OptionsListUtils.getFilteredOptions({ - reports: OPTIONS_WITH_RECEIPTS.reports, - personalDetails: OPTIONS_WITH_RECEIPTS.personalDetails, - excludeLogins: [CONST.EMAIL.RECEIPTS], - }); + results = OptionsListUtils.getOptions( + { + reports: OPTIONS_WITH_RECEIPTS.reports, + personalDetails: OPTIONS_WITH_RECEIPTS.personalDetails, + }, + { + excludeLogins: [CONST.EMAIL.RECEIPTS], + }, + ); // We should expect all the personalDetails to show (minus // the currently logged in user and Concierge) @@ -604,7 +622,7 @@ describe('OptionsListUtils', () => { }, []); // When we pass an empty search value - let results = OptionsListUtils.getShareDestinationOptions(filteredReports, OPTIONS.personalDetails, [], ''); + let results = OptionsListUtils.getShareDestinationOptions(filteredReports, OPTIONS.personalDetails, []); // Then we should expect all the recent reports to show but exclude the archived rooms expect(results.recentReports.length).toBe(Object.values(OPTIONS.reports).length - 1); @@ -620,7 +638,7 @@ describe('OptionsListUtils', () => { }, []); // When we also have a policy to return rooms in the results - results = OptionsListUtils.getShareDestinationOptions(filteredReportsWithWorkspaceRooms, OPTIONS.personalDetails, [], ''); + results = OptionsListUtils.getShareDestinationOptions(filteredReportsWithWorkspaceRooms, OPTIONS.personalDetails, []); // Then we should expect the DMS, the group chats and the workspace room to show // We should expect all the recent reports to show, excluding the archived rooms expect(results.recentReports.length).toBe(Object.values(OPTIONS_WITH_WORKSPACE_ROOM.reports).length - 1); @@ -628,7 +646,7 @@ describe('OptionsListUtils', () => { it('getMemberInviteOptions()', () => { // When we only pass personal details - const results = OptionsListUtils.getMemberInviteOptions(OPTIONS.personalDetails, [], ''); + const results = OptionsListUtils.getMemberInviteOptions(OPTIONS.personalDetails, []); // We should expect personal details to be sorted alphabetically expect(results.personalDetails.at(0)?.text).toBe('Black Panther'); @@ -657,7 +675,7 @@ describe('OptionsListUtils', () => { describe('filterOptions', () => { it('should return all options when search is empty', () => { - const options = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS, [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, ''); expect(filteredOptions.recentReports.length + filteredOptions.personalDetails.length).toBe(12); @@ -665,7 +683,7 @@ describe('OptionsListUtils', () => { it('should return filtered options in correct order', () => { const searchText = 'man'; - const options = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS, [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, searchText, {sortByReportTypeInSearch: true}); expect(filteredOptions.recentReports.length).toBe(4); @@ -677,7 +695,7 @@ describe('OptionsListUtils', () => { it('should filter users by email', () => { const searchText = 'mistersinister@marauders.com'; - const options = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS, [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, searchText); @@ -687,7 +705,7 @@ describe('OptionsListUtils', () => { it('should find archived chats', () => { const searchText = 'Archived'; - const options = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS, [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, searchText); expect(filteredOptions.recentReports.length).toBe(1); @@ -697,7 +715,7 @@ describe('OptionsListUtils', () => { it('should filter options by email if dot is skipped in the email', () => { const searchText = 'barryallen'; const OPTIONS_WITH_PERIODS = OptionsListUtils.createOptionList(PERSONAL_DETAILS_WITH_PERIODS, REPORTS); - const options = OptionsListUtils.getSearchOptions(OPTIONS_WITH_PERIODS, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS_WITH_PERIODS, [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, searchText, {sortByReportTypeInSearch: true}); @@ -707,7 +725,7 @@ describe('OptionsListUtils', () => { it('should include workspace rooms in the search results', () => { const searchText = 'avengers'; - const options = OptionsListUtils.getSearchOptions(OPTIONS_WITH_WORKSPACE_ROOM, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS_WITH_WORKSPACE_ROOM, [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, searchText); @@ -717,7 +735,7 @@ describe('OptionsListUtils', () => { it('should put exact match by login on the top of the list', () => { const searchText = 'reedrichards@expensify.com'; - const options = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS, [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, searchText); @@ -728,7 +746,7 @@ describe('OptionsListUtils', () => { it('should prioritize options with matching display name over chatrooms', () => { const searchText = 'spider'; const OPTIONS_WITH_CHATROOMS = OptionsListUtils.createOptionList(PERSONAL_DETAILS, REPORTS_WITH_CHAT_ROOM); - const options = OptionsListUtils.getSearchOptions(OPTIONS_WITH_CHATROOMS, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS_WITH_CHATROOMS, [CONST.BETAS.ALL]); const filterOptions = OptionsListUtils.filterOptions(options, searchText); @@ -739,7 +757,7 @@ describe('OptionsListUtils', () => { it('should put the item with latest lastVisibleActionCreated on top when search value match multiple items', () => { const searchText = 'fantastic'; - const options = OptionsListUtils.getSearchOptions(OPTIONS, ''); + const options = OptionsListUtils.getSearchOptions(OPTIONS); const filteredOptions = OptionsListUtils.filterOptions(options, searchText); expect(filteredOptions.recentReports.length).toBe(2); @@ -750,7 +768,7 @@ describe('OptionsListUtils', () => { it('should return the user to invite when the search value is a valid, non-existent email', () => { const searchText = 'test@email.com'; - const options = OptionsListUtils.getSearchOptions(OPTIONS, ''); + const options = OptionsListUtils.getSearchOptions(OPTIONS); const filteredOptions = OptionsListUtils.filterOptions(options, searchText); expect(filteredOptions.userToInvite?.login).toBe(searchText); @@ -759,7 +777,7 @@ describe('OptionsListUtils', () => { it('should not return any results if the search value is on an exluded logins list', () => { const searchText = 'admin@expensify.com'; - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails, excludeLogins: CONST.EXPENSIFY_EMAILS}); + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}, {excludeLogins: CONST.EXPENSIFY_EMAILS}); const filterOptions = OptionsListUtils.filterOptions(options, searchText, {excludeLogins: CONST.EXPENSIFY_EMAILS}); expect(filterOptions.recentReports.length).toBe(0); }); @@ -767,7 +785,7 @@ describe('OptionsListUtils', () => { it('should return the user to invite when the search value is a valid, non-existent email and the user is not excluded', () => { const searchText = 'test@email.com'; - const options = OptionsListUtils.getSearchOptions(OPTIONS, ''); + const options = OptionsListUtils.getSearchOptions(OPTIONS); const filteredOptions = OptionsListUtils.filterOptions(options, searchText, {excludeLogins: CONST.EXPENSIFY_EMAILS}); expect(filteredOptions.userToInvite?.login).toBe(searchText); @@ -776,7 +794,7 @@ describe('OptionsListUtils', () => { it('should return limited amount of recent reports if the limit is set', () => { const searchText = ''; - const options = OptionsListUtils.getSearchOptions(OPTIONS, ''); + const options = OptionsListUtils.getSearchOptions(OPTIONS); const filteredOptions = OptionsListUtils.filterOptions(options, searchText, {maxRecentReportsToShow: 2}); expect(filteredOptions.recentReports.length).toBe(2); @@ -784,7 +802,7 @@ describe('OptionsListUtils', () => { it('should not return any user to invite if email exists on the personal details list', () => { const searchText = 'natasharomanoff@expensify.com'; - const options = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]); + const options = OptionsListUtils.getSearchOptions(OPTIONS, [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, searchText); expect(filteredOptions.personalDetails.length).toBe(1); @@ -792,13 +810,13 @@ describe('OptionsListUtils', () => { }); it('should not return any options if search value does not match any personal details (getMemberInviteOptions)', () => { - const options = OptionsListUtils.getMemberInviteOptions(OPTIONS.personalDetails, [], ''); + const options = OptionsListUtils.getMemberInviteOptions(OPTIONS.personalDetails, []); const filteredOptions = OptionsListUtils.filterOptions(options, 'magneto'); expect(filteredOptions.personalDetails.length).toBe(0); }); it('should return one personal detail if search value matches an email (getMemberInviteOptions)', () => { - const options = OptionsListUtils.getMemberInviteOptions(OPTIONS.personalDetails, [], ''); + const options = OptionsListUtils.getMemberInviteOptions(OPTIONS.personalDetails, []); const filteredOptions = OptionsListUtils.filterOptions(options, 'peterparker@expensify.com'); expect(filteredOptions.personalDetails.length).toBe(1); @@ -814,7 +832,7 @@ describe('OptionsListUtils', () => { } return filtered; }, []); - const options = OptionsListUtils.getShareDestinationOptions(filteredReports, OPTIONS.personalDetails, [], ''); + const options = OptionsListUtils.getShareDestinationOptions(filteredReports, OPTIONS.personalDetails, []); const filteredOptions = OptionsListUtils.filterOptions(options, 'mutants'); expect(filteredOptions.recentReports.length).toBe(0); @@ -830,7 +848,7 @@ describe('OptionsListUtils', () => { return filtered; }, []); - const options = OptionsListUtils.getShareDestinationOptions(filteredReportsWithWorkspaceRooms, OPTIONS.personalDetails, [], ''); + const options = OptionsListUtils.getShareDestinationOptions(filteredReportsWithWorkspaceRooms, OPTIONS.personalDetails, []); const filteredOptions = OptionsListUtils.filterOptions(options, 'Avengers Room'); expect(filteredOptions.recentReports.length).toBe(1); @@ -846,14 +864,14 @@ describe('OptionsListUtils', () => { return filtered; }, []); - const options = OptionsListUtils.getShareDestinationOptions(filteredReportsWithWorkspaceRooms, OPTIONS.personalDetails, [], ''); + const options = OptionsListUtils.getShareDestinationOptions(filteredReportsWithWorkspaceRooms, OPTIONS.personalDetails, []); const filteredOptions = OptionsListUtils.filterOptions(options, 'Mutants Lair'); expect(filteredOptions.recentReports.length).toBe(0); }); - it('should show the option from personal details when searching for personal detail with no existing report (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should show the option from personal details when searching for personal detail with no existing report (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, 'hulk'); expect(filteredOptions.recentReports.length).toBe(0); @@ -862,19 +880,19 @@ describe('OptionsListUtils', () => { expect(filteredOptions.personalDetails.at(0)?.login).toBe('brucebanner@expensify.com'); }); - it('should return all matching reports and personal details (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should return all matching reports and personal details (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}, {maxRecentReportsToShow: 5}); const filteredOptions = OptionsListUtils.filterOptions(options, '.com'); - expect(filteredOptions.recentReports.length).toBe(5); expect(filteredOptions.recentReports.at(0)?.text).toBe('Captain America'); + // We expect that only personal details that are not in the reports are included here expect(filteredOptions.personalDetails.length).toBe(4); expect(filteredOptions.personalDetails.at(0)?.login).toBe('natasharomanoff@expensify.com'); }); - it('should not return any options or user to invite if there are no search results and the string does not match a potential email or phone (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should not return any options or user to invite if there are no search results and the string does not match a potential email or phone (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, 'marc@expensify'); expect(filteredOptions.recentReports.length).toBe(0); @@ -882,8 +900,8 @@ describe('OptionsListUtils', () => { expect(filteredOptions.userToInvite).toBe(null); }); - it('should not return any options but should return an user to invite if no matching options exist and the search value is a potential email (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should not return any options but should return an user to invite if no matching options exist and the search value is a potential email (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, 'marc@expensify.com'); expect(filteredOptions.recentReports.length).toBe(0); @@ -891,16 +909,16 @@ describe('OptionsListUtils', () => { expect(filteredOptions.userToInvite).not.toBe(null); }); - it('should return user to invite when search term has a period with options for it that do not contain the period (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should return user to invite when search term has a period with options for it that do not contain the period (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, 'peter.parker@expensify.com'); expect(filteredOptions.recentReports.length).toBe(0); expect(filteredOptions.userToInvite).not.toBe(null); }); - it('should not return options but should return an user to invite if no matching options exist and the search value is a potential phone number (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should not return options but should return an user to invite if no matching options exist and the search value is a potential phone number (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, '5005550006'); expect(filteredOptions.recentReports.length).toBe(0); @@ -909,8 +927,8 @@ describe('OptionsListUtils', () => { expect(filteredOptions.userToInvite?.login).toBe('+15005550006'); }); - it('should not return options but should return an user to invite if no matching options exist and the search value is a potential phone number with country code added (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should not return options but should return an user to invite if no matching options exist and the search value is a potential phone number with country code added (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, '+15005550006'); expect(filteredOptions.recentReports.length).toBe(0); @@ -919,8 +937,8 @@ describe('OptionsListUtils', () => { expect(filteredOptions.userToInvite?.login).toBe('+15005550006'); }); - it('should not return options but should return an user to invite if no matching options exist and the search value is a potential phone number with special characters added (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should not return options but should return an user to invite if no matching options exist and the search value is a potential phone number with special characters added (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, '+1 (800)324-3233'); expect(filteredOptions.recentReports.length).toBe(0); @@ -929,8 +947,8 @@ describe('OptionsListUtils', () => { expect(filteredOptions.userToInvite?.login).toBe('+18003243233'); }); - it('should not return any options or user to invite if contact number contains alphabet characters (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should not return any options or user to invite if contact number contains alphabet characters (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, '998243aaaa'); expect(filteredOptions.recentReports.length).toBe(0); @@ -938,23 +956,23 @@ describe('OptionsListUtils', () => { expect(filteredOptions.userToInvite).toBe(null); }); - it('should not return any options if search value does not match any personal details (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should not return any options if search value does not match any personal details (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, 'magneto'); expect(filteredOptions.personalDetails.length).toBe(0); }); - it('should return one recent report and no personal details if a search value provides an email (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should return one recent report and no personal details if a search value provides an email (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); const filteredOptions = OptionsListUtils.filterOptions(options, 'peterparker@expensify.com', {sortByReportTypeInSearch: true}); expect(filteredOptions.recentReports.length).toBe(1); expect(filteredOptions.recentReports.at(0)?.text).toBe('Spider-Man'); expect(filteredOptions.personalDetails.length).toBe(0); }); - it('should return all matching reports and personal details (getFilteredOptions)', () => { - const options = OptionsListUtils.getFilteredOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}); + it('should return all matching reports and personal details (getOptions)', () => { + const options = OptionsListUtils.getOptions({reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails}, {maxRecentReportsToShow: 5}); const filteredOptions = OptionsListUtils.filterOptions(options, '.com'); expect(filteredOptions.personalDetails.length).toBe(4); @@ -966,7 +984,7 @@ describe('OptionsListUtils', () => { }); it('should return matching option when searching (getSearchOptions)', () => { - const options = OptionsListUtils.getSearchOptions(OPTIONS, ''); + const options = OptionsListUtils.getSearchOptions(OPTIONS); const filteredOptions = OptionsListUtils.filterOptions(options, 'spider'); expect(filteredOptions.recentReports.length).toBe(1); @@ -974,7 +992,7 @@ describe('OptionsListUtils', () => { }); it('should return latest lastVisibleActionCreated item on top when search value matches multiple items (getSearchOptions)', () => { - const options = OptionsListUtils.getSearchOptions(OPTIONS, ''); + const options = OptionsListUtils.getSearchOptions(OPTIONS); const filteredOptions = OptionsListUtils.filterOptions(options, 'fantastic'); expect(filteredOptions.recentReports.length).toBe(2); @@ -985,7 +1003,7 @@ describe('OptionsListUtils', () => { .then(() => Onyx.set(ONYXKEYS.PERSONAL_DETAILS_LIST, PERSONAL_DETAILS_WITH_PERIODS)) .then(() => { const OPTIONS_WITH_PERIODS = OptionsListUtils.createOptionList(PERSONAL_DETAILS_WITH_PERIODS, REPORTS); - const results = OptionsListUtils.getSearchOptions(OPTIONS_WITH_PERIODS, ''); + const results = OptionsListUtils.getSearchOptions(OPTIONS_WITH_PERIODS); const filteredResults = OptionsListUtils.filterOptions(results, 'barry.allen@expensify.com', {sortByReportTypeInSearch: true}); expect(filteredResults.recentReports.length).toBe(1); @@ -995,23 +1013,8 @@ describe('OptionsListUtils', () => { }); describe('canCreateOptimisticPersonalDetailOption', () => { - const VALID_EMAIL = 'valid@email.com'; - it('should allow to create optimistic personal detail option if email is valid', () => { - const canCreate = OptionsListUtils.canCreateOptimisticPersonalDetailOption({ - searchValue: VALID_EMAIL, - recentReportOptions: OPTIONS.reports, - personalDetailsOptions: OPTIONS.personalDetails, - currentUserOption: null, - excludeUnknownUsers: false, - }); - - expect(canCreate).toBe(true); - }); - it('should not allow to create option if email is an email of current user', () => { - const currentUserEmail = 'tonystark@expensify.com'; const canCreate = OptionsListUtils.canCreateOptimisticPersonalDetailOption({ - searchValue: currentUserEmail, recentReportOptions: OPTIONS.reports, personalDetailsOptions: OPTIONS.personalDetails, currentUserOption: null, From b619020fa86584dd65d4bf6610ec8007029030b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 25 Nov 2024 12:10:31 +0100 Subject: [PATCH 073/145] fix perf tests --- .../SearchFiltersParticipantsSelector.tsx | 18 ++++++++------ .../ShareLogList/BaseShareLogList.tsx | 2 +- tests/perf-test/OptionsListUtils.perf-test.ts | 24 +++++++++---------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/components/Search/SearchFiltersParticipantsSelector.tsx b/src/components/Search/SearchFiltersParticipantsSelector.tsx index bb45e30cc5ad..fc692c01f824 100644 --- a/src/components/Search/SearchFiltersParticipantsSelector.tsx +++ b/src/components/Search/SearchFiltersParticipantsSelector.tsx @@ -54,13 +54,17 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate}: return defaultListOptions; } - return OptionsListUtils.getFilteredOptions({ - reports: options.reports, - personalDetails: options.personalDetails, - selectedOptions, - excludeLogins: CONST.EXPENSIFY_EMAILS, - maxRecentReportsToShow: 0, - }); + return OptionsListUtils.getOptions( + { + reports: options.reports, + personalDetails: options.personalDetails, + }, + { + selectedOptions, + excludeLogins: CONST.EXPENSIFY_EMAILS, + maxRecentReportsToShow: 0, + }, + ); }, [areOptionsInitialized, options.personalDetails, options.reports, selectedOptions]); const chatOptions = useMemo(() => { diff --git a/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx b/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx index 50e0fb9aed97..2b79d441e686 100644 --- a/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx +++ b/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx @@ -37,7 +37,7 @@ function BaseShareLogList({onAttachLogToReport}: BaseShareLogListProps) { headerMessage: '', }; } - const shareLogOptions = OptionsListUtils.getShareLogOptions(options, '', betas ?? []); + const shareLogOptions = OptionsListUtils.getShareLogOptions(options, betas ?? []); const header = OptionsListUtils.getHeaderMessage( (shareLogOptions.recentReports.length || 0) + (shareLogOptions.personalDetails.length || 0) !== 0, diff --git a/tests/perf-test/OptionsListUtils.perf-test.ts b/tests/perf-test/OptionsListUtils.perf-test.ts index 04a953844d97..19629c602477 100644 --- a/tests/perf-test/OptionsListUtils.perf-test.ts +++ b/tests/perf-test/OptionsListUtils.perf-test.ts @@ -93,36 +93,36 @@ describe('OptionsListUtils', () => { }); /* Testing getSearchOptions */ - test('[OptionsListUtils] getSearchOptions with search value', async () => { + test('[OptionsListUtils] getSearchOptions', async () => { await waitForBatchedUpdates(); - await measureFunction(() => OptionsListUtils.getSearchOptions(options, SEARCH_VALUE, mockedBetas)); + await measureFunction(() => OptionsListUtils.getSearchOptions(options, mockedBetas)); }); /* Testing getShareLogOptions */ - test('[OptionsListUtils] getShareLogOptions with search value', async () => { + test('[OptionsListUtils] getShareLogOptions', async () => { await waitForBatchedUpdates(); - await measureFunction(() => OptionsListUtils.getShareLogOptions(options, SEARCH_VALUE, mockedBetas)); + await measureFunction(() => OptionsListUtils.getShareLogOptions(options, mockedBetas)); }); /* Testing getFilteredOptions */ test('[OptionsListUtils] getFilteredOptions with search value', async () => { await waitForBatchedUpdates(); - // It's recommended not to use getFilteredOptions with both options and a search value - // For better performance, use filterOptions instead, especially when passing a search value with options that include reports and personal details. - // @ts-expect-error pass both options and search value together - await measureFunction(() => OptionsListUtils.getFilteredOptions({reports: options.reports, personalDetails: options.personalDetails, betas: mockedBetas, searchValue: SEARCH_VALUE})); + await measureFunction(() => { + const formattedOptions = OptionsListUtils.getOptions({reports: options.reports, personalDetails: options.personalDetails}, {betas: mockedBetas}); + OptionsListUtils.filterOptions(formattedOptions, SEARCH_VALUE); + }); }); /* Testing getShareDestinationOptions */ - test('[OptionsListUtils] getShareDestinationOptions with search value', async () => { + test('[OptionsListUtils] getShareDestinationOptions', async () => { await waitForBatchedUpdates(); - await measureFunction(() => OptionsListUtils.getShareDestinationOptions(options.reports, options.personalDetails, mockedBetas, SEARCH_VALUE)); + await measureFunction(() => OptionsListUtils.getShareDestinationOptions(options.reports, options.personalDetails, mockedBetas)); }); /* Testing getMemberInviteOptions */ - test('[OptionsListUtils] getMemberInviteOptions with search value', async () => { + test('[OptionsListUtils] getMemberInviteOptions', async () => { await waitForBatchedUpdates(); - await measureFunction(() => OptionsListUtils.getMemberInviteOptions(options.personalDetails, mockedBetas, SEARCH_VALUE)); + await measureFunction(() => OptionsListUtils.getMemberInviteOptions(options.personalDetails, mockedBetas)); }); test('[OptionsListUtils] worst case scenario with a search term that matches a subset of selectedOptions, filteredRecentReports, and filteredPersonalDetails', async () => { From 95cffc99d4d6f42fe88a55eadcada03db5ecdac9 Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Mon, 25 Nov 2024 17:48:47 +0530 Subject: [PATCH 074/145] Fix blank import per diem page --- src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index 9a0759b3608a..0811985350ea 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -21,6 +21,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {Errors} from '@src/types/onyx/OnyxCommon'; import type {Rate} from '@src/types/onyx/Policy'; +import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; function generatePerDiemUnits(perDiemDestination: string[], perDiemSubRate: string[], perDiemCurrency: string[], perDiemAmount: string[]) { const perDiemUnits: Record = {}; @@ -128,7 +129,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { const spreadsheetColumns = spreadsheet?.data; if (!spreadsheetColumns) { - return; + return Navigation.goBack(ROUTES.WORKSPACE_PER_DIEM_IMPORT.getRoute(policyID))} />; } const closeImportPageAndModal = () => { From b3f7d892314bc4b4ed9a017bbf7324012de14485 Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Mon, 25 Nov 2024 17:49:23 +0530 Subject: [PATCH 075/145] Fix lint --- src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index 0811985350ea..6fbbd280d834 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -15,13 +15,13 @@ import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import {getPerDiemCustomUnit} from '@libs/PolicyUtils'; +import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {Errors} from '@src/types/onyx/OnyxCommon'; import type {Rate} from '@src/types/onyx/Policy'; -import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; function generatePerDiemUnits(perDiemDestination: string[], perDiemSubRate: string[], perDiemCurrency: string[], perDiemAmount: string[]) { const perDiemUnits: Record = {}; From e95e4cd23db1c1cbdb21433606e1e11701ae680a Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Mon, 25 Nov 2024 18:57:45 +0530 Subject: [PATCH 076/145] Revert: Fix blank import per diem page --- src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index 6fbbd280d834..9a0759b3608a 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -15,7 +15,6 @@ import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import {getPerDiemCustomUnit} from '@libs/PolicyUtils'; -import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -129,7 +128,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { const spreadsheetColumns = spreadsheet?.data; if (!spreadsheetColumns) { - return Navigation.goBack(ROUTES.WORKSPACE_PER_DIEM_IMPORT.getRoute(policyID))} />; + return; } const closeImportPageAndModal = () => { From 7da7e470f11083e9947f0ef5371fa2e5ba331e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 25 Nov 2024 14:50:00 +0100 Subject: [PATCH 077/145] add ordering --- src/libs/OptionsListUtils.ts | 19 +------------------ .../request/MoneyRequestAttendeeSelector.tsx | 9 +++++++++ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index b61be0dca283..9e5ec3b18729 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1303,24 +1303,6 @@ function getOptions( }); } - // I would remove this because it is only executed in the MoneyRequestFlow i believe because its the only place where we - // pass an action. Instead we should call order on our own in the moneyRequestAttendeeSelector - - // If we are prioritizing 1:1 chats in search, do it only once we started searching - // if (sortByReportTypeInSearch && (searchValue !== '' || !!action)) { - // // When sortByReportTypeInSearch is true, recentReports will be returned with all the reports including personalDetailsOptions in the correct Order. - // // If we're in money request flow, we only order the recent report option. - // if (!action) { - // recentReportOptions.push(...personalDetailsOptions); - // personalDetailsOptions = []; - // } - // recentReportOptions = orderOptions(recentReportOptions, searchValue, { - // preferChatroomsOverThreads: true, - // preferPolicyExpenseChat: !!action, - // preferRecentExpenseReports, - // }); - // } - return { personalDetails: personalDetailsOptions, recentReports: recentReportOptions, @@ -1787,6 +1769,7 @@ export { getShareLogOptions, filterOptions, filteredPersonalDetailsOfRecentReports, + orderOptions, createOptionList, createOptionFromReport, getReportOption, diff --git a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx index 832c3ec78ac0..e27be90ce7fc 100644 --- a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx +++ b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx @@ -85,6 +85,13 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde iouType === CONST.IOU.TYPE.INVOICE, action, ); + if (isPaidGroupPolicy) { + optionList.recentReports = OptionsListUtils.orderOptions(optionList.recentReports, searchTerm, { + preferChatroomsOverThreads: true, + preferPolicyExpenseChat: !!action, + preferRecentExpenseReports: action === CONST.IOU.ACTION.CREATE, + }); + } if (optionList.currentUserOption && !isCurrentUserAttendee) { optionList.recentReports = [optionList.currentUserOption, ...optionList.personalDetails]; } @@ -100,7 +107,9 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde iouType, action, isCategorizeOrShareAction, + isPaidGroupPolicy, isCurrentUserAttendee, + searchTerm, ]); const chatOptions = useMemo(() => { From 7a0cf83c5e51f2449e5d4aa27ea1a1a1e102412d Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 25 Nov 2024 22:29:20 +0700 Subject: [PATCH 078/145] fix: hide reconciliation option if expensify card is not enabled --- .../accounting/PolicyAccountingPage.tsx | 20 +++++++++++-------- .../reconciliation/CardReconciliationPage.tsx | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index 878a2dcd6b22..cad197cd105d 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -306,14 +306,18 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { brickRoadIndicator: areSettingsInErrorFields(integrationData?.subscribedExportSettings, integrationData?.errorFields) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, pendingAction: settingsPendingAction(integrationData?.subscribedExportSettings, integrationData?.pendingFields), }, - { - icon: Expensicons.ExpensifyCard, - iconRight: Expensicons.ArrowRight, - shouldShowRightIcon: true, - title: translate('workspace.accounting.cardReconciliation'), - wrapperStyle: [styles.sectionMenuItemTopDescription], - onPress: integrationData?.onCardReconciliationPagePress, - }, + ...(policy?.workspaceAccountID && policy?.areExpensifyCardsEnabled + ? [ + { + icon: Expensicons.ExpensifyCard, + iconRight: Expensicons.ArrowRight, + shouldShowRightIcon: true, + title: translate('workspace.accounting.cardReconciliation'), + wrapperStyle: [styles.sectionMenuItemTopDescription], + onPress: integrationData?.onCardReconciliationPagePress, + }, + ] + : []), { icon: Expensicons.Gear, iconRight: Expensicons.ArrowRight, diff --git a/src/pages/workspace/accounting/reconciliation/CardReconciliationPage.tsx b/src/pages/workspace/accounting/reconciliation/CardReconciliationPage.tsx index 6dc6cd9ebcdb..22922faa1c85 100644 --- a/src/pages/workspace/accounting/reconciliation/CardReconciliationPage.tsx +++ b/src/pages/workspace/accounting/reconciliation/CardReconciliationPage.tsx @@ -89,7 +89,7 @@ function CardReconciliationPage({policy, route}: CardReconciliationPageProps) { subtitle={translate('workspace.accounting.saveHoursOnReconciliation')} shouldPlaceSubtitleBelowSwitch switchAccessibilityLabel={translate('workspace.accounting.continuousReconciliation')} - disabled={!autoSync} + disabled={!autoSync || !policy?.workspaceAccountID || !policy?.areExpensifyCardsEnabled} isActive={!!isContinuousReconciliationOn} onToggle={toggleContinuousReconciliation} wrapperStyle={styles.ph5} From 62ebd138c6cba50629617041ebe7aee09ed05e06 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Mon, 25 Nov 2024 21:12:50 +0300 Subject: [PATCH 079/145] avoided running the onboarding policy creation effect for the second time --- src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx b/src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx index d9f0005ff4a0..98ddf4f6958e 100644 --- a/src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx +++ b/src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx @@ -1,4 +1,4 @@ -import React, {useEffect, useMemo, useState} from 'react'; +import React, {useEffect, useMemo, useRef, useState} from 'react'; import {InteractionManager} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import Button from '@components/Button'; @@ -47,6 +47,7 @@ function BaseOnboardingAccounting({shouldUseNativeStyles, route}: BaseOnboarding const [onboardingValues] = useOnyx(ONYXKEYS.NVP_ONBOARDING); const [onboardingPurposeSelected] = useOnyx(ONYXKEYS.ONBOARDING_PURPOSE_SELECTED); const [onboardingPolicyID, onboardingPolicyIDResult] = useOnyx(ONYXKEYS.ONBOARDING_POLICY_ID); + const isOnboardingPolicyIDCleared = useRef(false); const [onboardingAdminsChatReportID] = useOnyx(ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_ID); const [onboardingCompanySize] = useOnyx(ONYXKEYS.ONBOARDING_COMPANY_SIZE); const {canUseDefaultRooms} = usePermissions(); @@ -59,7 +60,7 @@ function BaseOnboardingAccounting({shouldUseNativeStyles, route}: BaseOnboarding // If the signupQualifier is VSB, the company size step is skip. // So we need to create the new workspace in the accounting step useEffect(() => { - if (!isVsb || !!onboardingPolicyID || isLoadingOnyxValue(onboardingPolicyIDResult)) { + if (!isVsb || !!onboardingPolicyID || isLoadingOnyxValue(onboardingPolicyIDResult) || isOnboardingPolicyIDCleared.current) { return; } @@ -166,6 +167,7 @@ function BaseOnboardingAccounting({shouldUseNativeStyles, route}: BaseOnboarding ); // Avoid creating new WS because onboardingPolicyID is cleared before unmounting InteractionManager.runAfterInteractions(() => { + isOnboardingPolicyIDCleared.current = true; Welcome.setOnboardingAdminsChatReportID(); Welcome.setOnboardingPolicyID(); }); From a5924af0fa5020ad18d5304d979888b3ce95ed7f Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 25 Nov 2024 22:50:31 +0100 Subject: [PATCH 080/145] move syncBrowserHistory files --- .../syncBrowserHistory/index.ts | 0 .../syncBrowserHistory/index.web.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/libs/Navigation/AppNavigator/{createCustomStackNavigator => createResponsiveStackNavigator}/syncBrowserHistory/index.ts (100%) rename src/libs/Navigation/AppNavigator/{createCustomStackNavigator => createResponsiveStackNavigator}/syncBrowserHistory/index.web.ts (100%) diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/syncBrowserHistory/index.ts b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/syncBrowserHistory/index.ts similarity index 100% rename from src/libs/Navigation/AppNavigator/createCustomStackNavigator/syncBrowserHistory/index.ts rename to src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/syncBrowserHistory/index.ts diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/syncBrowserHistory/index.web.ts b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/syncBrowserHistory/index.web.ts similarity index 100% rename from src/libs/Navigation/AppNavigator/createCustomStackNavigator/syncBrowserHistory/index.web.ts rename to src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/syncBrowserHistory/index.web.ts From a60349c73f3e48194509023b16b2862db9d55ed5 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 25 Nov 2024 22:52:48 +0100 Subject: [PATCH 081/145] revert change --- android/app/src/main/res/values/styles.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 8ccc0e5217e5..42da35d7a493 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ -