I may be doing something wrong, but I don't believe so. Rendering a Select field with the Multiple property gives me the following error:
Material-UI: the value property must be an array when using the Select component with multiple.
This is talking about the value property on the component itself, I believe, and not the MenuItem, so not a whole lot I can show on my end. Based on that alone it seems like the redux-form is passing in a raw value instead of an array of values when faced with the multiple property. If you can lead me in the right direction on how to fix it, I'll definitely make a PR.
If you can look at this tonight, it would be unbelievably appreciated. If not, totally understood. Cheers m8!
<Field name="fields" component={Select} multiple fullWidth placeholder="Select your Fields" label="Fields to Compare or Display">
{this.props.survey.items.map((item) =>
{ return item.type === 'Number' ? (
<MenuItem value={item.identifier}>
<ListItemIcon>
<ImportContactsIcon />
</ListItemIcon>
{item.label}
</MenuItem> )
: null
}
)}
</Field>
Having the same issue
Hi @RSpicer
Thank you for reporting issue. So value is being actually passed from what consumer component has passed.
As an example I have added a Unit test case which demonstrate Select with multiple Option.
Could you take a look at it and let me know ?
Please correct me if I have mis understood your question.
+1
I've solved this issue with the following code:
<Field component={Select} multiple format={value => value || []}...
same here, fix above doesn't help
actually sorry it works with minor change
format={value => Array.isArray(value) ? value : []}
Closing this, due to inactivity. Feel free to reopen if issue still persist.
Most helpful comment
actually sorry it works with minor change