jurassix / react-validation-mixin

Simple validation mixin (HoC) for React.
MIT License
283 stars 38 forks source link

Type of "children" property is too restrictive #64

Closed martindederer closed 8 years ago

martindederer commented 8 years ago

I suspect that the validation HOC's children property type definition is too restrictive. It causes warnings like

Failed propType: Invalid prop children of type object supplied to Validation(MyComponent), expected array

in my code base.

Currently it is limited to "PropTypes.array". Shouldn't it be

React.PropTypes.oneOfType([React.PropTypes.array, React.PropTypes.element])

instead? According to the react docs the children property can be "array" or i guess "element". The latter is not stated explicitly though.

What do you think?

jurassix commented 8 years ago

@martindederer I think you are probably correct that we can remove the following lines:

If you would like to put this in a PR please do. Otherwise I'll make the fix.

jurassix commented 8 years ago

Fixed in v5.3.4