sanniassin/react-input-mask

Given example program not working

mk48 opened this issue · 2 comments

mk48 commented

The given example in the Readme.md file seems not working.
I have included a code sandbox link.

Below is the document example
image

Code sandbox screen
image

Full code

import React, { useState } from "react";
import InputMask from "react-input-mask";

const firstLetter = /(?!.*[DFIOQU])[A-VXY]/i;
const letter = /(?!.*[DFIOQU])[A-Z]/i;
const digit = /[0-9]/;
const msk = [firstLetter, digit, letter, " ", digit, letter, digit];

const Txt = () => {
  const [value, setValue] = useState<string>("");
  const onChange = (e: any) => {
    setValue(e.target.value);
    //console.log(e);
  };
  return (
    <InputMask
      mask={msk}
      onChange={onChange}
      value={value}
      alwaysShowMask={true}
    />
  );
};

export default Txt;

Code sandbox link
https://codesandbox.io/s/input-mask-uwduh?file=/src/Txt.tsx:0-575

Am I missing anything?

It only works with the version 3.0.0-alpha.0, consider checking your version

mk48 commented

Thanks, it's working in the 3.0.0-alpha.0