How to set an icon in MenuTrigger

Viewed 4849

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?

2 Answers

Thank you for asking, and posting the answer to this. I had the same question and solved it thanks to this post. I made a mock burger menu using this module. Having implemented this, my code now looks like this.

  <MenuTrigger>
  <Image 
      source={require('./assets/Burger.png')}
      >
      </Image>
  </MenuTrigger>

Note. I initially tried to wrap the Image> within a TouchableOpacity>, which triggered malfunctioning. Turns out there is no need to use . You only have to insert Image> directly.

Related