ant-design / ant-design/pro-components
🐛[BUG] FormList类型下无法正常使用基于BateSchemaForm封装的自定义ProFiled类型
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
### 🐛 bug 描述
### 📷 复现步骤
### 🏞 期望结果
onFinish打印的值应该为: { name: 'input_value' }, 但打印的值为 {}.
FormList类型下无法正常使用基于BateSchemaForm封装的自定义ProFiled类型,下方有最小复现demo。
事实上,我猜测这与FormList封装有关:
FormList给内置的FormItem打入了 [any]-[index]-[dataIndex]的name,而内部的SchemaForm会将index也一起解析掉。
### 💻 复现代码
为此,我写了一个最小复现demo(事实上,只要在FormList内,基于BetaSchemaForm封装的组件,组件内部的SchemaForm都无法正常工作。):
```jsx
import React, { useContext } from "react";
import { BetaSchemaForm, ProProvider } from "@ant-design/pro-components";
const CusProField = ({}) => (
console.log("values:", values)}
/>
);
export const Demo = () => {
const values = useContext(ProProvider);
return (
{
return ;
},
},
},
}}
>
);
};
export default Demo;
```
### © 版本信息
- ProComponents 版本: [e.g. 4.0.0] >=v4.0.0
- umi 版本 any
- 浏览器环境 any
- 开发环境 [e.g. mac OS] macOS any
### 🚑 其他信息
Contributor guide
Research direction
Start by running the minimal reproduction in the issue with BetaSchemaForm, FormList, ProProvider, and the custom valueTypeMap field. Trace how the FormList name path reaches the nested SchemaForm; done means the example's onFinish output includes the entered name value instead of an empty object.
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
- Clearly specified
- Newbie friendliness
- 45/100