mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 19:19:26 +08:00
fix: should throw warning only once, ref: #3491
This commit is contained in:
parent
7483254df6
commit
0aca663092
@ -32,6 +32,7 @@ export interface FormItemContext {
|
||||
form: WrappedFormUtils;
|
||||
}
|
||||
|
||||
let autoGenerateWarning = false;
|
||||
export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
static defaultProps = {
|
||||
hasFeedback: false,
|
||||
@ -60,11 +61,14 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
||||
context: FormItemContext;
|
||||
|
||||
componentDidMount() {
|
||||
warning(
|
||||
!(this.getControls(this.props.children, true).length > 1),
|
||||
'`Form.Item` cannot generate `validateStatus` and `help` automatically, ' +
|
||||
'while there are more than one `getFieldDecorator` in it.'
|
||||
);
|
||||
if (!autoGenerateWarning && (this.getControls(this.props.children, true).length > 1)) {
|
||||
autoGenerateWarning = true;
|
||||
warning(
|
||||
false,
|
||||
'`Form.Item` cannot generate `validateStatus` and `help` automatically, ' +
|
||||
'while there are more than one `getFieldDecorator` in it.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
shouldComponentUpdate(...args) {
|
||||
|
Loading…
Reference in New Issue
Block a user