Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛[BUG]ProFormField组件的类型是不是错了 #8845

Open
DBvc opened this issue Nov 4, 2024 · 1 comment
Open

🐛[BUG]ProFormField组件的类型是不是错了 #8845

DBvc opened this issue Nov 4, 2024 · 1 comment

Comments

@DBvc
Copy link
Contributor

DBvc commented Nov 4, 2024

🐛 bug 描述

image
ProFormField组件的render方法识别到的类型是右侧这个,实际上打印出的类型不符合预期

看起来应该是这个才对:
image

🏞 期望结果

希望类型能准确

© 版本信息

  • ProComponents 版本: 2.8.1
  • umi 版本
  • 浏览器环境 Chrome 130
  • 开发环境 Mac OS
cycleccc added a commit to cycleccc/pro-components that referenced this issue Dec 2, 2024
@win5do
Copy link

win5do commented Jan 16, 2025

Same issue.

Add log in demo:

https://codesandbox.io/p/sandbox/ghx8my?file=%2FApp.tsx

{
    disable: true,
    title: "标签",
    dataIndex: "labels",
    search: false,
    renderFormItem: (_, { defaultRender }) => {
      return defaultRender(_);
    },
    render: (x, record) => {
      console.log("x", typeof x, React.isValidElement(x));

      return (
        <Space>
          {record.labels.map(({ name, color }) => (
            <Tag color={color} key={name}>
              {name}
            </Tag>
          ))}
        </Space>
      );
    },
  },

Output:

x object [Object]0: {name: 'bug', color: 'error'}length: 1[[Prototype]]: Array(0) false

First args type not React.ReactNode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants