final-form / react-final-form

🏁 High performance subscription-based form state management for React
https://final-form.org/react
MIT License
7.38k stars 480 forks source link

`multiple` is not passed down to custom components #544

Closed ThiefMaster closed 5 years ago

ThiefMaster commented 5 years ago

I'm using the Dropdown from semantic-ui-react. Just like a normal multiselect dropdown it requires the multiple prop to enable multiselect mode.

However, the Field component passes multiple only to useField() but not along with the other props to the component. For <select multiple> this is handled correctly in useField() (input.multiple = true), but if component is something custom, then this prop is lost.

Would it make sense to always forward multiple, assuming that if it's specified the input (whatever it is) knows how to handle it? It doesn't seem to make sense to set multiple without passing it down, since useField only takes it into account for select components.

erikras commented 5 years ago

You could get around this by using a prop name other than multiple, but...

ThiefMaster commented 5 years ago

yeah, that's the workaround i was using, but not having to do that is cleaner :p

pulse00 commented 5 years ago

@erikras i was stumbling on this too in one of our apps, can you clarify what the multiple FieldRenderProp is doing? I can't find it in the documentation (https://github.com/final-form/react-final-form/blob/master/docs/types/FieldRenderProps.md).

Happy to send an PR if you clarify what it does.

erikras commented 4 years ago

Published fix in v6.3.1.