From 7ffe31935c17dabfb37f72e3d773927036b0b1fd Mon Sep 17 00:00:00 2001 From: VickyStash Date: Wed, 4 Jun 2025 12:46:31 +0200 Subject: [PATCH 01/24] Implement switching between transactions on the confirmation page --- src/components/PrevNextButtons.tsx | 68 +++++++++++++++++++ .../step/IOURequestStepConfirmation.tsx | 28 +++++++- .../ReceiptPreviews/index.tsx | 9 ++- .../step/IOURequestStepScan/index.native.tsx | 6 +- .../request/step/IOURequestStepScan/index.tsx | 6 +- .../request/step/IOURequestStepScan/types.ts | 2 +- 6 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 src/components/PrevNextButtons.tsx diff --git a/src/components/PrevNextButtons.tsx b/src/components/PrevNextButtons.tsx new file mode 100644 index 000000000000..df98114fe34c --- /dev/null +++ b/src/components/PrevNextButtons.tsx @@ -0,0 +1,68 @@ +import React from 'react'; +import {View} from 'react-native'; +import useTheme from '@hooks/useTheme'; +import useThemeStyles from '@hooks/useThemeStyles'; +import CONST from '@src/CONST'; +import Icon from './Icon'; +import * as Expensicons from './Icon/Expensicons'; +import PressableWithFeedback from './Pressable/PressableWithFeedback'; + +type PrevNextButtonsProps = { + /** Should the previous button be disabled */ + isPrevButtonDisabled?: boolean; + + /** Should the next button be disabled */ + isNextButtonDisabled?: boolean; + + /** Moves a user to the next item */ + onNext: () => void; + + /** Moves a user to the previous item */ + onPrevious: () => void; +}; + +function PrevNextButtons({isPrevButtonDisabled, isNextButtonDisabled, onNext, onPrevious}: PrevNextButtonsProps) { + const styles = useThemeStyles(); + const theme = useTheme(); + + return ( + + + + + + + + + + + + + ); +} + +export default PrevNextButtons; diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 7f57215d8374..34985cb3739a 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -13,6 +13,7 @@ import LocationPermissionModal from '@components/LocationPermissionModal'; import MoneyRequestConfirmationList from '@components/MoneyRequestConfirmationList'; import {usePersonalDetails} from '@components/OnyxProvider'; import PDFThumbnail from '@components/PDFThumbnail'; +import PrevNextButtons from '@components/PrevNextButtons'; import ScreenWrapper from '@components/ScreenWrapper'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useDeepCompareRef from '@hooks/useDeepCompareRef'; @@ -102,6 +103,7 @@ function IOURequestStepConfirmation({ // We will use setCurrentTransactionID later to switch between transactions // eslint-disable-next-line @typescript-eslint/no-unused-vars const [currentTransactionID, setCurrentTransactionID] = useState(initialTransactionID); + const currentTransactionIndex = useMemo(() => transactions.findIndex((transaction) => transaction.transactionID === currentTransactionID), [transactions, currentTransactionID]); const [existingTransaction, existingTransactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${currentTransactionID}`, {canBeMissing: true}); const [optimisticTransaction, optimisticTransactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${currentTransactionID}`, {canBeMissing: true}); const isLoadingCurrentTransaction = isLoadingOnyxValue(existingTransactionResult, optimisticTransactionResult); @@ -1000,6 +1002,20 @@ function IOURequestStepConfirmation({ /> ) : null; + const showNextTransaction = () => { + const nextTransaction = transactions.at(currentTransactionIndex + 1); + if (nextTransaction) { + setCurrentTransactionID(nextTransaction.transactionID); + } + }; + + const showPreviousTransaction = () => { + const previousTransaction = transactions.at(currentTransactionIndex - 1); + if (previousTransaction) { + setCurrentTransactionID(previousTransaction.transactionID); + } + }; + const shouldShowThreeDotsButton = requestType === CONST.IOU.REQUEST_TYPE.MANUAL && (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.TRACK) && !isMovingTransactionFromTrackExpense; @@ -1019,6 +1035,7 @@ function IOURequestStepConfirmation({ 1 ? `${currentTransactionIndex + 1} ${translate('common.of')} ${transactions.length}` : undefined} onBackButtonPress={navigateBack} shouldShowThreeDotsButton={shouldShowThreeDotsButton} threeDotsAnchorPosition={threeDotsAnchorPosition} @@ -1029,7 +1046,16 @@ function IOURequestStepConfirmation({ onSelected: navigateToAddReceipt, }, ]} - /> + > + {transactions.length > 1 ? ( + + ) : null} + {(isLoading || isLoadingReceipt || (isScanRequest(transaction) && !Object.values(receiptFiles).length)) && } {PDFThumbnailView} {/* TODO: remove beta check after the feature is enabled */} diff --git a/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx index 3c4e1cee4910..b653b9d43234 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx @@ -32,8 +32,6 @@ type ReceiptPreviewsProps = { setTabSwipeDisabled?: (isDisabled: boolean) => void; }; -// TODO: remove the lint disable when submit method will be used in the code below -// eslint-disable-next-line @typescript-eslint/no-unused-vars function ReceiptPreviews({submit, setTabSwipeDisabled, isMultiScanEnabled}: ReceiptPreviewsProps) { const styles = useThemeStyles(); const theme = useTheme(); @@ -115,6 +113,11 @@ function ReceiptPreviews({submit, setTabSwipeDisabled, isMultiScanEnabled}: Rece }; }); + const submitReceipts = () => { + const transactionReceipts = (optimisticTransactionsReceipts ?? []).filter((receipt): receipt is ReceiptWithTransactionID & {source: string} => !!receipt.source); + submit(transactionReceipts); + }; + return ( @@ -143,7 +146,7 @@ function ReceiptPreviews({submit, setTabSwipeDisabled, isMultiScanEnabled}: Rece // TODO: uncomment the submit call when necessary updates for the confirmation page and bulk expense creation are implemented // https://github.com/Expensify/App/issues/61183 // https://github.com/Expensify/App/issues/61184 - // submit(optimisticTransactionsReceipts ?? []); + submitReceipts(); }} /> diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 8de6aaaf3728..9cd89486a7a1 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -109,7 +109,7 @@ function IOURequestStepScan({ const [flash, setFlash] = useState(false); // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT; - const canUseMultiScan = false; + const canUseMultiScan = true; const [startLocationPermissionFlow, setStartLocationPermissionFlow] = useState(false); const [receiptFiles, setReceiptFiles] = useState([]); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`, {canBeMissing: true}); @@ -310,7 +310,7 @@ function IOURequestStepScan({ (files: ReceiptFile[], participant: Participant, gpsPoints?: GpsPoint, policyParams?: {policy: OnyxEntry}, billable?: boolean) => { files.forEach((receiptFile: ReceiptFile, index) => { const transaction = transactions.find((item) => item.transactionID === receiptFile.transactionID); - const receipt: Receipt = receiptFile.file; + const receipt: Receipt = receiptFile.file ?? {}; receipt.source = receiptFile.source; receipt.state = CONST.IOU.RECEIPT_STATE.SCAN_READY; if (iouType === CONST.IOU.TYPE.TRACK && report) { @@ -416,7 +416,7 @@ function IOURequestStepScan({ if (shouldSkipConfirmation) { const firstReceiptFile = files.at(0); if (iouType === CONST.IOU.TYPE.SPLIT && firstReceiptFile) { - const splitReceipt: Receipt = firstReceiptFile.file; + const splitReceipt: Receipt = firstReceiptFile.file ?? {}; splitReceipt.source = firstReceiptFile.source; splitReceipt.state = CONST.IOU.RECEIPT_STATE.SCAN_READY; startSplitBill({ diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 639dd8948e5b..5675d2cfaa8b 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -139,7 +139,7 @@ function IOURequestStepScan({ const isEditing = action === CONST.IOU.ACTION.EDIT; // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT; - const canUseMultiScan = false; + const canUseMultiScan = true; const [optimisticTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, { selector: (items) => Object.values(items ?? {}), @@ -389,7 +389,7 @@ function IOURequestStepScan({ (files: ReceiptFile[], participant: Participant, gpsPoints?: GpsPoint, policyParams?: {policy: OnyxEntry}, billable?: boolean) => { files.forEach((receiptFile: ReceiptFile, index) => { const transaction = transactions.find((item) => item.transactionID === receiptFile.transactionID); - const receipt: Receipt = receiptFile.file; + const receipt: Receipt = receiptFile.file ?? {}; receipt.source = receiptFile.source; receipt.state = CONST.IOU.RECEIPT_STATE.SCAN_READY; if (iouType === CONST.IOU.TYPE.TRACK && report) { @@ -485,7 +485,7 @@ function IOURequestStepScan({ if (shouldSkipConfirmation) { const firstReceiptFile = files.at(0); if (iouType === CONST.IOU.TYPE.SPLIT && firstReceiptFile) { - const splitReceipt: Receipt = firstReceiptFile.file; + const splitReceipt: Receipt = firstReceiptFile.file ?? {}; splitReceipt.source = firstReceiptFile.source; splitReceipt.state = CONST.IOU.RECEIPT_STATE.SCAN_READY; startSplitBill({ diff --git a/src/pages/iou/request/step/IOURequestStepScan/types.ts b/src/pages/iou/request/step/IOURequestStepScan/types.ts index e25cb3bf2173..62e6ce4091d5 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/types.ts +++ b/src/pages/iou/request/step/IOURequestStepScan/types.ts @@ -25,7 +25,7 @@ type IOURequestStepScanProps = WithCurrentUserPersonalDetailsProps & type ReceiptFile = { source: string; - file: FileObject; + file?: FileObject; transactionID: string; }; From bdf1912e907e7ed1a0a539ffbfcfb97f1517efc5 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Wed, 4 Jun 2025 13:02:57 +0200 Subject: [PATCH 02/24] Pass correct transaction description during creation --- .../step/IOURequestStepConfirmation.tsx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 34985cb3739a..daf4a3339501 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -464,7 +464,7 @@ function IOURequestStepConfirmation({ }, [requestType, iouType, initialTransactionID, reportID, action, report, transactions, participants]); const requestMoney = useCallback( - (selectedParticipants: Participant[], trimmedComment: string, gpsPoints?: GpsPoint) => { + (selectedParticipants: Participant[], gpsPoints?: GpsPoint) => { if (!transactions.length) { return; } @@ -503,7 +503,7 @@ function IOURequestStepConfirmation({ currency: isTestReceipt ? CONST.TEST_RECEIPT.CURRENCY : item.currency, created: item.created, merchant: isTestReceipt ? CONST.TEST_RECEIPT.MERCHANT : item.merchant, - comment: trimmedComment, + comment: item?.comment?.comment?.trim() ?? '', receipt, category: item.category, tag: item.tag, @@ -577,7 +577,7 @@ function IOURequestStepConfirmation({ ); const trackExpense = useCallback( - (selectedParticipants: Participant[], trimmedComment: string, gpsPoints?: GpsPoint) => { + (selectedParticipants: Participant[], gpsPoints?: GpsPoint) => { if (!report || !transactions.length) { return; } @@ -605,7 +605,7 @@ function IOURequestStepConfirmation({ currency: item.currency, created: item.created, merchant: item.merchant, - comment: trimmedComment, + comment: item?.comment?.comment?.trim() ?? '', receipt: receiptFiles[item.transactionID], category: item.category, tag: item.tag, @@ -811,7 +811,7 @@ function IOURequestStepConfirmation({ // If the transaction amount is zero, then the money is being requested through the "Scan" flow and the GPS coordinates need to be included. if (transaction.amount === 0 && !isSharingTrackExpense && !isCategorizingTrackExpense && locationPermissionGranted) { if (userLocation) { - trackExpense(selectedParticipants, trimmedComment, { + trackExpense(selectedParticipants, { lat: userLocation.latitude, long: userLocation.longitude, }); @@ -820,7 +820,7 @@ function IOURequestStepConfirmation({ getCurrentPosition( (successData) => { - trackExpense(selectedParticipants, trimmedComment, { + trackExpense(selectedParticipants, { lat: successData.coords.latitude, long: successData.coords.longitude, }); @@ -828,7 +828,7 @@ function IOURequestStepConfirmation({ (errorData) => { Log.info('[IOURequestStepConfirmation] getCurrentPosition failed', false, errorData); // When there is an error, the money can still be requested, it just won't include the GPS coordinates - trackExpense(selectedParticipants, trimmedComment); + trackExpense(selectedParticipants); }, { maximumAge: CONST.GPS.MAX_AGE, @@ -839,10 +839,10 @@ function IOURequestStepConfirmation({ } // Otherwise, the money is being requested through the "Manual" flow with an attached image and the GPS coordinates are not needed. - trackExpense(selectedParticipants, trimmedComment); + trackExpense(selectedParticipants); return; } - trackExpense(selectedParticipants, trimmedComment); + trackExpense(selectedParticipants); return; } @@ -861,7 +861,7 @@ function IOURequestStepConfirmation({ !selectedParticipants.some((participant) => isSelectedManagerMcTest(participant.login)) ) { if (userLocation) { - requestMoney(selectedParticipants, trimmedComment, { + requestMoney(selectedParticipants, { lat: userLocation.latitude, long: userLocation.longitude, }); @@ -870,7 +870,7 @@ function IOURequestStepConfirmation({ getCurrentPosition( (successData) => { - requestMoney(selectedParticipants, trimmedComment, { + requestMoney(selectedParticipants, { lat: successData.coords.latitude, long: successData.coords.longitude, }); @@ -878,7 +878,7 @@ function IOURequestStepConfirmation({ (errorData) => { Log.info('[IOURequestStepConfirmation] getCurrentPosition failed', false, errorData); // When there is an error, the money can still be requested, it just won't include the GPS coordinates - requestMoney(selectedParticipants, trimmedComment); + requestMoney(selectedParticipants); }, { maximumAge: CONST.GPS.MAX_AGE, @@ -889,11 +889,11 @@ function IOURequestStepConfirmation({ } // Otherwise, the money is being requested through the "Manual" flow with an attached image and the GPS coordinates are not needed. - requestMoney(selectedParticipants, trimmedComment); + requestMoney(selectedParticipants); return; } - requestMoney(selectedParticipants, trimmedComment); + requestMoney(selectedParticipants); }, [ iouType, From 62e4481bbaee92be1853bbe4d11b365fc623cc62 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Wed, 4 Jun 2025 15:42:35 +0200 Subject: [PATCH 03/24] Update button text, code improvements --- src/components/MoneyRequestConfirmationList.tsx | 16 +++++++++++++++- src/components/PrevNextButtons.tsx | 4 ++-- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/languages/params.ts | 3 +++ .../request/step/IOURequestStepConfirmation.tsx | 1 + .../IOURequestStepScan/ReceiptPreviews/index.tsx | 7 +------ 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 093192e56b3d..5cfb471a08ca 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -120,6 +120,9 @@ type MoneyRequestConfirmationListProps = { /** Should the list be read only, and not editable? */ isReadOnly?: boolean; + /** Amount of expenses to be created */ + expensesAmount?: number; + /** Depending on expense report or personal IOU report, respective bank account route */ bankAccountRoute?: Route; @@ -215,6 +218,7 @@ function MoneyRequestConfirmationList({ reportActionID, action = CONST.IOU.ACTION.CREATE, shouldDisplayReceipt = false, + expensesAmount = 0, isConfirmed, isConfirming, onPDFLoadError, @@ -505,7 +509,9 @@ function MoneyRequestConfirmationList({ const splitOrRequestOptions: Array> = useMemo(() => { let text; - if (isTypeInvoice) { + if (expensesAmount > 1) { + text = translate('iou.createExpenses', {expensesAmount}); + } else if (isTypeInvoice) { if (hasInvoicingDetails(policy)) { text = translate('iou.sendInvoice', {amount: formattedAmount}); } else { @@ -537,6 +543,7 @@ function MoneyRequestConfirmationList({ isTypeInvoice, isTypeTrackExpense, isTypeSplit, + expensesAmount, iouAmount, receiptPath, isTypeRequest, @@ -842,6 +849,12 @@ function MoneyRequestConfirmationList({ */ const confirm = useCallback( (paymentMethod: PaymentMethodType | undefined) => { + if (expensesAmount > 1) { + // TODO: remove early return when bulk expense creation is implemented + // https://github.com/Expensify/App/issues/61184 + return; + } + if (!!routeError || !transactionID) { return; } @@ -1121,6 +1134,7 @@ export default memo( prevProps.iouAmount === nextProps.iouAmount && prevProps.isDistanceRequest === nextProps.isDistanceRequest && prevProps.isPolicyExpenseChat === nextProps.isPolicyExpenseChat && + prevProps.expensesAmount === nextProps.expensesAmount && prevProps.iouCategory === nextProps.iouCategory && prevProps.shouldShowSmartScanFields === nextProps.shouldShowSmartScanFields && prevProps.isEditingSplitBill === nextProps.isEditingSplitBill && diff --git a/src/components/PrevNextButtons.tsx b/src/components/PrevNextButtons.tsx index df98114fe34c..b51f8d78c909 100644 --- a/src/components/PrevNextButtons.tsx +++ b/src/components/PrevNextButtons.tsx @@ -32,10 +32,10 @@ function PrevNextButtons({isPrevButtonDisabled, isNextButtonDisabled, onNext, on accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={CONST.ROLE.BUTTON} disabled={isPrevButtonDisabled} - style={[styles.h10, styles.mr2, styles.alignItemsCenter, styles.justifyContentCenter, isPrevButtonDisabled && styles.buttonOpacityDisabled]} + style={[styles.h10, styles.mr2, styles.alignItemsCenter, styles.justifyContentCenter]} onPress={onPrevious} > - + `Create ${expensesAmount} expenses`, addExpense: 'Add expense', chooseRecipient: 'Choose recipient', createExpenseWithAmount: ({amount}: {amount: string}) => `Create ${amount} expense`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 7baa3a3753be..146b7621a214 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -49,6 +49,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -959,6 +960,7 @@ const translations = { share: 'Compartir', participants: 'Participantes', createExpense: 'Crear gasto', + createExpenses: ({expensesAmount}: CreateExpensesParams) => `Crea ${expensesAmount} gastos`, paySomeone: ({name}: PaySomeoneParams = {}) => `Pagar a ${name ?? 'alguien'}`, chooseRecipient: 'Elige destinatario', createExpenseWithAmount: ({amount}: {amount: string}) => `Crear un gasto de ${amount}`, diff --git a/src/languages/params.ts b/src/languages/params.ts index b988af96101d..56f39048f61d 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -163,6 +163,8 @@ type PayerPaidParams = {payer: string}; type PayerSettledParams = {amount: number | string}; +type CreateExpensesParams = {expensesAmount: number}; + type WaitingOnBankAccountParams = {submitterDisplayName: string}; type CanceledRequestParams = {amount: string; submitterDisplayName: string}; @@ -950,6 +952,7 @@ export type { NeedCategoryForExportToIntegrationParams, SubscriptionSettingsSummaryParams, ReviewParams, + CreateExpensesParams, CurrencyInputDisabledTextParams, EmployeeInviteMessageParams, }; diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index daf4a3339501..99dba50660a6 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -1143,6 +1143,7 @@ function IOURequestStepConfirmation({ payeePersonalDetails={payeePersonalDetails} isConfirmed={isConfirmed} isConfirming={isConfirming} + expensesAmount={transactions.length} isReceiptEditable /> diff --git a/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx index b653b9d43234..af90e7373ca0 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx @@ -142,12 +142,7 @@ function ReceiptPreviews({submit, setTabSwipeDisabled, isMultiScanEnabled}: Rece innerStyles={[styles.singleAvatarMedium, styles.bgGreenSuccess]} icon={Expensicons.ArrowRight} iconFill={theme.white} - onPress={() => { - // TODO: uncomment the submit call when necessary updates for the confirmation page and bulk expense creation are implemented - // https://github.com/Expensify/App/issues/61183 - // https://github.com/Expensify/App/issues/61184 - submitReceipts(); - }} + onPress={submitReceipts} /> From c3d40c5c1da632db99e28153499e83bbc4635421 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Wed, 4 Jun 2025 15:51:08 +0200 Subject: [PATCH 04/24] Return canUseMultiScan value back to false, lint fix --- src/components/MoneyRequestConfirmationList.tsx | 1 + src/pages/iou/request/step/IOURequestStepScan/index.native.tsx | 2 +- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 5cfb471a08ca..cf65f0eccbb9 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -923,6 +923,7 @@ function MoneyRequestConfirmationList({ isMerchantEmpty, shouldDisplayFieldError, transaction, + expensesAmount, iouCategory.length, formError, iouType, diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 9cd89486a7a1..c5ab26e9bf75 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -109,7 +109,7 @@ function IOURequestStepScan({ const [flash, setFlash] = useState(false); // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT; - const canUseMultiScan = true; + const canUseMultiScan = false; const [startLocationPermissionFlow, setStartLocationPermissionFlow] = useState(false); const [receiptFiles, setReceiptFiles] = useState([]); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`, {canBeMissing: true}); diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 5675d2cfaa8b..67c6888ee18d 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -139,7 +139,7 @@ function IOURequestStepScan({ const isEditing = action === CONST.IOU.ACTION.EDIT; // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT; - const canUseMultiScan = true; + const canUseMultiScan = false; const [optimisticTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, { selector: (items) => Object.values(items ?? {}), From 6730da85b7e534360a225c1f173621da3aeecdea Mon Sep 17 00:00:00 2001 From: VickyStash Date: Wed, 4 Jun 2025 15:59:33 +0200 Subject: [PATCH 05/24] Fix translation --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 146b7621a214..1114707f28d5 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -960,7 +960,7 @@ const translations = { share: 'Compartir', participants: 'Participantes', createExpense: 'Crear gasto', - createExpenses: ({expensesAmount}: CreateExpensesParams) => `Crea ${expensesAmount} gastos`, + createExpenses: ({expensesAmount}: CreateExpensesParams) => `Crear ${expensesAmount} gastos`, paySomeone: ({name}: PaySomeoneParams = {}) => `Pagar a ${name ?? 'alguien'}`, chooseRecipient: 'Elige destinatario', createExpenseWithAmount: ({amount}: {amount: string}) => `Crear un gasto de ${amount}`, From 9da52d9eede74af332c281f080f7ad9f1dc1f550 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Fri, 6 Jun 2025 09:13:39 +0200 Subject: [PATCH 06/24] Rename expensesAmount -> expensesNumber --- .../MoneyRequestConfirmationList.tsx | 18 +++++++++--------- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- src/languages/params.ts | 2 +- .../step/IOURequestStepConfirmation.tsx | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index cf65f0eccbb9..455010dc0fe0 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -120,8 +120,8 @@ type MoneyRequestConfirmationListProps = { /** Should the list be read only, and not editable? */ isReadOnly?: boolean; - /** Amount of expenses to be created */ - expensesAmount?: number; + /** Number of expenses to be created */ + expensesNumber?: number; /** Depending on expense report or personal IOU report, respective bank account route */ bankAccountRoute?: Route; @@ -218,7 +218,7 @@ function MoneyRequestConfirmationList({ reportActionID, action = CONST.IOU.ACTION.CREATE, shouldDisplayReceipt = false, - expensesAmount = 0, + expensesNumber = 0, isConfirmed, isConfirming, onPDFLoadError, @@ -509,8 +509,8 @@ function MoneyRequestConfirmationList({ const splitOrRequestOptions: Array> = useMemo(() => { let text; - if (expensesAmount > 1) { - text = translate('iou.createExpenses', {expensesAmount}); + if (expensesNumber > 1) { + text = translate('iou.createExpenses', {expensesNumber}); } else if (isTypeInvoice) { if (hasInvoicingDetails(policy)) { text = translate('iou.sendInvoice', {amount: formattedAmount}); @@ -543,7 +543,7 @@ function MoneyRequestConfirmationList({ isTypeInvoice, isTypeTrackExpense, isTypeSplit, - expensesAmount, + expensesNumber, iouAmount, receiptPath, isTypeRequest, @@ -849,7 +849,7 @@ function MoneyRequestConfirmationList({ */ const confirm = useCallback( (paymentMethod: PaymentMethodType | undefined) => { - if (expensesAmount > 1) { + if (expensesNumber > 1) { // TODO: remove early return when bulk expense creation is implemented // https://github.com/Expensify/App/issues/61184 return; @@ -923,7 +923,7 @@ function MoneyRequestConfirmationList({ isMerchantEmpty, shouldDisplayFieldError, transaction, - expensesAmount, + expensesNumber, iouCategory.length, formError, iouType, @@ -1135,7 +1135,7 @@ export default memo( prevProps.iouAmount === nextProps.iouAmount && prevProps.isDistanceRequest === nextProps.isDistanceRequest && prevProps.isPolicyExpenseChat === nextProps.isPolicyExpenseChat && - prevProps.expensesAmount === nextProps.expensesAmount && + prevProps.expensesNumber === nextProps.expensesNumber && prevProps.iouCategory === nextProps.iouCategory && prevProps.shouldShowSmartScanFields === nextProps.shouldShowSmartScanFields && prevProps.isEditingSplitBill === nextProps.isEditingSplitBill && diff --git a/src/languages/en.ts b/src/languages/en.ts index fc9acb04a6c5..a802a22ad484 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -967,7 +967,7 @@ const translations = { share: 'Share', participants: 'Participants', createExpense: 'Create expense', - createExpenses: ({expensesAmount}: CreateExpensesParams) => `Create ${expensesAmount} expenses`, + createExpenses: ({expensesNumber}: CreateExpensesParams) => `Create ${expensesNumber} expenses`, addExpense: 'Add expense', chooseRecipient: 'Choose recipient', createExpenseWithAmount: ({amount}: {amount: string}) => `Create ${amount} expense`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 6315294812c4..f05c71b66532 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -962,7 +962,7 @@ const translations = { share: 'Compartir', participants: 'Participantes', createExpense: 'Crear gasto', - createExpenses: ({expensesAmount}: CreateExpensesParams) => `Crear ${expensesAmount} gastos`, + createExpenses: ({expensesNumber}: CreateExpensesParams) => `Crear ${expensesNumber} gastos`, paySomeone: ({name}: PaySomeoneParams = {}) => `Pagar a ${name ?? 'alguien'}`, chooseRecipient: 'Elige destinatario', createExpenseWithAmount: ({amount}: {amount: string}) => `Crear un gasto de ${amount}`, diff --git a/src/languages/params.ts b/src/languages/params.ts index d12ff7bd1b80..77fe373b1026 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -165,7 +165,7 @@ type PayerPaidParams = {payer: string}; type PayerSettledParams = {amount: number | string}; -type CreateExpensesParams = {expensesAmount: number}; +type CreateExpensesParams = {expensesNumber: number}; type WaitingOnBankAccountParams = {submitterDisplayName: string}; diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 6489ae66a141..a6d7ca142b36 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -1149,7 +1149,7 @@ function IOURequestStepConfirmation({ payeePersonalDetails={payeePersonalDetails} isConfirmed={isConfirmed} isConfirming={isConfirming} - expensesAmount={transactions.length} + expensesNumber={transactions.length} isReceiptEditable /> From f246610f717d397826724f2ffc9099a446798a77 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Fri, 6 Jun 2025 12:09:51 +0200 Subject: [PATCH 07/24] Improve canUseMultiScan check, fix slide out animation --- .../IOURequestStepScan/ReceiptPreviews/index.tsx | 4 ---- .../step/IOURequestStepScan/index.native.tsx | 14 ++++++++------ .../iou/request/step/IOURequestStepScan/index.tsx | 14 ++++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx index e09e8e50642f..af90e7373ca0 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx @@ -118,10 +118,6 @@ function ReceiptPreviews({submit, setTabSwipeDisabled, isMultiScanEnabled}: Rece submit(transactionReceipts); }; - if (!isMultiScanEnabled) { - return; - } - return ( diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index ee392e614e24..6161f2096759 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -101,7 +101,7 @@ function IOURequestStepScan({ const camera = useRef(null); const [flash, setFlash] = useState(false); // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented - // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT; + // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; const canUseMultiScan = false; const [startLocationPermissionFlow, setStartLocationPermissionFlow] = useState(false); const [receiptFiles, setReceiptFiles] = useState([]); @@ -922,11 +922,13 @@ function IOURequestStepScan({ )} - + {canUseMultiScan && ( + + )} {startLocationPermissionFlow && !!receiptFiles.length && ( - + {canUseMultiScan && ( + + )} ); From 15792f7c6b448dd6ef0267c20c2610e08801fff8 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Fri, 6 Jun 2025 12:40:35 +0200 Subject: [PATCH 08/24] Fix invalid receipts clean up after confirmation page refresh --- src/libs/actions/TransactionEdit.ts | 2 +- src/pages/iou/request/step/IOURequestStepConfirmation.tsx | 7 +++++-- .../iou/request/step/IOURequestStepScan/index.native.tsx | 2 +- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libs/actions/TransactionEdit.ts b/src/libs/actions/TransactionEdit.ts index 1a869a5709f4..4e992dc0660b 100644 --- a/src/libs/actions/TransactionEdit.ts +++ b/src/libs/actions/TransactionEdit.ts @@ -107,7 +107,7 @@ function removeDraftTransactions(shouldExcludeInitialTransaction = false) { }, {} as Record, ); - Onyx.multiSet(draftTransactionsSet); + return Onyx.multiSet(draftTransactionsSet); } function removeTransactionReceipt(transactionID: string | undefined) { diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index a6d7ca142b36..dd74e9f6acd2 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -58,6 +58,7 @@ import { updateLastLocationPermissionPrompt, } from '@userActions/IOU'; import {openDraftWorkspaceRequest} from '@userActions/Policy/Policy'; +import {removeDraftTransactions} from '@userActions/TransactionEdit'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -449,7 +450,9 @@ function IOURequestStepConfirmation({ const onFailure = () => { isScanFilesCanBeRead = false; - setMoneyRequestReceipt(item.transactionID, '', '', true); + if (initialTransactionID === item.transactionID) { + setMoneyRequestReceipt(item.transactionID, '', '', true); + } }; return checkIfScanFileCanBeRead(itemReceiptFilename, itemReceiptPath, itemReceiptType, onSuccess, onFailure); @@ -463,7 +466,7 @@ function IOURequestStepConfirmation({ Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(CONST.IOU.ACTION.CREATE, iouType, initialTransactionID, reportID, Navigation.getActiveRouteWithoutParams())); return; } - navigateToStartMoneyRequestStep(requestType, iouType, initialTransactionID, reportID); + removeDraftTransactions(true).then(() => navigateToStartMoneyRequestStep(requestType, iouType, initialTransactionID, reportID)); }); }, [requestType, iouType, initialTransactionID, reportID, action, report, transactions, participants]); diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 6161f2096759..a5cfdbdd2f24 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -673,7 +673,7 @@ function IOURequestStepScan({ .then((photo: PhotoFile) => { // Store the receipt on the transaction object in Onyx const source = getPhotoSource(photo.path); - const transaction = isMultiScanEnabled && initialTransaction?.receipt ? buildOptimisticTransaction() : initialTransaction; + const transaction = isMultiScanEnabled && initialTransaction?.receipt?.source ? buildOptimisticTransaction() : initialTransaction; const transactionID = transaction?.transactionID ?? initialTransactionID; setMoneyRequestReceipt(transactionID, source, photo.path, !isEditing); diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index ef5e1b085de6..1711321a439f 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -722,7 +722,7 @@ function IOURequestStepScan({ const filename = `receipt_${Date.now()}.png`; const file = base64ToFile(imageBase64 ?? '', filename); const source = URL.createObjectURL(file); - const transaction = isMultiScanEnabled && initialTransaction?.receipt ? buildOptimisticTransaction() : initialTransaction; + const transaction = isMultiScanEnabled && initialTransaction?.receipt?.source ? buildOptimisticTransaction() : initialTransaction; const transactionID = transaction?.transactionID ?? initialTransactionID; const newReceiptFiles = [...receiptFiles, {file, source, transactionID}]; From 279486730f2970219dd6a862e3d95751f1c54563 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Fri, 6 Jun 2025 17:15:17 +0200 Subject: [PATCH 09/24] Put currentTransactionID to the url --- src/ROUTES.ts | 27 ++++++++++-- .../ModalStackNavigators/index.tsx | 3 ++ src/libs/Navigation/types.ts | 1 + .../step/IOURequestStepConfirmation.tsx | 41 ++++++++++++++++--- 4 files changed, 62 insertions(+), 10 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index c28933476632..d2a567fee5b0 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -615,10 +615,29 @@ const ROUTES = { }, MONEY_REQUEST_STEP_CONFIRMATION: { route: ':action/:iouType/confirmation/:transactionID/:reportID/:backToReport?', - getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string | undefined, backToReport?: string, participantsAutoAssigned?: boolean) => - `${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}${ - participantsAutoAssigned ? '?participantsAutoAssigned=true' : '' - }` as const, + getRoute: ( + action: IOUAction, + iouType: IOUType, + transactionID: string, + reportID: string | undefined, + backToReport?: string, + participantsAutoAssigned?: boolean, + currentTransactionID?: string, + ) => { + const queryParams: string[] = []; + + if (participantsAutoAssigned) { + queryParams.push(`participantsAutoAssigned=true`); + } + if (currentTransactionID) { + queryParams.push(`currentTransactionID=${currentTransactionID}`); + } + + const baseRoute = `${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}` as const; + const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : ''; + + return `${baseRoute}${queryString}` as const; + }, }, MONEY_REQUEST_STEP_AMOUNT: { route: ':action/:iouType/amount/:transactionID/:reportID/:pageIndex?/:backToReport?', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 6ce9dd099d07..d312fb11e61a 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -52,6 +52,9 @@ const OPTIONS_PER_SCREEN: Partial [SCREENS.SETTINGS.MERGE_ACCOUNTS.MERGE_RESULT]: { animationTypeForReplace: 'push', }, + [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: { + animation: Animations.NONE, + }, }; /** diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 2861fc51bd31..cdfbce016aa4 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1319,6 +1319,7 @@ type MoneyRequestNavigatorParamList = { pageIndex?: string; backTo?: string; participantsAutoAssigned?: string; + currentTransactionID?: string; backToReport?: string; }; [SCREENS.MONEY_REQUEST.STEP_SCAN]: { diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index dd74e9f6acd2..45699bd3de99 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -82,7 +82,15 @@ function IOURequestStepConfirmation({ report: reportReal, reportDraft, route: { - params: {iouType, reportID, transactionID: initialTransactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute, backToReport}, + params: { + iouType, + reportID, + transactionID: initialTransactionID, + action, + participantsAutoAssigned: participantsAutoAssignedFromRoute, + backToReport, + currentTransactionID = initialTransactionID, + }, }, transaction: initialTransaction, isLoadingTransaction, @@ -103,7 +111,6 @@ function IOURequestStepConfirmation({ const transactionIDs = useMemo(() => transactions?.map((transaction) => transaction.transactionID), [transactions.length]); // We will use setCurrentTransactionID later to switch between transactions // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [currentTransactionID, setCurrentTransactionID] = useState(initialTransactionID); const currentTransactionIndex = useMemo(() => transactions.findIndex((transaction) => transaction.transactionID === currentTransactionID), [transactions, currentTransactionID]); const [existingTransaction, existingTransactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${currentTransactionID}`, {canBeMissing: true}); const [optimisticTransaction, optimisticTransactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${currentTransactionID}`, {canBeMissing: true}); @@ -253,7 +260,7 @@ function IOURequestStepConfirmation({ useEffect(() => { // Exit early if the transaction is still loading - if (isLoadingTransaction) { + if (!!isLoadingTransaction || isLoadingCurrentTransaction) { return; } @@ -278,7 +285,7 @@ function IOURequestStepConfirmation({ generateReportID(), ); // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we don't want this effect to run again - }, [isLoadingTransaction, isMovingTransactionFromTrackExpense]); + }, [isLoadingTransaction, isLoadingCurrentTransaction, isMovingTransactionFromTrackExpense]); useEffect(() => { transactions.forEach((item) => { @@ -1014,14 +1021,36 @@ function IOURequestStepConfirmation({ const showNextTransaction = () => { const nextTransaction = transactions.at(currentTransactionIndex + 1); if (nextTransaction) { - setCurrentTransactionID(nextTransaction.transactionID); + Navigation.navigate( + ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute( + action, + iouType, + initialTransactionID, + reportID, + backToReport, + participantsAutoAssignedFromRoute === 'true', + nextTransaction.transactionID, + ), + {forceReplace: true}, + ); } }; const showPreviousTransaction = () => { const previousTransaction = transactions.at(currentTransactionIndex - 1); if (previousTransaction) { - setCurrentTransactionID(previousTransaction.transactionID); + Navigation.navigate( + ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute( + action, + iouType, + initialTransactionID, + reportID, + backToReport, + participantsAutoAssignedFromRoute === 'true', + previousTransaction.transactionID, + ), + {forceReplace: true}, + ); } }; From ab343c2002b2c831674cfee5080e65462f770ebe Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 9 Jun 2025 10:58:25 +0200 Subject: [PATCH 10/24] Reuse PrevNextButtons in the MoneyRequestReportTransactionsNavigation --- ...neyRequestReportTransactionsNavigation.tsx | 72 ++++--------------- src/components/PrevNextButtons.tsx | 5 +- 2 files changed, 16 insertions(+), 61 deletions(-) diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx index c4d9f5fb053f..11e0ab6031d7 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx @@ -1,13 +1,8 @@ import {findFocusedRoute} from '@react-navigation/native'; import React, {useEffect} from 'react'; -import Icon from '@components/Icon'; -import * as Expensicons from '@components/Icon/Expensicons'; -import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; -import useTheme from '@hooks/useTheme'; -import useThemeStyles from '@hooks/useThemeStyles'; +import PrevNextButtons from '@components/PrevNextButtons'; import Navigation from '@navigation/Navigation'; import navigationRef from '@navigation/navigationRef'; -import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import {clearActiveTransactionThreadIDs, getActiveTransactionThreadIDs} from './TransactionThreadReportIDRepository'; @@ -17,9 +12,6 @@ type MoneyRequestReportRHPNavigationButtonsProps = { }; function MoneyRequestReportTransactionsNavigation({currentReportID}: MoneyRequestReportRHPNavigationButtonsProps) { - const styles = useThemeStyles(); - const theme = useTheme(); - const reportIDsList = getActiveTransactionThreadIDs(); const {prevReportID, nextReportID} = (() => { if (!reportIDsList) { @@ -54,57 +46,19 @@ function MoneyRequestReportTransactionsNavigation({currentReportID}: MoneyReques return; } - const pressableStyle = [ - styles.ml1, - styles.alignItemsCenter, - styles.justifyContentCenter, - { - borderRadius: 50, - width: 28, - height: 28, - backgroundColor: theme.borderLighter, - }, - ]; - return ( - <> - { - e?.preventDefault(); - Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: prevReportID, backTo}), {forceReplace: true}); - }} - > - - - { - e?.preventDefault(); - Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: nextReportID, backTo}), {forceReplace: true}); - }} - > - - - + { + e?.preventDefault(); + Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: nextReportID, backTo}), {forceReplace: true}); + }} + onPrevious={(e) => { + e?.preventDefault(); + Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: prevReportID, backTo}), {forceReplace: true}); + }} + /> ); } diff --git a/src/components/PrevNextButtons.tsx b/src/components/PrevNextButtons.tsx index b51f8d78c909..9e7435c1a257 100644 --- a/src/components/PrevNextButtons.tsx +++ b/src/components/PrevNextButtons.tsx @@ -1,5 +1,6 @@ import React from 'react'; import {View} from 'react-native'; +import type {GestureResponderEvent} from 'react-native'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; @@ -15,10 +16,10 @@ type PrevNextButtonsProps = { isNextButtonDisabled?: boolean; /** Moves a user to the next item */ - onNext: () => void; + onNext: (event?: GestureResponderEvent | KeyboardEvent) => void; /** Moves a user to the previous item */ - onPrevious: () => void; + onPrevious: (event?: GestureResponderEvent | KeyboardEvent) => void; }; function PrevNextButtons({isPrevButtonDisabled, isNextButtonDisabled, onNext, onPrevious}: PrevNextButtonsProps) { From 6e5f6dbefe69a7ad0e943dd9a57b2da2c16d694b Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 9 Jun 2025 16:14:26 +0200 Subject: [PATCH 11/24] Revert "Put currentTransactionID to the url" This reverts commit 279486730f2970219dd6a862e3d95751f1c54563. --- src/ROUTES.ts | 27 ++---------- .../ModalStackNavigators/index.tsx | 3 -- src/libs/Navigation/types.ts | 1 - .../step/IOURequestStepConfirmation.tsx | 41 +++---------------- 4 files changed, 10 insertions(+), 62 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index d2a567fee5b0..c28933476632 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -615,29 +615,10 @@ const ROUTES = { }, MONEY_REQUEST_STEP_CONFIRMATION: { route: ':action/:iouType/confirmation/:transactionID/:reportID/:backToReport?', - getRoute: ( - action: IOUAction, - iouType: IOUType, - transactionID: string, - reportID: string | undefined, - backToReport?: string, - participantsAutoAssigned?: boolean, - currentTransactionID?: string, - ) => { - const queryParams: string[] = []; - - if (participantsAutoAssigned) { - queryParams.push(`participantsAutoAssigned=true`); - } - if (currentTransactionID) { - queryParams.push(`currentTransactionID=${currentTransactionID}`); - } - - const baseRoute = `${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}` as const; - const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : ''; - - return `${baseRoute}${queryString}` as const; - }, + getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string | undefined, backToReport?: string, participantsAutoAssigned?: boolean) => + `${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}${ + participantsAutoAssigned ? '?participantsAutoAssigned=true' : '' + }` as const, }, MONEY_REQUEST_STEP_AMOUNT: { route: ':action/:iouType/amount/:transactionID/:reportID/:pageIndex?/:backToReport?', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index d312fb11e61a..6ce9dd099d07 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -52,9 +52,6 @@ const OPTIONS_PER_SCREEN: Partial [SCREENS.SETTINGS.MERGE_ACCOUNTS.MERGE_RESULT]: { animationTypeForReplace: 'push', }, - [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: { - animation: Animations.NONE, - }, }; /** diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index cdfbce016aa4..2861fc51bd31 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1319,7 +1319,6 @@ type MoneyRequestNavigatorParamList = { pageIndex?: string; backTo?: string; participantsAutoAssigned?: string; - currentTransactionID?: string; backToReport?: string; }; [SCREENS.MONEY_REQUEST.STEP_SCAN]: { diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 45699bd3de99..dd74e9f6acd2 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -82,15 +82,7 @@ function IOURequestStepConfirmation({ report: reportReal, reportDraft, route: { - params: { - iouType, - reportID, - transactionID: initialTransactionID, - action, - participantsAutoAssigned: participantsAutoAssignedFromRoute, - backToReport, - currentTransactionID = initialTransactionID, - }, + params: {iouType, reportID, transactionID: initialTransactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute, backToReport}, }, transaction: initialTransaction, isLoadingTransaction, @@ -111,6 +103,7 @@ function IOURequestStepConfirmation({ const transactionIDs = useMemo(() => transactions?.map((transaction) => transaction.transactionID), [transactions.length]); // We will use setCurrentTransactionID later to switch between transactions // eslint-disable-next-line @typescript-eslint/no-unused-vars + const [currentTransactionID, setCurrentTransactionID] = useState(initialTransactionID); const currentTransactionIndex = useMemo(() => transactions.findIndex((transaction) => transaction.transactionID === currentTransactionID), [transactions, currentTransactionID]); const [existingTransaction, existingTransactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${currentTransactionID}`, {canBeMissing: true}); const [optimisticTransaction, optimisticTransactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${currentTransactionID}`, {canBeMissing: true}); @@ -260,7 +253,7 @@ function IOURequestStepConfirmation({ useEffect(() => { // Exit early if the transaction is still loading - if (!!isLoadingTransaction || isLoadingCurrentTransaction) { + if (isLoadingTransaction) { return; } @@ -285,7 +278,7 @@ function IOURequestStepConfirmation({ generateReportID(), ); // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we don't want this effect to run again - }, [isLoadingTransaction, isLoadingCurrentTransaction, isMovingTransactionFromTrackExpense]); + }, [isLoadingTransaction, isMovingTransactionFromTrackExpense]); useEffect(() => { transactions.forEach((item) => { @@ -1021,36 +1014,14 @@ function IOURequestStepConfirmation({ const showNextTransaction = () => { const nextTransaction = transactions.at(currentTransactionIndex + 1); if (nextTransaction) { - Navigation.navigate( - ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute( - action, - iouType, - initialTransactionID, - reportID, - backToReport, - participantsAutoAssignedFromRoute === 'true', - nextTransaction.transactionID, - ), - {forceReplace: true}, - ); + setCurrentTransactionID(nextTransaction.transactionID); } }; const showPreviousTransaction = () => { const previousTransaction = transactions.at(currentTransactionIndex - 1); if (previousTransaction) { - Navigation.navigate( - ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute( - action, - iouType, - initialTransactionID, - reportID, - backToReport, - participantsAutoAssignedFromRoute === 'true', - previousTransaction.transactionID, - ), - {forceReplace: true}, - ); + setCurrentTransactionID(previousTransaction.transactionID); } }; From 93186780c2a824f321bf31f45f74be1e1bd67c99 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 9 Jun 2025 21:13:44 +0200 Subject: [PATCH 12/24] Fix transactions clean up --- src/pages/iou/request/step/IOURequestStepScan/index.native.tsx | 1 + src/pages/iou/request/step/IOURequestStepScan/index.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index a5cfdbdd2f24..ffbe31a1fdd1 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -730,6 +730,7 @@ function IOURequestStepScan({ const toggleMultiScan = () => { if (isMultiScanEnabled) { + setReceiptFiles([]); removeTransactionReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID); removeDraftTransactions(true); } diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 1711321a439f..d3e1c301c3f5 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -754,6 +754,7 @@ function IOURequestStepScan({ const toggleMultiScan = () => { if (isMultiScanEnabled) { + setReceiptFiles([]); removeTransactionReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID); removeDraftTransactions(true); } From 046f4150184f2edab835a37779e94384138b9afe Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 10 Jun 2025 09:43:09 +0200 Subject: [PATCH 13/24] Reduce the space between prev/next buttons --- src/components/PrevNextButtons.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PrevNextButtons.tsx b/src/components/PrevNextButtons.tsx index 9e7435c1a257..23f950d30f52 100644 --- a/src/components/PrevNextButtons.tsx +++ b/src/components/PrevNextButtons.tsx @@ -33,7 +33,7 @@ function PrevNextButtons({isPrevButtonDisabled, isNextButtonDisabled, onNext, on accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={CONST.ROLE.BUTTON} disabled={isPrevButtonDisabled} - style={[styles.h10, styles.mr2, styles.alignItemsCenter, styles.justifyContentCenter]} + style={[styles.h10, styles.mr1, styles.alignItemsCenter, styles.justifyContentCenter]} onPress={onPrevious} > From 3c0b11dd410edeaf0868bb393a48dc65569250e3 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 10 Jun 2025 10:40:29 +0200 Subject: [PATCH 14/24] Bug fix --- .../request/step/IOURequestStepScan/index.native.tsx | 10 ++++++++-- .../iou/request/step/IOURequestStepScan/index.tsx | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index ffbe31a1fdd1..880ac14783ed 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -1,7 +1,7 @@ import {useFocusEffect} from '@react-navigation/core'; import {format} from 'date-fns'; import {Str} from 'expensify-common'; -import React, {useCallback, useMemo, useRef, useState} from 'react'; +import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {ActivityIndicator, Alert, AppState, InteractionManager, StyleSheet, View} from 'react-native'; import ReactNativeBlobUtil from 'react-native-blob-util'; import {Gesture, GestureDetector} from 'react-native-gesture-handler'; @@ -243,6 +243,13 @@ function IOURequestStepScan({ }, [isLoaderVisible, setIsLoaderVisible]), ); + useEffect(() => { + if (isMultiScanEnabled) { + return; + } + setReceiptFiles([]); + }, [isMultiScanEnabled]); + const validateReceipt = (file: FileObject) => { const {fileExtension} = splitExtensionFromFileName(file?.name ?? ''); if ( @@ -730,7 +737,6 @@ function IOURequestStepScan({ const toggleMultiScan = () => { if (isMultiScanEnabled) { - setReceiptFiles([]); removeTransactionReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID); removeDraftTransactions(true); } diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index d3e1c301c3f5..721c5887629d 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -311,6 +311,13 @@ function IOURequestStepScan({ }); }, [initialTransaction?.amount, iouType]); + useEffect(() => { + if (isMultiScanEnabled) { + return; + } + setReceiptFiles([]); + }, [isMultiScanEnabled]); + const hideReceiptModal = () => { setIsAttachmentInvalid(false); }; @@ -754,7 +761,6 @@ function IOURequestStepScan({ const toggleMultiScan = () => { if (isMultiScanEnabled) { - setReceiptFiles([]); removeTransactionReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID); removeDraftTransactions(true); } From 657f00ca50841c39273a830f5cfe022aee754472 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 10 Jun 2025 12:22:57 +0200 Subject: [PATCH 15/24] Don't reuse description and category of initial transaction --- .../iou/request/step/IOURequestStepScan/index.native.tsx | 4 +--- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 880ac14783ed..020bfb151a84 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -362,13 +362,11 @@ function IOURequestStepScan({ const buildOptimisticTransaction = useCallback((): Transaction => { const newTransactionID = generateTransactionID(); - const {comment, currency, category, iouRequestType, isFromGlobalCreate, splitPayerAccountIDs} = initialTransaction ?? {}; + const {currency, iouRequestType, isFromGlobalCreate, splitPayerAccountIDs} = initialTransaction ?? {}; const newTransaction = { amount: 0, - comment, created: format(new Date(), 'yyyy-MM-dd'), currency, - category, iouRequestType, reportID, transactionID: newTransactionID, diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 721c5887629d..e454ba598413 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -363,13 +363,11 @@ function IOURequestStepScan({ const buildOptimisticTransaction = useCallback((): Transaction => { const newTransactionID = generateTransactionID(); - const {comment, currency, category, iouRequestType, isFromGlobalCreate, splitPayerAccountIDs} = initialTransaction ?? {}; + const {currency, iouRequestType, isFromGlobalCreate, splitPayerAccountIDs} = initialTransaction ?? {}; const newTransaction = { amount: 0, - comment, created: format(new Date(), 'yyyy-MM-dd'), currency, - category, iouRequestType, reportID, transactionID: newTransactionID, From b8747e05895b4480ea7ed7bd7965a22adf894f13 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Wed, 11 Jun 2025 10:20:43 +0200 Subject: [PATCH 16/24] Fix assignees assignment --- .../iou/request/step/IOURequestStepScan/index.native.tsx | 5 +++-- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 020bfb151a84..fe08dbab394e 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -39,7 +39,7 @@ import getCurrentPosition from '@libs/getCurrentPosition'; import getPlatform from '@libs/getPlatform'; import getReceiptsUploadFolderPath from '@libs/getReceiptsUploadFolderPath'; import HapticFeedback from '@libs/HapticFeedback'; -import {navigateToParticipantPage, shouldStartLocationPermissionFlow} from '@libs/IOUUtils'; +import {formatCurrentUserToAttendee, navigateToParticipantPage, shouldStartLocationPermissionFlow} from '@libs/IOUUtils'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import {getManagerMcTestParticipant, getParticipantsOption, getReportOption} from '@libs/OptionsListUtils'; @@ -367,6 +367,7 @@ function IOURequestStepScan({ amount: 0, created: format(new Date(), 'yyyy-MM-dd'), currency, + comment: {attendees: formatCurrentUserToAttendee(currentUserPersonalDetails, reportID)}, iouRequestType, reportID, transactionID: newTransactionID, @@ -376,7 +377,7 @@ function IOURequestStepScan({ } as Transaction; createDraftTransaction(newTransaction); return newTransaction; - }, [initialTransaction, reportID]); + }, [currentUserPersonalDetails, initialTransaction, reportID]); const navigateToConfirmationStep = useCallback( (files: ReceiptFile[], locationPermissionGranted = false, isTestTransaction = false) => { diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index e454ba598413..4bc2c493b236 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -41,7 +41,7 @@ import {isMobile, isMobileWebKit} from '@libs/Browser'; import {base64ToFile, isLocalFile as isLocalFileFileUtils, resizeImageIfNeeded, validateReceipt} from '@libs/fileDownload/FileUtils'; import convertHeicImage from '@libs/fileDownload/heicConverter'; import getCurrentPosition from '@libs/getCurrentPosition'; -import {navigateToParticipantPage, shouldStartLocationPermissionFlow} from '@libs/IOUUtils'; +import {formatCurrentUserToAttendee, navigateToParticipantPage, shouldStartLocationPermissionFlow} from '@libs/IOUUtils'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import {getManagerMcTestParticipant, getParticipantsOption, getReportOption} from '@libs/OptionsListUtils'; @@ -368,6 +368,7 @@ function IOURequestStepScan({ amount: 0, created: format(new Date(), 'yyyy-MM-dd'), currency, + comment: {attendees: formatCurrentUserToAttendee(currentUserPersonalDetails, reportID)}, iouRequestType, reportID, transactionID: newTransactionID, @@ -377,7 +378,7 @@ function IOURequestStepScan({ } as Transaction; createDraftTransaction(newTransaction); return newTransaction; - }, [initialTransaction, reportID]); + }, [currentUserPersonalDetails, initialTransaction, reportID]); const createTransaction = useCallback( (files: ReceiptFile[], participant: Participant, gpsPoints?: GpsPoint, policyParams?: {policy: OnyxEntry}, billable?: boolean) => { From 0b99fda5813eaca02964125470bd7b42580e1089 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Thu, 12 Jun 2025 17:52:48 +0200 Subject: [PATCH 17/24] Update canUseMultiScan for UI testing --- src/pages/iou/request/step/IOURequestStepScan/index.native.tsx | 2 +- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 9948ac64d742..cbd970600241 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -105,7 +105,7 @@ function IOURequestStepScan({ const [flash, setFlash] = useState(false); // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; - const canUseMultiScan = false; + const canUseMultiScan = true && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; const [startLocationPermissionFlow, setStartLocationPermissionFlow] = useState(false); const [receiptFiles, setReceiptFiles] = useState([]); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`, {canBeMissing: true}); diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 0a93a25a4011..a73e57321e9d 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -136,7 +136,7 @@ function IOURequestStepScan({ const isEditing = action === CONST.IOU.ACTION.EDIT; // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; - const canUseMultiScan = false; + const canUseMultiScan = true && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; const [optimisticTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, { selector: (items) => Object.values(items ?? {}), From 5fb7368d32e17f333cd85aaf68b694dfd02c3594 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Fri, 13 Jun 2025 10:35:35 +0200 Subject: [PATCH 18/24] Apply UI related feedback --- src/pages/iou/request/step/IOURequestStepConfirmation.tsx | 6 ++++-- .../iou/request/step/IOURequestStepScan/index.native.tsx | 3 ++- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 0bc3c889cc5e..d9cd3a58b6b7 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -99,6 +99,7 @@ function IOURequestStepConfirmation({ const allTransactions = initialTransactionID === CONST.IOU.OPTIMISTIC_TRANSACTION_ID ? (optimisticTransactions ?? []) : [initialTransaction]; return allTransactions.filter((transaction): transaction is Transaction => !!transaction); }, [initialTransaction, initialTransactionID, optimisticTransactions]); + const hasMultipleTransactions = transactions.length > 1; // Depend on transactions.length to avoid updating transactionIDs when only the transaction details change // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps const transactionIDs = useMemo(() => transactions?.map((transaction) => transaction.transactionID), [transactions.length]); @@ -1045,7 +1046,7 @@ function IOURequestStepConfirmation({ 1 ? `${currentTransactionIndex + 1} ${translate('common.of')} ${transactions.length}` : undefined} + subtitle={hasMultipleTransactions ? `${currentTransactionIndex + 1} ${translate('common.of')} ${transactions.length}` : undefined} onBackButtonPress={navigateBack} shouldShowThreeDotsButton={shouldShowThreeDotsButton} threeDotsAnchorPosition={threeDotsAnchorPosition} @@ -1056,8 +1057,9 @@ function IOURequestStepConfirmation({ onSelected: navigateToAddReceipt, }, ]} + shouldDisplayHelpButton={!hasMultipleTransactions} > - {transactions.length > 1 ? ( + {hasMultipleTransactions ? ( @@ -881,6 +881,7 @@ function IOURequestStepScan({ titleStyles={styles.mb2} confirmText={translate('common.buttonConfirm')} description={translate('iou.scanMultipleReceiptsDescription')} + contentInnerContainerStyles={styles.mb6} shouldGoBack={false} /> )} diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 9aab6899acff..6c616d726970 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -920,7 +920,7 @@ function IOURequestStepScan({ height={16} width={16} src={Expensicons.Bolt} - fill={theme.white} + fill={isFlashLightOn ? theme.white : theme.icon} /> @@ -1011,6 +1011,7 @@ function IOURequestStepScan({ titleStyles={styles.mb2} confirmText={translate('common.buttonConfirm')} description={translate('iou.scanMultipleReceiptsDescription')} + contentInnerContainerStyles={styles.mb6} shouldGoBack={false} /> )} From 2d84562440990824765788a212ca95d48166770f Mon Sep 17 00:00:00 2001 From: VickyStash Date: Fri, 13 Jun 2025 14:15:24 +0200 Subject: [PATCH 19/24] Clear default transaction receipt when toggle multi scan --- src/pages/iou/request/step/IOURequestStepScan/index.native.tsx | 2 +- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index c97c42261f99..ff83effabdc4 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -751,9 +751,9 @@ function IOURequestStepScan({ setShouldShowMultiScanEducationalPopup(true); } if (isMultiScanEnabled) { - removeTransactionReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID); removeDraftTransactions(true); } + removeTransactionReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID); setIsMultiScanEnabled?.(!isMultiScanEnabled); }; diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 6c616d726970..ac6271852f84 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -769,9 +769,9 @@ function IOURequestStepScan({ setShouldShowMultiScanEducationalPopup(true); } if (isMultiScanEnabled) { - removeTransactionReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID); removeDraftTransactions(true); } + removeTransactionReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID); setIsMultiScanEnabled?.(!isMultiScanEnabled); }; From d5822d2fae9398e7744dd8831b10ae031a2ff1c8 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 16 Jun 2025 11:25:56 +0200 Subject: [PATCH 20/24] Fix filmstrip placeholders background 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 49de8dc6239b..4c1abca2062a 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -4064,7 +4064,7 @@ const styles = (theme: ThemeColors) => marginRight: 8, width: variables.w44, borderRadius: variables.componentBorderRadiusSmall, - backgroundColor: colors.productLight300, + backgroundColor: theme.hoverComponentBG, }, isDraggingOver: { From 2ab2d36a44a61bc52fea6053ec5f3d694735a53c Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 16 Jun 2025 12:01:42 +0200 Subject: [PATCH 21/24] Add missed translations --- src/languages/de.ts | 2 ++ src/languages/fr.ts | 2 ++ src/languages/it.ts | 2 ++ src/languages/ja.ts | 2 ++ src/languages/nl.ts | 2 ++ src/languages/pl.ts | 2 ++ src/languages/pt-BR.ts | 2 ++ src/languages/zh-hans.ts | 2 ++ 8 files changed, 16 insertions(+) diff --git a/src/languages/de.ts b/src/languages/de.ts index 16c97f560633..d81832236d38 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -64,6 +64,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -1020,6 +1021,7 @@ const translations = { share: 'Teilen', participants: 'Teilnehmer', createExpense: 'Ausgabe erstellen', + createExpenses: ({expensesNumber}: CreateExpensesParams) => `Erstelle ${expensesNumber} Ausgaben`, addExpense: 'Ausgabe hinzuf\u00FCgen', chooseRecipient: 'Empf\u00E4nger ausw\u00E4hlen', createExpenseWithAmount: ({amount}: {amount: string}) => `Erstelle ${amount} Ausgabe`, diff --git a/src/languages/fr.ts b/src/languages/fr.ts index d59978faeedf..0a7d1def6304 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -64,6 +64,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -1022,6 +1023,7 @@ const translations = { share: 'Partager', participants: 'Participants', createExpense: 'Cr\u00E9er une d\u00E9pense', + createExpenses: ({expensesNumber}: CreateExpensesParams) => `Cr\u00E9er ${expensesNumber} d\u00E9penses`, addExpense: 'Ajouter une d\u00E9pense', chooseRecipient: 'Choisir le destinataire', createExpenseWithAmount: ({amount}: {amount: string}) => `Cr\u00E9er une d\u00E9pense de ${amount}`, diff --git a/src/languages/it.ts b/src/languages/it.ts index 2d730f2384a1..8b7f37ba54ff 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -64,6 +64,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -1012,6 +1013,7 @@ const translations = { share: 'Condividi', participants: 'Partecipanti', createExpense: 'Crea spesa', + createExpenses: ({expensesNumber}: CreateExpensesParams) => `Crea ${expensesNumber} spese`, addExpense: 'Aggiungi spesa', chooseRecipient: 'Scegli destinatario', createExpenseWithAmount: ({amount}: {amount: string}) => `Crea ${amount} spesa`, diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 977749de540b..f1487c2b2b98 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -64,6 +64,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -1090,6 +1091,7 @@ const translations = { share: '\u5171\u6709\u3059\u308B', participants: '\u53C2\u52A0\u8005', createExpense: '\u7D4C\u8CBB\u3092\u4F5C\u6210', + createExpenses: ({expensesNumber}: CreateExpensesParams) => `\u7D4C\u8CBB\u3092${expensesNumber}\u4EF6\u4F5C\u6210`, addExpense: '\u7D4C\u8CBB\u3092\u8FFD\u52A0', chooseRecipient: '\u53D7\u53D6\u4EBA\u3092\u9078\u629E', createExpenseWithAmount: ({amount}: {amount: string}) => `${amount} \u306E\u7D4C\u8CBB\u3092\u4F5C\u6210`, diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 1fadda63c78a..15eb1ec1f5ed 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -64,6 +64,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -1010,6 +1011,7 @@ const translations = { share: 'Delen', participants: 'Deelnemers', createExpense: 'Uitgave aanmaken', + createExpenses: ({expensesNumber}: CreateExpensesParams) => `Maak ${expensesNumber} uitgaven aan`, addExpense: 'Uitgave toevoegen', chooseRecipient: 'Kies ontvanger', createExpenseWithAmount: ({amount}: {amount: string}) => `Maak ${amount} uitgave aan`, diff --git a/src/languages/pl.ts b/src/languages/pl.ts index 87fc0c62749e..56c729a50614 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -64,6 +64,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -1021,6 +1022,7 @@ const translations = { share: 'Udost\u0119pnij', participants: 'Uczestnicy', createExpense: 'Utw\u00F3rz wydatek', + createExpenses: ({expensesNumber}: CreateExpensesParams) => `Utw\u00F3rz ${expensesNumber} wydatki`, addExpense: 'Dodaj wydatek', chooseRecipient: 'Wybierz odbiorc\u0119', createExpenseWithAmount: ({amount}: {amount: string}) => `Utw\u00F3rz wydatek na kwot\u0119 ${amount}`, diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index e5d7af7a534f..8b77ef5b2768 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -64,6 +64,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -1016,6 +1017,7 @@ const translations = { share: 'Compartilhar', participants: 'Participantes', createExpense: 'Criar despesa', + createExpenses: ({expensesNumber}: CreateExpensesParams) => `Criar ${expensesNumber} despesas`, addExpense: 'Adicionar despesa', chooseRecipient: 'Escolher destinat\u00E1rio', createExpenseWithAmount: ({amount}: {amount: string}) => `Criar despesa de ${amount}`, diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index 5b5575466572..d37a54c42ba4 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -64,6 +64,7 @@ import type { ConfirmThatParams, ConnectionNameParams, ConnectionParams, + CreateExpensesParams, CurrencyCodeParams, CurrencyInputDisabledTextParams, CustomersOrJobsLabelParams, @@ -1033,6 +1034,7 @@ const translations = { share: '\u5206\u4EAB', participants: '\u53C2\u4E0E\u8005', createExpense: '\u521B\u5EFA\u62A5\u9500\u5355', + createExpenses: ({expensesNumber}: CreateExpensesParams) => `\u521B\u5EFA${expensesNumber}\u4E2A\u62A5\u9500\u5355`, addExpense: '\u6DFB\u52A0\u8D39\u7528', chooseRecipient: '\u9009\u62E9\u6536\u4EF6\u4EBA', createExpenseWithAmount: ({amount}: {amount: string}) => `\u521B\u5EFA ${amount} \u8D39\u7528`, From 731b196d8e83f8af53da56e5464f92b8613d07ff Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 16 Jun 2025 12:19:27 +0200 Subject: [PATCH 22/24] Disable tab swipe if user on the Scan page and the multi-scan is on --- src/pages/iou/request/IOURequestStartPage.tsx | 3 +-- .../step/IOURequestStepScan/ReceiptPreviews/index.tsx | 7 +------ .../iou/request/step/IOURequestStepScan/index.native.tsx | 2 -- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 2 -- src/pages/iou/request/step/IOURequestStepScan/types.ts | 3 --- 5 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 49f4b360f450..3989df91890c 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -207,7 +207,7 @@ function IOURequestStartPage({ shouldShowProductTrainingTooltip={shouldShowProductTrainingTooltip} renderProductTrainingTooltip={renderProductTrainingTooltip} lazyLoadEnabled - disableSwipe={isSwipeDisabled} + disableSwipe={isMultiScanEnabled && selectedTab === CONST.TAB_REQUEST.SCAN} > {() => ( @@ -229,7 +229,6 @@ function IOURequestStartPage({ onLayout={(setTestReceiptAndNavigate) => { setTestReceiptAndNavigateRef.current = setTestReceiptAndNavigate; }} - setTabSwipeDisabled={setSwipeDisabled} isMultiScanEnabled={isMultiScanEnabled} setIsMultiScanEnabled={setIsMultiScanEnabled} /> diff --git a/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx index af90e7373ca0..4bf746ffd6dd 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/ReceiptPreviews/index.tsx @@ -27,12 +27,9 @@ type ReceiptPreviewsProps = { /** If the receipts preview should be shown */ isMultiScanEnabled: boolean; - - /** Method to disable swipe between tabs */ - setTabSwipeDisabled?: (isDisabled: boolean) => void; }; -function ReceiptPreviews({submit, setTabSwipeDisabled, isMultiScanEnabled}: ReceiptPreviewsProps) { +function ReceiptPreviews({submit, isMultiScanEnabled}: ReceiptPreviewsProps) { const styles = useThemeStyles(); const theme = useTheme(); const {translate} = useLocalize(); @@ -128,8 +125,6 @@ function ReceiptPreviews({submit, setTabSwipeDisabled, isMultiScanEnabled}: Rece keyExtractor={(_, index) => index.toString()} renderItem={renderItem} getItemLayout={(data, index) => ({length: previewItemWidth, offset: previewItemWidth * index, index})} - onTouchStart={() => setTabSwipeDisabled?.(true)} - onTouchEnd={() => setTabSwipeDisabled?.(false)} style={styles.pv2} scrollEnabled={isScrollEnabled} showsHorizontalScrollIndicator={false} diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index ff83effabdc4..9ab62cba0f5c 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -88,7 +88,6 @@ function IOURequestStepScan({ transaction: initialTransaction, currentUserPersonalDetails, onLayout, - setTabSwipeDisabled, isMultiScanEnabled = false, setIsMultiScanEnabled, }: IOURequestStepScanProps) { @@ -962,7 +961,6 @@ function IOURequestStepScan({ )} diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index ac6271852f84..5d8510ee1fc1 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -95,7 +95,6 @@ function IOURequestStepScan({ transaction: initialTransaction, currentUserPersonalDetails, onLayout, - setTabSwipeDisabled, isMultiScanEnabled = false, setIsMultiScanEnabled, }: Omit) { @@ -1020,7 +1019,6 @@ function IOURequestStepScan({ )} diff --git a/src/pages/iou/request/step/IOURequestStepScan/types.ts b/src/pages/iou/request/step/IOURequestStepScan/types.ts index 903b447b5746..83176d8e05ac 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/types.ts +++ b/src/pages/iou/request/step/IOURequestStepScan/types.ts @@ -16,9 +16,6 @@ type IOURequestStepScanProps = WithCurrentUserPersonalDetailsProps & */ onLayout?: (setTestReceiptAndNavigate: () => void) => void; - /** Disable tab swipe */ - setTabSwipeDisabled?: (isDisabled: boolean) => void; - /** If the receipts preview should be shown */ isMultiScanEnabled?: boolean; From a62efaeead96c3bf80c1b2d1dda357db3043ab49 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Mon, 16 Jun 2025 12:27:10 +0200 Subject: [PATCH 23/24] Lint fix --- src/pages/iou/request/IOURequestStartPage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/iou/request/IOURequestStartPage.tsx b/src/pages/iou/request/IOURequestStartPage.tsx index 3989df91890c..37b9c3e61498 100644 --- a/src/pages/iou/request/IOURequestStartPage.tsx +++ b/src/pages/iou/request/IOURequestStartPage.tsx @@ -56,7 +56,6 @@ function IOURequestStartPage({ const isLoadingSelectedTab = shouldUseTab ? isLoadingOnyxValue(selectedTabResult) : false; const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${route?.params.transactionID}`, {canBeMissing: true}); const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false}); - const [isSwipeDisabled, setSwipeDisabled] = useState(false); const [optimisticTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, { selector: (items) => Object.values(items ?? {}), canBeMissing: true, From 3ad6e0f728f35029304f11e903c6bbdfec03cc02 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 17 Jun 2025 11:16:07 +0200 Subject: [PATCH 24/24] Revert "Update canUseMultiScan for UI testing" This reverts commit 0b99fda5813eaca02964125470bd7b42580e1089. --- src/pages/iou/request/step/IOURequestStepScan/index.native.tsx | 2 +- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 9ab62cba0f5c..5fe47973e939 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -104,7 +104,7 @@ function IOURequestStepScan({ const [flash, setFlash] = useState(false); // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; - const canUseMultiScan = true && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; + const canUseMultiScan = false; const [startLocationPermissionFlow, setStartLocationPermissionFlow] = useState(false); const [receiptFiles, setReceiptFiles] = useState([]); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`, {canBeMissing: true}); diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 5d8510ee1fc1..83b95aadf1d3 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -135,7 +135,7 @@ function IOURequestStepScan({ const isEditing = action === CONST.IOU.ACTION.EDIT; // TODO: use correct canUseMultiScan value when all multi-scan functionality is implemented // const canUseMultiScan = isBetaEnabled(CONST.BETAS.NEWDOT_MULTI_SCAN) && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; - const canUseMultiScan = true && !isEditing && iouType !== CONST.IOU.TYPE.SPLIT && !backTo && !backToReport; + const canUseMultiScan = false; const [optimisticTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, { selector: (items) => Object.values(items ?? {}),