reachtokish / rctx-contextmenu

:bowtie: :sparkles: Context menu for React
https://reachtokish.github.io/rctx-contextmenu/
67 stars 15 forks source link

Bug reported in dinamic items #21

Closed oscarsinuco closed 4 years ago

oscarsinuco commented 4 years ago

Relevant code or config

Failed to execute 'removeEventListener' on 'EventTarget': 2 arguments required, but only 1 present

What you did: I fixed this problem by adding a second parameter to the removeEventLister function like this: removeEventListener('resize', ()=>{}) but I'm not sure if this is the right thing I resolved

What happened: I'm using reactjs with class components, I'm adding dynamically several ContextMenuTrigger and ContextMenu with dynamic id's, when I add new ones to the state it works fine, but when I delete one and update the state the error occurs, I clarify that I'm using redux so what I do is delete it from the store and the store itself updates the state of the component

Reproduction repository: At this time I cannot

Problem description: I'm using reactjs with class components, I'm adding dynamically several ContextMenuTrigger and ContextMenu with dynamic id's, when I add new ones to the state it works fine, but when I delete one and update the state the error occurs, I clarify that I'm using redux so what I do is delete it from the store and the store itself updates the state of the component

Suggested solution: I fixed this problem by adding a second parameter to the removeEventLister function like this: removeEventListener('resize', ()=>{}) but I'm not sure if this is the right thing I resolved

reachtokish commented 4 years ago

Hi @oscarsinuco , thanks for raising the bug. Let me reproduce it at my end. But it's better if you can create sandbox and share that with me. It will be fixed as soon as possible.

reachtokish commented 4 years ago

Hey @oscarsinuco , this is resolved. Just released a version. Please update your local dependency for rctx-contextmenu to 1.3.3 and it will be resolved.

You don't need to do any hack to dynamically add or remove menus. You can refer to this example https://github.com/reachtokish/rctx-contextmenu/blob/master/example/src/examples/example6.js

Let me know if you are getting any further issues.

Thanks!

reachtokish commented 4 years ago

Closing this issue as it is fixed. Kindly open if the issue persists. Thnx