Closed giq-re closed 4 years ago
I think the problem is when the Switch component is getting its initialValue.
const initialState = values[name]
As you can see if name is subobject path or an array reference, it won't work. Some additional logic is needed to get the initial value in case the name prop is a path or an array ref.
Does this comment help? https://github.com/gerhat/material-ui-formik-components/issues/27#issuecomment-622871557
The switch component - and i imagine the other of boolean type components get a warning when the component is inside the Field Array Component.
see below.
Warning: A component is changing an uncontrolled input of type checkbox to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components