diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index 04caeb4699..4e17e3930d 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -56,6 +56,8 @@ export default class FormItem extends React.Component { context: FormItemContext; + state = { helpShow: false }; + componentDidMount() { warning( this.getControls(this.props.children, true).length <= 1, @@ -89,7 +91,7 @@ export default class FormItem extends React.Component { const child = childrenArray[i] as React.ReactElement; if (child.type && - (child.type as any === FormItem || (child.type as any).displayName === 'FormItem')) { + (child.type as any === FormItem || (child.type as any).displayName === 'FormItem')) { continue; } if (!child.props) { @@ -126,6 +128,10 @@ export default class FormItem extends React.Component { return this.getChildProp(FIELD_DATA_PROP); } + onHelpAnimEnd = (_key: string, helpShow: boolean) => { + this.setState({ helpShow }); + } + renderHelp() { const prefixCls = this.props.prefixCls; const help = this.getHelpMsg(); @@ -135,7 +141,13 @@ export default class FormItem extends React.Component { ) : null; return ( - + {children} ); @@ -298,7 +310,7 @@ export default class FormItem extends React.Component { const style = props.style; const itemClassName = { [`${prefixCls}-item`]: true, - [`${prefixCls}-item-with-help`]: !!this.getHelpMsg(), + [`${prefixCls}-item-with-help`]: !!this.getHelpMsg() || this.state.helpShow, [`${prefixCls}-item-no-colon`]: !props.colon, [`${props.className}`]: !!props.className, }; diff --git a/components/form/style/index.less b/components/form/style/index.less index d1736b23b6..006bb70441 100644 --- a/components/form/style/index.less +++ b/components/form/style/index.less @@ -73,7 +73,6 @@ input[type="checkbox"] { .reset-component; margin-bottom: @form-item-margin-bottom; vertical-align: top; - transition: margin .15s steps(1); // nested FormItem &-control > &:last-child, @@ -93,7 +92,6 @@ input[type="checkbox"] { &-with-help { margin-bottom: @form-item-margin-bottom - @font-size-base * @line-height-base - @form-help-margin-top; - transition: none; } &-label {