mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
improve Radio re-render performance
This commit is contained in:
parent
a69b7b70a1
commit
b83aaed358
@ -2,6 +2,7 @@ import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import Radio from './radio';
|
||||
import RadioButton from './radioButton';
|
||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
|
||||
function getCheckedValue(children) {
|
||||
let value = null;
|
||||
@ -51,6 +52,9 @@ export default class RadioGroup extends React.Component {
|
||||
}
|
||||
}
|
||||
}
|
||||
shouldComponentUpdate(...args) {
|
||||
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
||||
}
|
||||
onRadioChange = (ev) => {
|
||||
if (!('value' in this.props)) {
|
||||
this.setState({
|
||||
|
@ -1,11 +1,15 @@
|
||||
import RcRadio from 'rc-radio';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
|
||||
export default class Radio extends React.Component {
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-radio',
|
||||
}
|
||||
shouldComponentUpdate(...args) {
|
||||
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
||||
}
|
||||
render() {
|
||||
const { prefixCls, children, checked, disabled, className, style } = this.props;
|
||||
const classString = classNames({
|
||||
|
Loading…
Reference in New Issue
Block a user