Skip to content

[BUG] DropdownMenu and ContextMenu broken on Android #60

@rolandschuetz

Description

@rolandschuetz

When I copy-paste the example from https://nativewindui.com/component/dropdown-menu with Expo SDK 54 it's not working.

Same for ContextMenu.

According to the @rn-primitives/context-menu documentation, the relativeTo prop controls how the menu position is determined:
relativeTo="trigger" - Measures the trigger element using .measure() to get its position. On Android, this .measure() call was failing/not returning, so pressPosition was never set.
relativeTo="longPress" - Uses the event coordinates directly from the long press event (ev.nativeEvent.pageX/pageY). This is synchronous and doesn't rely on .measure().

The menu should now appear at the location where you long-press (at your finger position) rather than relative to the trigger element. This is actually a more natural UX for context menus anyway.

I got the menu to work like this, not sure if thats the optimal solution:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions