feat: add onPress to tap the anchor while long-press opens the menu#1218
Open
zcmgyu wants to merge 1 commit into
Open
feat: add onPress to tap the anchor while long-press opens the menu#1218zcmgyu wants to merge 1 commit into
zcmgyu wants to merge 1 commit into
Conversation
With shouldOpenOnLongPress the menu opens on long press, but the
anchor's normal tap was swallowed by the native UIButton (iOS) with no
way to handle it. Add an `onPress` prop so a tap of the anchor invokes
onPress while long-press still opens the menu — the anchor becomes both
tappable and long-pressable.
Native forwards the anchor tap through the existing onPressAction channel
with a sentinel id ("rnmenu:onPress"): iOS via UIButton touchUpInside
(guarded to non-primary-action mode) plus the iOS<14 action-sheet tap,
Android via onSingleTapUp in long-press mode. index.tsx translates the
sentinel into the onPress callback. Tap-to-open menus
(shouldOpenOnLongPress=false) are unaffected.
zcmgyu
force-pushed
the
feat/anchor-onpress-with-longpress-menu
branch
from
July 24, 2026 07:20
15cd5c9 to
a402bbf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Right now, if you set shouldOpenOnLongPress, the menu opens on long-press, but a normal tap on the anchor does nothing. There's no way to handle it.
That makes a very common mobile pattern impossible:
▎ Tap a row to open it, long-press it for a context menu (rename, delete, …).
On iOS the anchor is a native UIButton, so it quietly swallows the tap and never tells JS about it.
The fix
A new onPress prop. When shouldOpenOnLongPress is on:
So the anchor is now both tappable and long-pressable.
How it works
The native side reports the anchor tap through the existing onPressAction channel using a reserved id ("rnmenu:onPress"), and index.tsx turns that into the public onPress callback:
No breaking changes
onPressonly fires inlong-pressmode. Regular tap-to-open menus (shouldOpenOnLongPress={false}) behave exactly as before.Changes