fix form warning (#15160)

* fix form warning

* update snapshot
This commit is contained in:
zombieJ 2019-03-04 14:51:40 +08:00 committed by GitHub
parent 2996d8e625
commit 2f6b367137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 14 deletions

View File

@ -249,6 +249,8 @@ export default class Form extends React.Component<FormProps, any> {
'layout',
'form',
'hideRequiredMark',
'wrapperCol',
'labelCol',
]);
return <form {...formProps} className={formClassName} />;

View File

@ -259,7 +259,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
renderWrapper(prefixCls: string, children: React.ReactNode) {
return (
<FormContext.Consumer>
<FormContext.Consumer key="wrapper">
{({ wrapperCol: contextWrapperCol, vertical }: FormContextProps) => {
const { wrapperCol } = this.props;
const mergedWrapperCol: ColProps =
@ -273,7 +273,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
// No pass FormContext since it's useless
return (
<FormContext.Provider value={{ vertical }}>
<Col {...mergedWrapperCol} className={className} key="wrapper">
<Col {...mergedWrapperCol} className={className}>
{children}
</Col>
</FormContext.Provider>
@ -328,7 +328,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
renderLabel(prefixCls: string) {
return (
<FormContext.Consumer>
<FormContext.Consumer key="label">
{({ vertical, labelCol: contextLabelCol }: FormContextProps) => {
const { label, labelCol, colon, id } = this.props;
const required = this.isRequired();
@ -350,7 +350,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
}
return label ? (
<Col {...mergedLabelCol} className={labelColClassName} key="label">
<Col {...mergedLabelCol} className={labelColClassName}>
<label
htmlFor={id || this.getId()}
className={labelClassName}

View File

@ -481,8 +481,6 @@ exports[`renders ./components/form/demo/advanced-search.md correctly 1`] = `
exports[`renders ./components/form/demo/coordinated.md correctly 1`] = `
<form
class="ant-form ant-form-horizontal"
labelcol="[object Object]"
wrappercol="[object Object]"
>
<div
class="ant-row ant-form-item"
@ -1513,8 +1511,6 @@ exports[`renders ./components/form/demo/normal-login.md correctly 1`] = `
exports[`renders ./components/form/demo/register.md correctly 1`] = `
<form
class="ant-form ant-form-horizontal"
labelcol="[object Object]"
wrappercol="[object Object]"
>
<div
class="ant-row ant-form-item"
@ -2469,8 +2465,6 @@ exports[`renders ./components/form/demo/style-check-debug.md correctly 1`] = `
exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] = `
<form
class="ant-form ant-form-horizontal"
labelcol="[object Object]"
wrappercol="[object Object]"
>
<div
class="ant-row ant-form-item"
@ -2889,8 +2883,6 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
<form
class="ant-form ant-form-horizontal"
labelcol="[object Object]"
wrappercol="[object Object]"
>
<div
class="ant-row ant-form-item"
@ -4107,8 +4099,6 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
<form
class="ant-form ant-form-horizontal"
labelcol="[object Object]"
wrappercol="[object Object]"
>
<div
class="ant-row ant-form-item ant-form-item-with-help"