nandorojo / zeego

Menus for React (Native) done right.
https://zeego.dev
MIT License
1.69k stars 45 forks source link

Context menu doesn't work at all on the web #93

Open wongk opened 4 months ago

wongk commented 4 months ago

I'm not really sure what's going on with this. I am trying to open a context menu on a button click on the web. It flashes on screen for half a second and then it hides. I am trying to accomplish basically exactly what ChatGPT does when you click on the action menu icon on the chat list.

Screenshot 2024-07-24 at 12 52 56 PM

We have a tamagui app with a monorepo structure. Here is some example code:

    <ContextMenu.Root>
      <ContextMenu.Trigger asChild action={isWeb ? "press" : "longPress"}>
        {trigger}
      </ContextMenu.Trigger>
      {/* @ts-expect-error for some reason TS thinks the next line is invalid */}
      <ContextMenu.Content>
        <ContextMenu.Item key="delete" destructive onSelect={() => onThreadDelete?.()}>
          <ContextMenu.ItemIcon ios={{ name: "trash" }} androidIconName="ic_delete">
            <Trash2 color="$textLink" size="$1" />
          </ContextMenu.ItemIcon>
          <ContextMenu.ItemTitle>Delete</ContextMenu.ItemTitle>
        </ContextMenu.Item>
      </ContextMenu.Content>
    </ContextMenu.Root>

The trigger is:

            <Button circular chromeless size="$2" onPress={(e) => e.stopPropagation()}>
              <MoreHorizontal color="$iconSecondary" size="$1" />
            </Button>
nandorojo commented 4 months ago

it looks like it’s because you’re stopping propagation maybe