From 19cdfba0d997d5269543e01019524318aed68fd6 Mon Sep 17 00:00:00 2001 From: GCyganek Date: Thu, 6 Nov 2025 11:28:17 +0100 Subject: [PATCH 1/2] Fix passing gpsPoints to requestMoney and trackExpense --- src/libs/actions/IOU.ts | 14 +++++++------- src/pages/Share/SubmitDetailsPage.tsx | 4 ++-- .../request/step/IOURequestStepConfirmation.tsx | 8 ++++---- .../step/IOURequestStepScan/index.native.tsx | 10 +++++----- .../iou/request/step/IOURequestStepScan/index.tsx | 10 +++++----- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index f152c366065d7..bbacdb428756a 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -483,7 +483,7 @@ type RequestMoneyInformation = { report: OnyxEntry; participantParams: RequestMoneyParticipantParams; policyParams?: BasePolicyParams; - gpsPoints?: GPSPoint; + gpsPoint?: GPSPoint; action?: IOUAction; transactionParams: RequestMoneyTransactionParams; isRetry?: boolean; @@ -607,7 +607,7 @@ type TrackExpenseTransactionParams = { billable?: boolean; reimbursable?: boolean; validWaypoints?: WaypointCollection; - gpsPoints?: GPSPoint; + gpsPoint?: GPSPoint; actionableWhisperReportActionID?: string; linkedTrackedExpenseReportAction?: OnyxTypes.ReportAction; linkedTrackedExpenseReportID?: string; @@ -5865,7 +5865,7 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { participantParams, policyParams = {}, transactionParams, - gpsPoints, + gpsPoint, action, shouldHandleNavigation = true, backToReport, @@ -6056,7 +6056,7 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { taxAmount, billable, // This needs to be a string of JSON because of limitations with the fetch() API and nested objects - receiptGpsPoints: gpsPoints ? JSON.stringify(gpsPoints) : undefined, + receiptGpsPoints: gpsPoint ? JSON.stringify(gpsPoint) : undefined, transactionThreadReportID, createdReportActionIDForThread, reimbursable, @@ -6300,7 +6300,7 @@ function trackExpense(params: CreateTrackExpenseParams) { taxAmount = 0, billable, reimbursable, - gpsPoints, + gpsPoint, validWaypoints, actionableWhisperReportActionID, linkedTrackedExpenseReportAction, @@ -6341,7 +6341,7 @@ function trackExpense(params: CreateTrackExpenseParams) { taxAmount, billable, validWaypoints, - gpsPoints, + gpsPoint, actionableWhisperReportActionID, linkedTrackedExpenseReportAction, linkedTrackedExpenseReportID, @@ -6548,7 +6548,7 @@ function trackExpense(params: CreateTrackExpenseParams) { taxAmount, billable, // This needs to be a string of JSON because of limitations with the fetch() API and nested objects - receiptGpsPoints: gpsPoints ? JSON.stringify(gpsPoints) : undefined, + receiptGpsPoints: gpsPoint ? JSON.stringify(gpsPoint) : undefined, transactionThreadReportID, createdReportActionIDForThread, waypoints: sanitizedWaypoints, diff --git a/src/pages/Share/SubmitDetailsPage.tsx b/src/pages/Share/SubmitDetailsPage.tsx index 6e7cb02c3ee36..5b7fdf4dc83de 100644 --- a/src/pages/Share/SubmitDetailsPage.tsx +++ b/src/pages/Share/SubmitDetailsPage.tsx @@ -103,7 +103,7 @@ function SubmitDetailsPage({ const defaultTaxCode = getDefaultTaxCode(policy, transaction); const transactionTaxCode = (transaction?.taxCode ? transaction?.taxCode : defaultTaxCode) ?? ''; - const finishRequestAndNavigate = (participant: Participant, receipt: Receipt, gpsPoints?: GpsPoint) => { + const finishRequestAndNavigate = (participant: Participant, receipt: Receipt, gpsPoint?: GpsPoint) => { if (!transaction) { return; } @@ -139,7 +139,7 @@ function SubmitDetailsPage({ report, participantParams: {payeeEmail: currentUserPersonalDetails.login, payeeAccountID: currentUserPersonalDetails.accountID, participant}, policyParams: {policy, policyTagList: policyTags, policyCategories, policyRecentlyUsedCategories}, - gpsPoints, + gpsPoint, action: CONST.IOU.TYPE.CREATE, transactionParams: { attendees: transaction.comment?.attendees, diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index ffe8194ea8115..3eaf272b23331 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -504,7 +504,7 @@ function IOURequestStepConfirmation({ }, [requestType, iouType, initialTransactionID, reportID, action, report, transactions, participants]); const requestMoney = useCallback( - (selectedParticipants: Participant[], gpsPoints?: GpsPoint) => { + (selectedParticipants: Participant[], gpsPoint?: GpsPoint) => { if (!transactions.length) { return; } @@ -547,7 +547,7 @@ function IOURequestStepConfirmation({ policyCategories, policyRecentlyUsedCategories, }, - gpsPoints, + gpsPoint, action, transactionParams: { amount: isTestReceipt ? CONST.TEST_RECEIPT.AMOUNT : item.amount, @@ -645,7 +645,7 @@ function IOURequestStepConfirmation({ ); const trackExpense = useCallback( - (selectedParticipants: Participant[], gpsPoints?: GpsPoint) => { + (selectedParticipants: Participant[], gpsPoint?: GpsPoint) => { if (!transactions.length) { return; } @@ -685,7 +685,7 @@ function IOURequestStepConfirmation({ taxAmount: transactionTaxAmount, billable: item.billable, reimbursable: item.reimbursable, - gpsPoints, + gpsPoint, validWaypoints: Object.keys(item?.comment?.waypoints ?? {}).length ? getValidWaypoints(item.comment?.waypoints, true) : undefined, actionableWhisperReportActionID: item.actionableWhisperReportActionID, linkedTrackedExpenseReportAction: item.linkedTrackedExpenseReportAction, diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index ea40766057abe..eaa8dd4c94e1b 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -300,7 +300,7 @@ function IOURequestStepScan({ ( files: ReceiptFile[], participant: Participant, - gpsPoints?: GpsPoint, + gpsPoint?: GpsPoint, policyParams?: { policy: OnyxEntry; }, @@ -328,7 +328,7 @@ function IOURequestStepScan({ receipt, billable, reimbursable, - ...(gpsPoints ?? {}), + gpsPoint, }, ...(policyParams ?? {}), shouldHandleNavigation: index === files.length - 1, @@ -342,7 +342,7 @@ function IOURequestStepScan({ participant, }, ...(policyParams ?? {}), - ...(gpsPoints ?? {}), + gpsPoint, transactionParams: { amount: 0, attendees: transaction?.comment?.attendees, @@ -432,11 +432,11 @@ function IOURequestStepScan({ getCurrentPosition( (successData) => { const policyParams = {policy}; - const gpsPoints = { + const gpsPoint = { lat: successData.coords.latitude, long: successData.coords.longitude, }; - createTransaction(files, participant, gpsPoints, policyParams, false); + createTransaction(files, participant, gpsPoint, policyParams, false); }, (errorData) => { Log.info('[IOURequestStepScan] getCurrentPosition failed', false, errorData); diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 329a3203aecc2..215e8264515e1 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -360,7 +360,7 @@ function IOURequestStepScan({ ( files: ReceiptFile[], participant: Participant, - gpsPoints?: GpsPoint, + gpsPoint?: GpsPoint, policyParams?: { policy: OnyxEntry; }, @@ -388,7 +388,7 @@ function IOURequestStepScan({ receipt, billable, reimbursable, - ...(gpsPoints ?? {}), + gpsPoint, }, ...(policyParams ?? {}), shouldHandleNavigation: index === files.length - 1, @@ -402,7 +402,7 @@ function IOURequestStepScan({ participant, }, ...(policyParams ?? {}), - ...(gpsPoints ?? {}), + gpsPoint, transactionParams: { amount: 0, attendees: transaction?.comment?.attendees, @@ -493,11 +493,11 @@ function IOURequestStepScan({ getCurrentPosition( (successData) => { const policyParams = {policy}; - const gpsPoints = { + const gpsPoint = { lat: successData.coords.latitude, long: successData.coords.longitude, }; - createTransaction(files, participant, gpsPoints, policyParams, false, true); + createTransaction(files, participant, gpsPoint, policyParams, false, true); }, (errorData) => { Log.info('[IOURequestStepScan] getCurrentPosition failed', false, errorData); From a52efddc81e2d9d0ce7013aa5aa24a4d2ba1e63d Mon Sep 17 00:00:00 2001 From: GCyganek Date: Thu, 6 Nov 2025 11:43:22 +0100 Subject: [PATCH 2/2] runOnJS => scheduleOnRN --- .../iou/request/step/IOURequestStepScan/index.native.tsx | 5 +++-- 1 file changed, 3 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 eaa8dd4c94e1b..2e039bd2ee1f3 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -8,9 +8,10 @@ import ReactNativeBlobUtil from 'react-native-blob-util'; import {Gesture, GestureDetector} from 'react-native-gesture-handler'; import type {OnyxEntry} from 'react-native-onyx'; import {RESULTS} from 'react-native-permissions'; -import Animated, {runOnJS, useAnimatedStyle, useSharedValue, withDelay, withSequence, withSpring, withTiming} from 'react-native-reanimated'; +import Animated, {useAnimatedStyle, useSharedValue, withDelay, withSequence, withSpring, withTiming} from 'react-native-reanimated'; import type {Camera, PhotoFile, Point} from 'react-native-vision-camera'; import {useCameraDevice} from 'react-native-vision-camera'; +import {scheduleOnRN} from 'react-native-worklets'; import MultiScan from '@assets/images/educational-illustration__multi-scan.svg'; import TestReceipt from '@assets/images/fake-receipt.png'; import Hand from '@assets/images/hand.svg'; @@ -227,7 +228,7 @@ function IOURequestStepScan({ focusIndicatorScale.set(withSpring(1, {damping: 10, stiffness: 200})); focusIndicatorPosition.set(point); - runOnJS(focusCamera)(point); + scheduleOnRN(focusCamera, point); }); useFocusEffect(