Search code examples
react-nativereact-native-popup-menu

How to set an icon in MenuTrigger


I have a menu icon in my navbar and I need to use it as a menu.

enter image description here

I'm trying to achieve this with the react-native-popup-menu lib.

The component <MenuTrigger /> only accepts text (strings) as prop.

How could I use an icon as a menu trigger?


Solution

  • Actually MenuTrigger.text is only optional property according to the doc

    Optional | Text to be rendered. When this prop is provided, trigger's children won't be rendered

    It is possible to place any content inside of MenuTrigger (if you don't use text property) like

    <MenuTrigger>
      <YourIcon>
    </MenuTrigger>
    

    See also official example