remove value validation in <RadioGroup>

it's redundant since we already require it in <Radio> propTypes
This commit is contained in:
Sérgio Ramos 2016-10-28 17:01:12 +01:00
parent 033093033a
commit b3ee3b53ce

View File

@ -8,7 +8,6 @@
const first = require('lodash.first'); const first = require('lodash.first');
const isUndefined = require('lodash.isundefined'); const isUndefined = require('lodash.isundefined');
const get = require('lodash.get'); const get = require('lodash.get');
const invariant = require('invariant');
const Item = require('./item'); const Item = require('./item');
const find = require('lodash.find'); const find = require('lodash.find');
const classNames = require('classnames'); const classNames = require('classnames');
@ -27,11 +26,8 @@ const RadioGroup = React.createClass({
getInitialState: function() { getInitialState: function() {
return this.getState(this.props); return this.getState(this.props);
}, },
componentWillMount: function() {
return this.checkValues(this.props);
},
componentWillReceiveProps: function(nextProps) { componentWillReceiveProps: function(nextProps) {
return this.setState(this.checkValues(nextProps)); return this.setState(nextProps);
}, },
getState: function(props) { getState: function(props) {
const _children = React.Children.toArray(props.children).filter((child) => { const _children = React.Children.toArray(props.children).filter((child) => {
@ -65,13 +61,6 @@ const RadioGroup = React.createClass({
checked checked
}; };
}, },
checkValues: function(props) {
invariant(React.Children.toArray(props.children).every((child) => {
return (child.type.name !== 'Radio') ? true : !!child.props.value;
}), 'All <Radio> childs of <RadioGroup> must have a value property');
return props;
},
handleChange: function(key) { handleChange: function(key) {
return (ev) => { return (ev) => {
const { const {