Toggle component Type error
See original GitHub issueHey Claudio! I’ve got one for ya 😃
I’m using your mobx-react-form nested fields Demo, in rfx-stack. I added more fields to the members[].hobbies[] nested field.
The problem is the field type is not being detected as Boolean unless I set a value for that field. Since it is nested, and I can add more fields, as soon as I click +
to add a fieldset with the Toggle element, I get props errors because mobx-react-form sets the value as a blank string, instead of false. And thus when I click the Toggle it does not work or set correct value from form state.
Warning: Failed prop type: Invalid prop
switched
of typestring
supplied toEnhancedSwitch
, expectedboolean
.
The documentation only mentions in using Separated Properties method of initializing fields I can pass in a defaults
and types
, but without any example of formatting I am lost. I tried using members[].hobbies[]
formatting and also as a nested object, with no luck. I wish to use Boolean for the checkbox value as material-ui requires, so that I may also align the type with my feathers/mongoose API schema as Boolean also.
I hope I am making sense! I can show example code or repo if you need.
Rich
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (9 by maintainers)
Top GitHub Comments
Yesss you rock!!!
No bother! Hope this fix should work. Let me know if you encounter other issues.