diff --git a/src/_common b/src/_common index a3725a486..2c8395f8d 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit a3725a486fefd610b34529199701ec8f5d02e629 +Subproject commit 2c8395f8da055117d4a00630cb9642b3b796cc1d diff --git a/src/form/FormItem.tsx b/src/form/FormItem.tsx index 901a75eef..54c78ba7d 100644 --- a/src/form/FormItem.tsx +++ b/src/form/FormItem.tsx @@ -380,8 +380,6 @@ const FormItem = forwardRef((props, ref) => { {React.Children.map(children, (child, index) => { if (!child) return null; - let onChangeFromProps = () => ({}); - let onBlurFromProps = () => ({}); let ctrlKey = 'value'; if (React.isValidElement(child)) { if (child.type === FormItem) { @@ -392,12 +390,6 @@ const FormItem = forwardRef((props, ref) => { }, }); } - if (typeof child.props.onChange === 'function') { - onChangeFromProps = child.props.onChange; - } - if (typeof child.props.onBlur === 'function') { - onBlurFromProps = child.props.onBlur; - } if (typeof child.type === 'object') { ctrlKey = ctrlKeyMap.get(child.type) || 'value'; } @@ -406,12 +398,12 @@ const FormItem = forwardRef((props, ref) => { ...child.props, [ctrlKey]: formValue, onChange: (value: any, ...args: any[]) => { - onChangeFromProps.call(null, value, ...args); updateFormValue(value); + child.props.onChange?.call?.(null, value, ...args); }, onBlur: (value: any, ...args: any[]) => { - onBlurFromProps.call(null, value, ...args); handleItemBlur(); + child.props.onBlur?.call?.(null, value, ...args); }, }); }