React DND不使用材料UI菜单
我正在使用react-dnd
在我的代码中实现拖放功能。我面临的问题是,如果我将可拖动组件包装在菜单
组件中。拖放工作时,DROP功能无法正常工作,但是如果我用菜单
将div
替换为预期。
这是 sandbox 在此问题中证明了问题。
我创建了一个虚拟
组件,该组件本质上是knight
组件,并将其传递给MUI 菜单
board.tsx 。打开菜单时,该组件是可以预期的,但不可拖放。
结帐到没有mui-menu
分支,在那里我用DIV代替了整个菜单,它可以按预期工作。
我浏览了react-dnd文档,我只需要确保在最高级别上包裹的dnd-provider
我已经完成了。
有人知道这是什么问题吗?
I am using react-dnd
to implement drag and drop functionality in my code. The problem I am facing is that if I wrap my draggable components inside a Menu
component. the drop functionality doesn't work while the drag works, but if I replace the Menu
with a div
, it works as expected.
Here's a Sandbox where the issue is demonstrated.
I have created a Dummy
component which is essentially the Knight
component and passed it in a mui Menu
in Board.tsx
. On opening the menu, the component is draggable as expected but not droppable.
Checkout to without-mui-menu
branch, where I have replaced the whole menu thing with a div and it works as expected.
I went through react-dnd docs, and I just need to ensure there's a dnd-provider
wrapped at the top level for it work, which I have done.
Does anybody have an idea what could be the issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论