Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable prop not working #137

Open
leecuong666 opened this issue Feb 17, 2025 · 3 comments
Open

disable prop not working #137

leecuong666 opened this issue Feb 17, 2025 · 3 comments

Comments

@leecuong666
Copy link

Thanks for this great library.

Currently i am having problem with disable control. even though set to true it can still be interacted with long press. error occurs on ios but i have not tried android
I don't even see disable prop in the docs. did it exist before or was it newly added?

export const MenuContext = ({
  children,
  data,
  disableTrigger = false,
  onSelect,
  onOpen,
}: ContextMenuProps) => {
  return (
    <ContextMenu.Root onOpenChange={onOpen}>
      <ContextMenu.Trigger disabled={true}>{children}</ContextMenu.Trigger>

      <ContextMenu.Content>
        {data?.map(item => {
          const key = item.key;

          return (
            <ContextMenu.Item onSelect={() => onSelect(item)} key={String(key)}>
              <ContextMenu.ItemTitle>{item.title}</ContextMenu.ItemTitle>
            </ContextMenu.Item>
          );
        })}
      </ContextMenu.Content>
    </ContextMenu.Root>
  );
};

version

"zeego": "^2.0.4",
"react-native-ios-context-menu": "^3.1.0",
"react-native-ios-utilities": "^5.1.1",
@nandorojo
Copy link
Owner

Thanks for the issue! I don’t believe this prop is implemented, and I don’t think it ever was. I can see about adding this but it feels a bit unlikely. Perhaps in Zeego v3 we could consider adding this

@pugson
Copy link

pugson commented Mar 12, 2025

i made a hacky workaround for this by wrapping the menu in a View and disabling pointer events:

<View
  style={{
    pointerEvents: isDisabled ? "none" : "auto",
  }}
>
  <DropdownMenu.Root>
    <DropdownMenu.Trigger>
      <Pressable />
    </DropdownMenu.Trigger>
    ...
  </DropdownMenu.Root>
</View>

@leecuong666
Copy link
Author

i made a hacky workaround for this by wrapping the menu in a View and disabling pointer events:

<View
style={{
pointerEvents: isDisabled ? "none" : "auto",
}}

<DropdownMenu.Root>
<DropdownMenu.Trigger>

</DropdownMenu.Trigger>
...
</DropdownMenu.Root>

wow, nice idea haha :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants