mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
fix: wrappedComponentRef should work, close: #6545
This commit is contained in:
parent
3001ca4114
commit
87bfe2df87
@ -139,7 +139,7 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
|
||||
static Item = FormItem;
|
||||
|
||||
static create = function<TOwnProps>(options?: FormCreateOption): ComponentDecorator<TOwnProps> {
|
||||
static create = function<TOwnProps>(options: FormCreateOption = {}): ComponentDecorator<TOwnProps> {
|
||||
const formWrapper = createDOMForm({
|
||||
fieldNameProp: 'id',
|
||||
...options,
|
||||
@ -174,8 +174,10 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
this.props.form.getFieldProps = this.deprecatedGetFieldProps;
|
||||
|
||||
const withRef: any = {};
|
||||
if (options && options.withRef) {
|
||||
if (options.withRef) {
|
||||
withRef.ref = 'formWrappedComponent';
|
||||
} else if (this.props.wrappedComponentRef) {
|
||||
withRef.ref = this.props.wrappedComponentRef;
|
||||
}
|
||||
return <Component {...this.props} {...withRef} />;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user