ant-design / ant-design-icons

⭐ Ant Design SVG Icons
https://ant.design/components/icon/
MIT License
954 stars 581 forks source link

can't set onMouseEnter listener of Icons #265

Open tjx666 opened 4 years ago

tjx666 commented 4 years ago

Reproduction link

https://github.com/tjx666/coo

Steps to reproduce

just see screenshot screenshot_2020-03-24_12-09-13

What is expected?

No error report

What is actually happening?

tsc compile error

Environment Info
antd 4.0.4
React 4.0.3
System win10pro1909
Browser electron8.1.1
ant-design-bot commented 4 years ago

Hello @tjx666. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please send your Pull Request to proper branch (feature branch for the new feature, master for bugfix and other changes), fill the Pull Request Template here, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. Appreciate it advance and we are looking forward to your contribution!

你好 @tjx666, 我们完全同意你的提议/反馈,欢迎直接在此仓库 创建一个 Pull Request 来解决这个问题。请将 Pull Request 发到正确的分支(新特性发到 feature 分支,其他发到 master 分支),务必填写 Pull Request 内的预设模板,提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献!

giphy

tjx666 commented 4 years ago

Temporary workaround screenshot_2020-03-24_12-26-23

afc163 commented 4 years ago

@vagusX Is this related to https://github.com/ant-design/ant-design-icons/commit/fb390340eba8f44b1381eaf25afee1f31518c425#diff-917d780e4b5b0637839647e8ca200661R30 ?

vagusX commented 4 years ago

@vagusX Is this related to fb39034#diff-917d780e4b5b0637839647e8ca200661R30 ?

According to v3-stable https://github.com/ant-design/ant-design/blob/3.x-stable/components/icon/index.tsx#L62 and v4 still use the same IconProps interface, so the conclusion is that we have never supported html element event listeners except onKeyUp and onClick.

So, @tjx666 you can wrap a to listen mouse event to get the workground.

What's more, @afc163 should we support all those event listeners?

tjx666 commented 4 years ago

I have change my code logic and need not to listen those events, but I think those events are needed in some case.

afc163 commented 4 years ago

We should, actually we support to pass all rest props into html element but our type definition does not.