Skip to content

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

@VanemalP

Description

@VanemalP

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions