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

Dropdown value/defaultValue boolean #2564

Closed
DennisKo opened this issue Feb 23, 2018 · 5 comments
Closed

Dropdown value/defaultValue boolean #2564

DennisKo opened this issue Feb 23, 2018 · 5 comments
Labels

Comments

@DennisKo
Copy link
Contributor

DennisKo commented Feb 23, 2018

Steps

Have a Dropdown with following possible options for value/defaultValue:

const options = [
  { key: 1, text: 'Yes', value: true },
  { key: 2, text: 'No', value: false }
]

Expected Result

It should show no warning.

Actual Result

It shows a warning Warning: Failed prop type: Invalid prop value supplied to Dropdown.

Version

0.78.2

Testcase

https://codesandbox.io/s/9qoymkzqp4

@GCrispino
Copy link
Contributor

As you can see here, the type of value can either be a string, a number, or an array of one of these types.
I wouldn't know why boolean can't be a possible value for this prop, but there's probably a reason.

@DennisKo
Copy link
Contributor Author

DennisKo commented Feb 23, 2018

I saw this file and I googled a bit but could not find a valid reason for no boolean... Maybe anyone from the core team knows better?

@GCrispino
Copy link
Contributor

I see... let’s wait for the maintainers, they should know something about it

@levithomason
Copy link
Member

levithomason commented Feb 25, 2018

This is due to an old artifact, a hidden select element. See #2572 for the fix.

Note, this is just a warning and can be safely ignored in your app for now. We'll merge and ship the fix soon to rid the nuisance.

@DennisKo
Copy link
Contributor Author

DennisKo commented Feb 26, 2018

Sorry to comment on a closed issue and thanks for the quick fix but

Note, this is just a warning and can be safely ignored in your app for now. We'll merge and ship the fix soon to rid the nuisance.

A member of the react core team and creator of CRA/Redux wants to move the community to a different approach: facebook/react#10633

In React we intentionally rely on warnings treated as errors by the user. In fact at Facebook we show a modal dialog for each warning and we may enable the same behaviour in the open source version in the future.

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

No branches or pull requests

3 participants