From 347ccf181128321521bcdac4aaa2668b2206cabe Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 11 Aug 2023 18:04:32 +0200 Subject: [PATCH] fix: restore selectedAmountAsString --- src/pages/iou/steps/MoneyRequestAmountForm.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestAmountForm.js b/src/pages/iou/steps/MoneyRequestAmountForm.js index 36a98c6117dd..2a120a5c27ed 100644 --- a/src/pages/iou/steps/MoneyRequestAmountForm.js +++ b/src/pages/iou/steps/MoneyRequestAmountForm.js @@ -62,12 +62,14 @@ function MoneyRequestAmountForm({amount, currency, isEditing, forwardedRef, onCu const textInput = useRef(null); - const [currentAmount, setCurrentAmount] = useState(''); + const selectedAmountAsString = amount ? CurrencyUtils.convertToWholeUnit(currency, amount).toString() : ''; + + const [currentAmount, setCurrentAmount] = useState(selectedAmountAsString); const [shouldUpdateSelection, setShouldUpdateSelection] = useState(true); const [selection, setSelection] = useState({ - start: 0, - end: 0, + start: selectedAmountAsString.length, + end: selectedAmountAsString.length, }); /**