fkhadra / react-contexify

👌 Add a context menu to your react app with ease

Home Page:https://fkhadra.github.io/react-contexify/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read properties of undefined (reading 'preventDefault')

vaynevayne opened this issue · comments

And antd table don't work well. I found that antd's onContextMenu has e.preventDefault.

  const { show } = useContextMenu({
    id: MENU_ID,
  }); 
<Table
          columns={tableColumns}
          onRow={(record) => {
            return {
              onContextMenu: (e) => {
                console.log('e', e.preventDefault);
                show(e);
              },
            };
          }}
         
        />
 <Menu id={MENU_ID}>
        <Item onClick={handleItemClick}>Item 1</Item>
        <Item onClick={handleItemClick}>Item 2</Item>
        <Separator />
        <Item disabled>Disabled</Item>
        <Separator />
        <Submenu label="Submenu">
          <Item onClick={handleItemClick}>Sub Item 1</Item>
          <Item onClick={handleItemClick}>Sub Item 2</Item>
        </Submenu>
      </Menu>

reason is demo docs bug