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

iOS Context Menu Ignores action Prop and Defaults to Long Press #96

Closed
whynotly opened this issue Aug 6, 2024 · 4 comments
Closed

iOS Context Menu Ignores action Prop and Defaults to Long Press #96

whynotly opened this issue Aug 6, 2024 · 4 comments

Comments

@whynotly
Copy link

whynotly commented Aug 6, 2024

I am experiencing an issue with the ContextMenu component from the Zeego library on iOS. Despite setting the action prop to press, the context menu still triggers on a long press instead of a regular press.

Steps to Reproduce:

Use the ContextMenu component in a React Native project.
Set the action prop to press on the ContextMenu.Trigger component.
Run the app on an iOS device or simulator.
Observe that the context menu only appears on a long press, not on a regular press.
Expected Behavior:

The context menu should appear when the trigger is pressed, as specified by the action prop.

Actual Behavior:

The context menu only appears on a long press, ignoring the action prop setting.

Code Example:

jsx
Copy code
import * as ContextMenu from 'zeego/context-menu';
import { View, Alert } from 'react-native';
import React from 'react';

const Example = () => (
<ContextMenu.Root>
<ContextMenu.Trigger action="press">
<View style={{ width: 150, height: 150, backgroundColor: 'red' }} />
</ContextMenu.Trigger>
<ContextMenu.Content>
<ContextMenu.Item key="option1" onSelect={() => Alert.alert('Option 1')}>
<ContextMenu.ItemTitle>Option 1</ContextMenu.ItemTitle>
</ContextMenu.Item>
<ContextMenu.Item key="option2" onSelect={() => Alert.alert('Option 2')}>
<ContextMenu.ItemTitle>Option 2</ContextMenu.ItemTitle>
</ContextMenu.Item>
<ContextMenu.Item key="option3" onSelect={() => Alert.alert('Option 3')}>
<ContextMenu.ItemTitle>Option 3</ContextMenu.ItemTitle>
</ContextMenu.Item>
</ContextMenu.Content>
</ContextMenu.Root>
);

export default Example;
Environment:

Zeego Version: [e.g., 1.0.0]
React Native Version: [e.g., 0.64.2]
iOS Version: [e.g., 14.4]
Device: [e.g., iPhone 12]
Additional Context:

I have verified that the ContextMenu component behaves correctly on other platforms. This issue seems specific to iOS. Any guidance or a fix for this issue would be greatly appreciated.

@bnussman
Copy link

Can confirm that action="press" does not work in 1.10.0. Haven't tested to see if this is fixed in v2 due to the TypeScript issues (#98)

@nandorojo
Copy link
Owner

v2 is fixed now. However, I think the action not working is an issue with isMenuPrimaryAction not working on the upstream react-native-ios-context-menu

@nandorojo
Copy link
Owner

FYI @dominicstop it's possible that isMenuPrimaryAction isn't working, is this meant to work for contextMenu such that it can open on one tap?

@nandorojo
Copy link
Owner

Going to close this for now as it's an upstream issue, feel free to open on the react-native-ios-context-menu repo, thank you!

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