react-number-format
react-number-format copied to clipboard
Incorrect value returned by `onValueChange` when using empty string `mask` and number in the `format`
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
- Open the provided CodeSandbox link
- Enter any number into the input field.
- Observe that the value returned by
onInputValueChangeincludes the static number from theformatprop, rather than just the user's input.
Please check the browsers where the issue is seen
- [x] Chrome
- [ ] Chrome (Android)
- [ ] Safari (OSX)
- [ ] Safari (iOS)
- [ ] Firefox
- [ ] Firefox (Android)