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

onChange is fired when the input is completed and keeping typing

Open chumakoff opened this issue 8 years ago • 2 comments

When the input (mask) is completed and you are keeping typing, onChange event is triggered. It shuldn't, because the actual value is not changing.

chumakoff avatar Jan 08 '18 16:01 chumakoff

Что до сих пор нет ответа ?? 😑

DaniilKZ avatar Mar 14 '23 13:03 DaniilKZ

Решил таким вот способом:

  const completeChange = (e: any) => {
    if (e.target.value.replace(/\D/g, "").length == 11) {
      e.preventDefault();
      return false;
    }
  }; 
<TextField
                  onKeyDown={(e: any) => {
                    completeChange(e)
                  }}

DaniilKZ avatar Mar 14 '23 14:03 DaniilKZ