Browse Source

fix: wrappedComponentRef should work, close: #6545

pull/7170/head
Benjy Cui 7 years ago
parent
commit
87bfe2df87
  1. 6
      components/form/Form.tsx

6
components/form/Form.tsx

@ -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…
Cancel
Save