Fix radio style prop

This commit is contained in:
afc163 2016-03-04 12:07:17 +08:00
parent 958a74e028
commit a45ed7ee4c
2 changed files with 12 additions and 13 deletions

View File

@ -13,27 +13,26 @@ const RadioGroup = Radio.Group;
const App = React.createClass({ const App = React.createClass({
getInitialState() { getInitialState() {
return { return {
value: 1 value: 1,
}; };
}, },
onChange(e) { onChange(e) {
console.log('radio checked', e.target.value); console.log('radio checked', e.target.value);
this.setState({ this.setState({
value: e.target.value value: e.target.value,
}); });
}, },
render() { render() {
return ( return (
<div> <RadioGroup onChange={this.onChange} value={this.state.value}>
<RadioGroup onChange={this.onChange} value={this.state.value}> <Radio key="a" value={1}>A</Radio>
<Radio key="a" value={1}>A</Radio> <Radio key="b" value={2}>B</Radio>
<Radio key="b" value={2}>B</Radio> <Radio key="c" value={3}>C</Radio>
<Radio key="c" value={3}>C</Radio> <Radio key="d" value={null}>D</Radio>
<Radio key="d" value={null}>D</Radio> </RadioGroup>
</RadioGroup>
</div>
); );
} }
}); });
ReactDOM.render(<App />, mountNode); ReactDOM.render(<App />, mountNode);
```` ````

View File

@ -9,7 +9,7 @@ const AntRadio = React.createClass({
}; };
}, },
render() { render() {
const { prefixCls, children, checked, disabled, className } = this.props; const { prefixCls, children, checked, disabled, className, style } = this.props;
const classString = classNames({ const classString = classNames({
[prefixCls]: true, [prefixCls]: true,
[`${prefixCls}-checked`]: checked, [`${prefixCls}-checked`]: checked,
@ -17,8 +17,8 @@ const AntRadio = React.createClass({
[className]: !!className, [className]: !!className,
}); });
return ( return (
<label className={classString}> <label className={classString} style={style}>
<Radio {...this.props} children={null} /> <Radio {...this.props} style={null} children={null} />
{children} {children}
</label> </label>
); );