useMaskedInputProps should pass unmasked as second parameter to onChangeText
Closed this issue · 2 comments
asfandyarsheikh commented
The mask is only for show and there should be another parameter called unmasked that passes unformatted, raw text to the function. The raw value should also be converted to masked one.
import { Input } from 'native-base'
import { Masks } from 'react-native-mask-input';
function MyComponent() {
const [phone, setPhone] = React.useState('');
const maskedInputProps = useMaskedInputProps({
value: phone, // <------ This should be unmasked value and should be converted by hook to masked
onChangeText: setPhone, // <---------------- This should also pass unmasked value as second parameter
mask: Masks.BRL_PHONE,
});
return <Input {...maskedInputProps} />
}
robbporto commented
This was already implemented, @asfandyarsheikh.
CaioQuirinoMedeiros commented
This is working correctly, the value can be masked or unmasked and the function does receive unmasked value as second parameter (also receive obfuscated value as third parameter)