Open guilhermemigliano opened 2 years ago
@guilhermemigliano you can try using the createNumberMask
to create your own custom mask...
Something like that (not tested, just an idea):
<MaskInput
...
mask={(text) => {
const numberPrefix = ['R', '$', ' '];
const isNegative = text?.includes('-');
if (isNegative) {
numberPrefix.push('-');
}
return createNumberMask({
prefix: numberPrefix,
separator: ',',
delimiter: '.',
precision: 2,
})(text); // typescript will complain, I need to fix that
}}
...
/>
Also, you may want to see this: https://github.com/CaioQuirinoMedeiros/react-native-currency-input
Is there any way to use the Masks.BRL_CURRENCY for negative and positve values?