react-input-mask icon indicating copy to clipboard operation
react-input-mask copied to clipboard

beforeMaskStateChange demo not working

Open davidrhoderick opened this issue 5 years ago • 3 comments

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?

davidrhoderick avatar Jun 24 '20 12:06 davidrhoderick

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

beforeMaskedValueChange.

GarethChetwood avatar Aug 15 '20 20:08 GarethChetwood

Its not working for me either.

brunayfy avatar Sep 11 '20 21:09 brunayfy

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 } };
};

myang5 avatar Nov 11 '21 02:11 myang5