Closed rodrigomoraes closed 1 year ago
No. You should try https://github.com/CaioQuirinoMedeiros/react-native-currency-input
Oh, i didn't know about this solution... Anyway i do this to solve my problem
const formatAmountToCents = (value: any) => {
const amountFormated = (value / 100).toFixed(2).replace(".", "");
return amountFormated;
};
<MaskInput
placeholder="R$ 0,00"
mask={Masks.BRL_CURRENCY}
value={formatAmountToCents(amount)}
onChangeText={(masked, unmasked) => {
setAmount(unmasked);
}}
/>
And It Works! But i thank you to show me the real solution...
Have anyway to use Masks.BRL_CURRENCY begin in Centavos and not in Real? Actually if we type 1, it format to R$ 1, in my case should be R$ 0,01