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

NumberInput: Initial value cannot be empty string due to PropTypes #4996

Closed
2 tasks done
richardpilot opened this issue Jan 10, 2020 · 1 comment · Fixed by #5217
Closed
2 tasks done

NumberInput: Initial value cannot be empty string due to PropTypes #4996

richardpilot opened this issue Jan 10, 2020 · 1 comment · Fixed by #5217

Comments

@richardpilot
Copy link

richardpilot commented Jan 10, 2020

NumberInput: Initial value cannot be empty string due to PropTypes

What package(s) are you using?

  • carbon-components
  • carbon-components-react

Detailed description

PropTypes for both value and defaultValue are set to Number so you cannot have it's initial value as an empty string despite the allowEmpty property. The following is logged to the console:

Warning: Failed prop type: Invalid prop valueof typestring supplied to 'NumberInput', expected 'number'.

Additional information

https://codesandbox.io/s/pensive-dhawan-wh9vs

@jendowns
Copy link
Contributor

jendowns commented Jan 10, 2020

Proposed a fix for this here: #5004

UPDATE: Going to defer to @abbeyhrt instead 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants