diff --git a/src/components/TextInputWithCurrencySymbol.js b/src/components/TextInputWithCurrencySymbol.js index f6f2014b50b3..ef3fc3a1464a 100644 --- a/src/components/TextInputWithCurrencySymbol.js +++ b/src/components/TextInputWithCurrencySymbol.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useState, useEffect} from 'react'; import PropTypes from 'prop-types'; import AmountTextInput from './AmountTextInput'; import CurrencySymbolButton from './CurrencySymbolButton'; @@ -45,6 +45,12 @@ function TextInputWithCurrencySymbol(props) { const currencySymbol = CurrencyUtils.getLocalizedCurrencySymbol(props.selectedCurrencyCode); const isCurrencySymbolLTR = CurrencyUtils.isCurrencySymbolLTR(props.selectedCurrencyCode); + const [skipNextSelectionChange, setSkipNextSelectionChange] = useState(false); + + useEffect(() => { + setSkipNextSelectionChange(true); + }, [props.formattedAmount]); + const currencySymbolButton = ( { + if (skipNextSelectionChange) { + setSkipNextSelectionChange(false); + return; + } + props.onSelectionChange(e); + }} /> );