ant-design / ant-design/pro-components

🐛[BUG] Schema Form 自定义组件,FormItemProps 的 trigger 属性不生效

Open
#8,615 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

### 🐛 bug 描述

使用 `BetaSchemaForm` 组件时,通过 `FormItemProps` 设置 `trigger` 不生效。

### 📷 复现步骤

沙盒地址: https://stackblitz.com/edit/react-t4z2wa?file=App.tsx

如沙盒代码所示,我自定义了一个 `CustomComponent` 组件,将其放到 schema 配置中,通过 `renderFormItem` 进行渲染,并通过 `formItemProps` 指定 `trigger` 为 `onUploaded`。

### 🏞 期望结果

`CustomComponent` 能够接受传入的 `onUploaded` 方法(替换默认的 `onChange`)。实际仍旧只能够收到默认的 `onChange`,手动指定的 `onUploaded` 仍为 undefined。

### 💻 复现代码

如上。

### © 版本信息

"@ant-design/cssinjs": "^1.18.4",
"@ant-design/icons": "^5.2.6",
"@ant-design/pro-components": "^2.6.46",
"@ant-design/pro-layout": "^7.17.19",
"@ant-design/pro-table": "^3.13.14",
"@umijs/max": "^4.1.0",
"antd": "^5.13.1",
- 浏览器环境 Chrome 127.0.6533.74
- 开发环境 [e.g. mac OS] 14.5 (23F79)

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz App.tsx reproduction and trace how BetaSchemaForm uses renderFormItem and FormItemProps.trigger. Verify the custom component receives onUploaded instead of the default onChange, and confirm the reproduction behaves as expected after the change.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.