From 27cbcafa153ba410ffb653f1d6c8da49bdea27ac Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Wed, 16 Oct 2024 22:00:49 +0300 Subject: [PATCH] fix wrong taxAmount calculation on distanceRate change --- src/languages/params.ts | 2 +- src/pages/iou/request/step/IOURequestStepDistanceRate.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/languages/params.ts b/src/languages/params.ts index f787e630ab0d..0efca1e4e421 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -279,7 +279,7 @@ type LogSizeAndDateParams = {size: number; date: string}; type HeldRequestParams = {comment: string}; -type ReimbursementRateParams = {unit: Unit}; +type ReimbursementRateParams = {unit: string}; type ChangeFieldParams = {oldValue?: string; newValue: string; fieldName: string}; diff --git a/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx b/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx index 9bee2df17ef0..d4eb10c50671 100644 --- a/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx @@ -73,7 +73,8 @@ function IOURequestStepDistanceRate({ }; }); - const unit = (Object.values(rates).at(0)?.unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.mile') : translate('common.kilometer')) as Unit; + const unit = Object.values(rates).at(0)?.unit; + const unitToDisplay = unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.mile') : translate('common.kilometer'); const initiallyFocusedOption = sections.find((item) => item.isSelected)?.keyForList; @@ -108,7 +109,7 @@ function IOURequestStepDistanceRate({ shouldShowWrapper testID={IOURequestStepDistanceRate.displayName} > - {translate('iou.chooseARate', {unit})} + {translate('iou.chooseARate', {unit: unitToDisplay})}