bhrott / react-native-masked-text

A pure javascript masked text and input text component for React-Native.
MIT License
1.6k stars 251 forks source link

I can't get pasted value in input #166

Open leozzitowned opened 5 years ago

leozzitowned commented 5 years ago

I have an input with the following code:

const onChangeText = (value) => {
  console.log(value);
};

<Input type="custom" onChange={onChangeText} options={{ mask: '9999' }} />

When I try to paste a content bigger than the mask (e.g. 12345), there is no way to get the whole content with onChangeText. I need to apply a different mask when the content.length > 4.

Is there some way to accomplish this behavior?

bhrott commented 5 years ago

Hi @leozzitowned !

Sorry, but this is an issue in react-native text input: https://github.com/facebook/react-native/issues/18926

I will check if exist some way to check and update the mask when the user pasted a value.

Thanks for reporting!

simistern commented 2 years ago

Just checking as well if there is potential to do this? We need to update mask when the content.length > 16, but this cuts off the masked value when copy-pasted in