Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect value returned by onValueChange when using empty string mask and number in the format #879

Open
1 of 6 tasks
VanemalP opened this issue Jan 20, 2025 · 0 comments

Comments

@VanemalP
Copy link

Describe the issue and the actual behavior

When mask is empty string and the format prop includes a number (e.g. +359 ### ### ###), onValueChange callback returns an incorrect value. Instead of only reflecting the user's input, the returned value also includes the static number from the format prop.

Describe the expected behavior

the onInputChange callback should return as value only the user's input, without including the static number from the format prop.

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/p/sandbox/react-number-format-empty-string-mask-28528j

Provide steps to reproduce this issue

  1. Open the provided CodeSandbox link
  2. Enter any number into the input field.
  3. Observe that the value returned by onInputValueChange includes the static number from the format prop, rather than just the user's input.

Please check the browsers where the issue is seen

  • Chrome
  • Chrome (Android)
  • Safari (OSX)
  • Safari (iOS)
  • Firefox
  • Firefox (Android)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant