GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [50$] Feature Request / Bug Report - iOS / Android `onPress` action for <ContextMenu.Trigger> that doesn't conflict with normal the actual ContextMenu Deployment · Issue #145 · nandorojo/zeego

[50$] Feature Request / Bug Report - iOS / Android onPress action for <ContextMenu.Trigger> that doesn't conflict with normal the actual ContextMenu Deployment #145

New issue
Copy link
New issue
Copy link
Open
#196
Open
[50$] Feature Request / Bug Report - iOS / Android onPress action for <ContextMenu.Trigger> that doesn't conflict with normal the actual ContextMenu Deployment#145
#196
Copy link

Description

@ChristopherGabba
ChristopherGabba
opened on Mar 7, 2025
Issue body actions

First of all, I want to show my sincere appreciation for this library and all the wonderful docs. Its absolutely phenomenal.

This issue has sort of been bothering me in our app for a while. There is a "workaround" available for iOS, which I'm not a huge fan of, but it's still flaky on Android.

Desired Functionality:
I wrap my some content in my app with a <ContextMenu>. That content is a wrapped in a TouchableOpacity. The functionality I desire is:

  1. User quickly taps on that content, it takes them to play the video or full screen the image (similar to the repro)
  2. If a user long presses on the content, they can "Share", "Comment" or "Delete" (all options within my Context Menu)

The Problem
The onPress of my "Touchable" currently interacts with the deployment of the <ContextMenu/>. When you long tap on the context menu it also fires the onPress of the button. Here is a video of the issue.

The Workaround (Identified here)
On iOS the workaround fairly solid. You essentially make the onLongPress of the inner Touchable an empty function like so:

      <ContextMenu.Trigger action="longPress">
        <TouchableOpacity
          onPress={onQuickPress}
          /**THIS IS A WORKAROUND TO AVOID ACCIDENTAL FIRING OF BUTTON */
          onLongPress={() => {}} 
          activeOpacity={0.7}
        >
          {children}
        </TouchableOpacity>
      </ContextMenu.Trigger>

Video Detailing Issue
https://github.com/user-attachments/assets/7e0e58e9-1285-4d54-936e-db4f2b297964

Note: It seems to work well on iOS and Android via simulator, but in reality, just scrolling on a real android device triggers this context menu sometimes. It's just not an ideal user experience. Really this needs a real solution where the context menu itself has its on onPress event that handles all of this stuff.

Reproduction:

  1. Clone Repro: https://github.com/ChristopherGabba/ContextMenu-Press-Repo
  2. Run yarn install
  3. Run npx expo run:ios --device / npx expo run:android --device

Note:
There are quite a few related issues that detail this exact topic:

  • When using TouchableWithoutFeedback as trigger onPressIn/Out has a weird behavior dominicstop/react-native-ios-context-menu#123
  • [SOLVED] Pressable Event duplicates longPress with navigation dominicstop/react-native-ios-context-menu#108
  • Pressables not working after context menu opened dominicstop/react-native-ios-context-menu#9 (comment)
  • iOS: opens on long press regardless of shouldOpenOnLongPress setting react-native-menu/menu#901
  • Feature Request: OnPress to Context Menu mpiannucci/react-native-context-menu-view#114
  • On press is called when context menu being released too quickly mpiannucci/react-native-context-menu-view#60
    (Slightly less related issue)
  • ContextMenu trigger onclick too #59
Reacted by Antoine Rey, Simon Manzler, Teflo, Jan Ziemba and Andrei Vakulski
Reacted by lee@cuong666 and Andrei Vakulski

Activity

  1. krevnekak commented on Mar 21, 2025

    @krevnekak
    krevnekak
    on Mar 21, 2025
    More actions

    same problem

  2. bogdandobritoiu commented on Apr 16, 2025

    @bogdandobritoiu
    bogdandobritoiu
    on Apr 16, 2025
    More actions

    I've encountered the same issue but not with DropdownMenu.

    Solution is to have a state for disable and add a TouchableOpacity around the entire DropdownMenu.

    const [isLongPressActive, setIsLongPressActive] = useState(false)
    
    const handlePress = useCallback(() => {
        if (!isLongPressActive) {
          [what you want it to do after normal press]
        }
        setTimeout(() => {
          setIsLongPressActive(false)
        }, 100)
      }, [isLongPressActive, onPress, item])
    
      const handleLongPress = useCallback(() => {
        setIsLongPressActive(true)
      }, [])
    
      const handlePressOut = useCallback(() => {
        setTimeout(() => {
          setIsLongPressActive(false)
        }, 100)
      }, [])
    
    <TouchableOpacity
          onPress={handlePress}
          onLongPress={handleLongPress}
          onPressOut={handlePressOut}
          delayLongPress={200}>
         <Root>
             <Content>
                 [...]
             </Content>
             <DropdownMenu.Trigger disabled={!isLongPressActive} action="longPress">
                [button]
             </DropdownMenu.Trigger>
         </Root>
    </TouchableOpacity>
    

    Hope this helps. I've tried using gesture handler too but it didn't work as expected. Use a native Touchable or Pressable to wrap the entire menu.
    This fixed my android issue of tapping the button and it still opened the menu for some reason (Exactly as your case shows in the video)

    Reacted by Karthik
  3. smanzler commented on May 15, 2025

    @smanzler
    smanzler
    on May 15, 2025
    More actions

    same issue, I am going to use the same workout around setting onLongPress to () => {}

  4. vladislav-gorovenko commented on Jul 17, 2025

    @vladislav-gorovenko
    vladislav-gorovenko
    on Jul 17, 2025
    More actions

    Thanks for workaround

  5. hlog2e commented on Jan 7, 2026

    @hlog2e
    hlog2e
    on Jan 7, 2026
    More actions

    Same here — I can reproduce this on my side too. The only way I’ve been able to make it work is by using a hack like onLongPress={() => {}} (no-op). It feels like the only practical workaround right now. Hoping there’s a real fix upstream.

  6. richardo2016 commented on Jan 7, 2026

    @richardo2016
    richardo2016
    on Jan 7, 2026
    More actions

    This seems to be a type of problem I've solved before (although the performance isn't 100% identical, I believe the underlying cause is the same).

    @ChristopherGabba I'd like to ask if this bounty is still valid? If it is, I can provide a PR and demo video (based on a real device, not a simulator) for the repository you provide. If you confirm it's valid, you can pay me the bounty via Apple gift card or crypto.

  7. mateofowlerz commented on Jan 12, 2026

    @mateofowlerz
    mateofowlerz
    on Jan 12, 2026
    More actions

    This seems to be a type of problem I've solved before (although the performance isn't 100% identical, I believe the underlying cause is the same).

    @ChristopherGabba I'd like to ask if this bounty is still valid? If it is, I can provide a PR and demo video (based on a real device, not a simulator) for the repository you provide. If you confirm it's valid, you can pay me the bounty via Apple gift card or crypto.

    i'll pay u the bounty if the pr gets merged into Zeego. I hate this workaround

  8. richardo2016 commented on Jan 12, 2026

    @richardo2016
    richardo2016
    on Jan 12, 2026
    More actions

    This seems to be a type of problem I've solved before (although the performance isn't 100% identical, I believe the underlying cause is the same).
    @ChristopherGabba I'd like to ask if this bounty is still valid? If it is, I can provide a PR and demo video (based on a real device, not a simulator) for the repository you provide. If you confirm it's valid, you can pay me the bounty via Apple gift card or crypto.

    i'll pay u the bounty if the pr gets merged into Zeego. I hate this workaround

    Hi, maybe you don't need a pr merged into the zeego, you can use patch-package or yarn package to make your workaround available in your repository

  9. mateofowlerz commented on Jan 12, 2026

    @mateofowlerz
    mateofowlerz
    on Jan 12, 2026 via email
    More actions
    Sent you an email!
    …
    On Mon, Jan 12, 2026 at 11:40 AM Richard ***@***.***> wrote: *richardo2016* left a comment (nandorojo/zeego#145) <#145 (comment)> This seems to be a type of problem I've solved before (although the performance isn't 100% identical, I believe the underlying cause is the same). @ChristopherGabba <https://github.com/ChristopherGabba> I'd like to ask if this bounty is still valid? If it is, I can provide a PR and demo video (based on a real device, not a simulator) for the repository you provide. If you confirm it's valid, you can pay me the bounty via Apple gift card or crypto. i'll pay u the bounty if the pr gets merged into Zeego. I hate this workaround Hi, maybe you don't need a pr merged into the zeego, you can use patch-package or yarn package to make your workaround available in your repository — Reply to this email directly, view it on GitHub <#145 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AXNFJVQAGB5M3RDAW4U4A7T4GOW6FAVCNFSM6AAAAABYQBYMDSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTOMZYHA4DAOBUG4> . You are receiving this because you commented.Message ID: ***@***.***>
    -- Co-founder @ Sirvana | +543435135169
  10. mateofowlerz commented on Jan 12, 2026

    @mateofowlerz
    mateofowlerz
    on Jan 12, 2026
    More actions

    The workaround wasn't working 100% of the time for me and adding the delay solved it.

    onPress={handlePress} onLongPress={() => {}} delayLongPress={100}

    Source: dominicstop/react-native-ios-context-menu#9 (comment)

    Reacted by HongRok Kim
  11. orgorin023 commented on Jun 16, 2026

    @orgorin023
    orgorin023
    on Jun 16, 2026
    More actions

    Opened PR #196 with a native long-press trigger fix: https://github.com/nandorojo/zeego/pull/196\n\nIt wraps the trigger child press handler only for native long-press triggers so the trailing press after the context menu opens is swallowed once, while normal press behavior resumes afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.