sanniassin / react-input-mask

Input masking component for React. Made with attention to UX.
MIT License
2.22k stars 258 forks source link

beforeMaskStateChange demo not working #219

Open davidrhoderick opened 4 years ago

davidrhoderick commented 4 years ago

I'm using react 16.6.1 and input mask 2.0.4 and when I just copy and past the beforeMaskStateChange demo code from the tutorial to my project, nothing happens. Is the function working correctly? Do I need to upgrade my versions?

GarethChetwood commented 4 years ago

It's quite confusing but the name from v2 is: beforeMaskedValueChange

beforeMaskedValueChange.

brunayfy commented 4 years ago

Its not working for me either.

myang5 commented 2 years ago

I haven't found a replacement library yet lol so here's the basic callback signature if anyone needs it:

// incomingValue refers to the raw value being added to the input
const beforeMaskedValueChange = (previousState, currentState, incomingValue, mask) => {

  // Return value needs to have at least this shape:
  return { value: null, selection: { start: null, end: null } };
};