react-native-masked-text
react-native-masked-text copied to clipboard
Currency not well formatted
If I type slowly, I don't have any issue.
However, if I type fast, I always get the error as shown in the picture.
I have tested in both android & iOS. I am using the following code
<TextInputMask
type={'money'}
options={{
precision: 2,
separator: '.',
delimiter: ',',
unit: 'RM',
suffixUnit: ''
}}
value={allPrice}
includeRawValueInChangeText={true}
onChangeText={(maskedText, rawText) => {
this.setState({
allPrice: maskedText,
allPriceRaw:rawText
});
}}
style={inFileStyles.allPriceInput}
placeholder={ lang.price }
/>
I have the exact same issue
@mjm918 did you find a solution?
Same issue here. Any solution for that?
I don't use their textinputmask anymore but yeah i still use their mask service and set the value in textinput. this library seems to be dead
@mjm918 I solved this issue using the following workaround:
onChangeText={(maskedText, rawText) => {
// Add this line
maskedText = parseInt(maskedText.replace(/\.|,|RM/g, ""), 10) / 100;
this.setState({
allPrice: maskedText,
allPriceRaw: rawText,
});
}}