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

MuiCheckbox checked value should be boolean #1412

Closed
clayroach opened this issue Jun 21, 2019 · 1 comment · Fixed by #1419
Closed

MuiCheckbox checked value should be boolean #1412

clayroach opened this issue Jun 21, 2019 · 1 comment · Fixed by #1419

Comments

@clayroach
Copy link
Contributor

<Checkbox checked={data || ''} ... results in a type error when data is undefined.

Exception:

Warning: Failed prop type: Invalid prop `checked` of type `string` supplied to `ForwardRef(SwitchBase)`, expected `boolean`.
    in ForwardRef(SwitchBase) (created by Context.Consumer)
    in WithFormControlContext(ForwardRef(SwitchBase)) (created by WithStyles(WithFormControlContext(ForwardRef(SwitchBase))))
    in WithStyles(WithFormControlContext(ForwardRef(SwitchBase))) (created by ForwardRef(Checkbox))
    in ForwardRef(Checkbox) (created by WithStyles(ForwardRef(Checkbox)))

Should be:
<Checkbox checked={data} ...
... or an explicit check for undefined on values of data that are not boolean.

@edgarmueller
Copy link
Contributor

Thanks for the report! We'll address this for 2.3.0

edgarmueller added a commit to edgarmueller/jsonforms that referenced this issue Jul 2, 2019
edgarmueller added a commit to edgarmueller/jsonforms that referenced this issue Jul 2, 2019
Use double bang to convert undefined values to false.
Rename 2nd parameter in onChange to avoid name shadowing.

Fixes eclipsesource#1412
eneufeld pushed a commit that referenced this issue Jul 2, 2019
Use double bang to convert undefined values to false.
Rename 2nd parameter in onChange to avoid name shadowing.

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

Successfully merging a pull request may close this issue.

2 participants