jquense / react-big-calendar

gcal/outlook like calendar component
http://jquense.github.io/react-big-calendar/examples/index.html
MIT License
7.81k stars 2.23k forks source link

How to open menu on right click #1965

Open vitaly87 opened 3 years ago

vitaly87 commented 3 years ago

I am trying to display menu on right click with react-big-calendar and material ui, the issue that menu isnt display correctly on html its going on top right corner, My code is:


  const handleClick = (event) => {
    setAnchorEl(event.currentTarget);
  };
return (
    <>
      <Menu
        id="simple-menu"
        anchorEl={anchorEl}
        keepMounted
        open={Boolean(anchorEl)}
        onClose={handleClose}
      >
        <MenuItem onClick={() => redirectToEvent(selectedEvent)}>
          <ImportContactsTwoToneIcon
            color="primary"
            style={{ marginLeft: "15px" }}
          />{" "}
          פתח אירוע
        </MenuItem>

      </Menu>
 <Calendar
        localizer={localizer}
        events={events}
        step={60}
        views={["month", "day"]}
        onSelectEvent={(event, e) => {

          redirectToEvent(event);
        }}
        components={
          {
            eventWrapper: ({ event, children }) => (
              <div
                onContextMenu={
                  e => { 
                    setSelectedEvent(event);

                //think this is the issue
                   setAnchorEl(e);

                    e.preventDefault();
                  }
                }
              >
                {children}
              </div>
            )
          }
        }
masudhossain commented 2 months ago

2024, can we know how?

Jatin-Ahirwar commented 2 months ago

2024, can we know how?

did you find any trick to do that i am working on a project in which on the date i want to right click then show button which is for add session by clicking that it will open the form but i am not able to right click in the react-big-calendar