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]ProFormTreeSelect设置onDropdownVisibleChange之后,下拉框无法展示 #8876

Open
kapeter opened this issue Nov 18, 2024 · 3 comments

Comments

@kapeter
Copy link

kapeter commented Nov 18, 2024

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

ProFormTreeSelect设置onDropdownVisibleChange之后,下拉框无法展示

📷 复现步骤

https://codesandbox.io/p/sandbox/pwnr35

🏞 期望结果

可以正常展示下拉框

💻 复现代码

https://codesandbox.io/p/sandbox/pwnr35

© 版本信息

  • ProComponents 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

@cycleccc
Copy link
Contributor

cycleccc commented Nov 20, 2024

设置 onDropdownVisibleChange 之后需要自己维护 open 状态,详情如下:
https://codesandbox.io/p/sandbox/antd-pro-forked-wkrppr?file=%2Fsrc%2FApp.tsx%3A61%2C26

@kapeter
Copy link
Author

kapeter commented Nov 20, 2024

为啥select不是这样呢

@cycleccc
Copy link
Contributor

https://github.com/cycleccc/pro-components/blob/943212b57bbaeb67bc76bf2dfac46db53ba8630f/packages/field/src/components/TreeSelect/index.tsx#L156

pro-components 在这里做了一层封装,如果传入了 onDropdownVisibleChange 就会代替默认的 onDropdownVisibleChange,内部的 setOpen 无法触发需要外部传入 open 状态代替原来的 open。

cycleccc added a commit to cycleccc/pro-components that referenced this issue Nov 21, 2024
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