tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

RadioGroup.propTypes validation for childContainer and container should support function #447

Open kctang opened 7 years ago

kctang commented 7 years ago

I am getting the following warning because RadioGroup.propTypes is expecting a string.

Warning: Failed prop type: Invalid prop `container` of type `function` supplied to `RadioGroup`, expected `string`.
    in RadioGroup

However, it is possible to use a component in both container and childContainer properties.

const MyGroupContainer = props => (<div>{props.children}</div>);
const MyChildContainer = props => (<div>{props.children}</div>);

<Mdl.RadioGroup name="myRadio" value="opt1" container={MyGroupContainer} childContainer={MyChildContainer}>
    <Mdl.Radio value="opt2">Other option</Mdl.Radio>
    <Mdl.Radio value="opt1" ripple>Ripple option</Mdl.Radio>
</Mdl.RadioGroup>