react-native-masked-text icon indicating copy to clipboard operation
react-native-masked-text copied to clipboard

Mask type not supported

Open TheAkinator opened this issue 4 years ago • 5 comments

I'm trying to call TextInputMask inside a global component, but I got this error every time:

image

here is my code:

function Input({ style, icon, ...rest }, ref) {
  return (
    <Container style={style}>
      {icon && <Icon name={icon} size={20} color="rgba(255, 255, 255, 0.6)" />}
      <TextInputMask {...rest} ref={ref} />
    </Container>
  );
}

I've already tried to call it directly inside my View component and it worked, but inside a global one, it doesn't

TheAkinator avatar Aug 27 '19 15:08 TheAkinator

Hi @raulmo1337 could you add a print of the ...rest data? I'm thinking you are trying to pass an invalid prop to the input.

bhrott avatar Aug 27 '19 15:08 bhrott

Hi @benhurott. here is the ...rest data:

{
  "type": "cel-phone",
  "options": {
    "maskType": "BRL",
    "withDDD": true,
    "dddMask": "(99) "
  },
  "placeholder": "phone",
  "keyboardType": "phone-pad",
  "returnKeyType": "next",
  "onSubmitEditing": " onSubmitEditing() ",
  "value": "",
  "onChangeText": " bound dispatchAction() "
}

I don't think this is the problem, because even when no params are passed to the component it still showing this error

TheAkinator avatar Aug 28 '19 01:08 TheAkinator

I've changed the "function Input({ style, icon, ...rest }, ref)" to function Input({ style, type, options , icon, ...rest }, ref). I put this props separeted like this: <TextInputMask {...rest} ref={ref} style={styles.TextInput} placeholderTextColor="#FFF" type={type} options={options} /> And it worked quite well to me.

lucascicco avatar Aug 21 '20 14:08 lucascicco

Adding type="custom" e.g <TextInputMask {...props} type="custom" options={{ mask: phoneMask }} /> worked for me.

deyanskiq avatar Oct 28 '20 12:10 deyanskiq

Hello guys, my problem was because I did not enter the "type" property in the next screen component that also has a mask

dededavida avatar Mar 05 '21 14:03 dededavida