From 78d8b207dcd611ef49007b9288cdb4e329d42486 Mon Sep 17 00:00:00 2001 From: Sam Hariri <137707942+samh-nl@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:23:13 +0200 Subject: [PATCH] fix: use stripped amount for new selection --- src/pages/iou/steps/MoneyRequestAmountForm.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestAmountForm.js b/src/pages/iou/steps/MoneyRequestAmountForm.js index 7178ed0e0158..b176efa70887 100644 --- a/src/pages/iou/steps/MoneyRequestAmountForm.js +++ b/src/pages/iou/steps/MoneyRequestAmountForm.js @@ -132,8 +132,9 @@ function MoneyRequestAmountForm({amount, currency, isEditing, forwardedRef, onCu return; } setCurrentAmount((prevAmount) => { - setSelection((prevSelection) => getNewSelection(prevSelection, prevAmount.length, newAmountWithoutSpaces.length)); - return MoneyRequestUtils.stripCommaFromAmount(newAmountWithoutSpaces); + const strippedAmount = MoneyRequestUtils.stripCommaFromAmount(newAmountWithoutSpaces); + setSelection((prevSelection) => getNewSelection(prevSelection, prevAmount.length, strippedAmount.length)); + return strippedAmount; }); };