nandorojo / zeego

Menus for React (Native) done right.
https://zeego.dev
MIT License
1.68k stars 45 forks source link

Delay on ContextMenu onSelect #80

Open wilkinsonj opened 8 months ago

wilkinsonj commented 8 months ago

Hello,

I have a ContextMenu with a couple of ContextMenu.Items, and when I click one, the 'onSelect' event occurs around 1 second later. This is quite a noticeable lag from a user experience point of view.

Am I missing something to avoid this?

Also, the ContextMenu.Trigger with action 'press' does nothing on Press on iOS

Thanks

nandorojo commented 8 months ago

Never seen that happen. Can’t help without seeing all the code

wilkinsonj commented 8 months ago

The root onOpenWillChange fires immediately, and if I set shouldDismissMenuOnSelect to false, the onSelect works immediately.

Clearly, the delay is the closing down of the contextmenu, the event must be fired after that has happened. Will try to reproduce.

For info, it's a large-ish picture (200kb) within the trigger.

Will try to create a minimum reproduction

nandorojo commented 8 months ago

It may be a bug with the upstream iOS menu library in this case

nandorojo commented 8 months ago

I'm wondering if this prop could fix it:

shouldWaitForMenuToHideBeforeFiringOnPressMenuItem

 __unsafeIosProps={{
      shouldWaitForMenuToHideBeforeFiringOnPressMenuItem: false
    }}
wilkinsonj commented 8 months ago

Sounds likely! Will test it tonight / tomorrow in my code and feed back

ahmadtech199 commented 8 months ago

https://github.com/nandorojo/zeego/assets/51687546/80ea8693-256a-4c0a-a00c-42542159f4fe

The ContextMenu.Trigger with action 'press' does nothing on Press on iOS "zeego": "^1.9.1"

nandorojo commented 8 months ago

Please open a new issue, that's unrelated.

Peek-A-Booo commented 7 months ago

I'm wondering if this prop could fix it:

shouldWaitForMenuToHideBeforeFiringOnPressMenuItem

 __unsafeIosProps={{
      shouldWaitForMenuToHideBeforeFiringOnPressMenuItem: false
    }}

it works

RamiroG8k commented 1 month ago

I'm wondering if this prop could fix it:

shouldWaitForMenuToHideBeforeFiringOnPressMenuItem

 __unsafeIosProps={{
      shouldWaitForMenuToHideBeforeFiringOnPressMenuItem: false
    }}

Just for context to anyone with the same issue and the error with the types as mentioned in this issue, it goes in the Root

<ContextMenu.Root
    __unsafeIosProps={{
        shouldWaitForMenuToHideBeforeFiringOnPressMenuItem: false
    }}
>