Skip to content

Commit

Permalink
fix: should work with rc-form, close: ant-design#3046
Browse files Browse the repository at this point in the history
  • Loading branch information
benjycui committed Sep 18, 2016
1 parent 672ebec commit af7635a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
11 changes: 3 additions & 8 deletions components/checkbox/Group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export interface CheckboxGroupState {
export default class CheckboxGroup extends React.Component<CheckboxGroupProps, CheckboxGroupState> {
static defaultProps = {
options: [],
defaultValue: [],
onChange() {},
prefixCls: 'ant-checkbox-group',
};
Expand All @@ -41,13 +40,9 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps, C
};
constructor(props) {
super(props);
let value;
if ('value' in props) {
value = props.value || [];
} else if ('defaultValue' in props) {
value = props.defaultValue || [];
}
this.state = { value };
this.state = {
value: props.value || props.defaultValue || [],
};
}
componentWillReceiveProps(nextProps) {
if ('value' in nextProps) {
Expand Down
6 changes: 1 addition & 5 deletions components/date-picker/RangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ import Icon from '../icon';

export default class RangePicker extends React.Component<any, any> {
static defaultProps = {
defaultValue: [],
prefixCls: 'ant-calendar',
};

constructor(props) {
super(props);
const { value, defaultValue } = this.props;
const start = (value && value[0]) || defaultValue[0];
const end = (value && value[1]) || defaultValue[1];
this.state = {
value: [start, end],
value: props.value || props.defaultValue || [],
};
}

Expand Down

0 comments on commit af7635a

Please sign in to comment.