Open patricklongo1 opened 4 years ago
use also value={price}
Full example:
<CurrencyInput decimalSeparator="," thousandSeparator="." precision="2" suffix=" €"
value={price}
selectAllOnFocus
onChange={(_, val) => setPrice(val)}/>
use also
value={price}
Full example:
<CurrencyInput decimalSeparator="," thousandSeparator="." precision="2" suffix=" €" value={price} selectAllOnFocus onChange={(_, val) => setPrice(val)}/>
Tks man! Its worked for me!
Still not working for me, do you any comment? Thanks
Still not working for me, do you any comment? Thanks
My full code for this lib: https://github.com/patricklongo1/gympoint-web/blob/master/src/pages/PlanRegister/index.js
@important: import CurrencyInput from 'react-currency-input'; const [priceMonth, setPriceMonth] = useState('');
function handleInput(floatvalue) { setPriceMonth(floatvalue); }
return ( < div > < span >PREÇO MENSAL< /span > < CurrencyInput thousandSeparator="." decimalSeparator="," precision="2" prefix="R$ " value={priceMonth} selectAllOnFocus onChange={(_, floatvalue) => handleInput(floatvalue)} / > < /div > )
Hope its help u!
Thank so much!, I will try it 👍
if u try use hooks.. its do not works.
Ex: const [price, setPrice] = useState('');
<CurrencyInput decimalSeparator="," thousandSeparator="." prefix="R$ " onChangeEvent={(event, maskedvalue, floatvalue) => setPrice(floatvalue) } />
the input keep reseting... can someone try fix this?