dominicstop / react-native-ios-context-menu

A react-native component to use context menu's (UIMenu) on iOS 13/14+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Menu show/hide/cancel events are not fired for ContextMenuButton

finallyblueskies opened this issue · comments

<ContextMenuButton
  onMenuWillShow={() => {
    console.log("Show");
  }}
  onMenuWillHide={() => {
    console.log("Hide?");
  }}
  onMenuWillCancel={() => {
    console.log("Cancel");
  }}
  //...
>
  {/* ... */}
</ContextMenuButton>

I am finding that none of the events above (or any of the did/will show/hide/cancel events) are being fired as the menu is opened and closed.

This is my first time touching Swift code but I was able to discern that where the ContextMenuView UIContextMenuInteractionDelegate (RNIContextMenuView+UIContextMenuInteractionDelegate+.swift) functions were called when that menu opened/closed (and respective event callbacks were called) this does not happen for the ContextMenuButton equivalent (RNIContextMenuButton+UIContextMenuInteractionDelegate.swift). I was unable to make this work.

The React ContextMenuButton component seems to be completely detached from the underlying menu state, the class state menuVisible value for example never reflects the real state of the menu.