Skip to content

Commit

Permalink
fix(createTextMask): fixes onCompletePattern and onChange not being c…
Browse files Browse the repository at this point in the history
…alled sometimes

fixes #28 and #25
  • Loading branch information
renato-bohler committed May 8, 2018
1 parent 5dfc013 commit 5081b55
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/createTextMask.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ export default options => {
const formattedValue = format(transformedValue, true);
const newValue = stripMask ? transformedValue : formattedValue;
const hasValueChanged =
transformedValue !== previousValue && previousValue !== undefined;
transformedValue !== previousValue &&
(transformedValue !== '' || previousValue !== undefined);

// We call `onChange` if it was set and if the value actually changed
if (onChange && hasValueChanged) {
Expand Down

0 comments on commit 5081b55

Please sign in to comment.