0

What is an ideal way to implement multi-level popups with react-native-popup-menu?

I want to be able to click an icon on the screen and have a first level pop-up menu appear. Each item on that first level popup menu would potentially open a second level popup menu on top of the first (with similar <MenuTrigger> behavior).

My initial thought was to somehow call this.---.menuActions.open() from a lambda in the onSelect property in <MenuOption>, but this doesn't appear to be documented in the API so I wanted to avoid hacking something with that solution if its considered a private API.

Crazy Chenz
  • 12,650
  • 12
  • 50
  • 62

1 Answers1

1

Short answer is you can't. react-native-popup-menu allows to open only one menu at the time by design, thus you can't open another instance at the same time.

Theoretically you could implement second level by yourself but it would be IMO quite challenging.

The best alternative I can recommend is to come up with different UX patterns - e.g. something like accordion menu or simply swapping content of menu upon 1st level selection.

See also https://github.com/instea/react-native-popup-menu/issues/185

Btw - there is nothing wrong with opening menu via API - see official documentation

sodik
  • 4,675
  • 2
  • 29
  • 47