Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native-Popup-Menu and Stack Navigator

ReactNavigation Stack Navigator has the property HeaderRight useful to place the menu button in the header, but has not a context menu.

Is it possible to integrate the React Native Popup Menu in the Stack Navigator?

Thanks in advance.

like image 450
Fabio Consonni Avatar asked Nov 07 '22 19:11

Fabio Consonni


1 Answers

It is definitely possible to accomplish. In your root App do the following:

import React, { Component } from 'react';
import { MenuContext } from 'react-native-popup-menu';
import MainNavigator from './components/MainNavigator';

export default class App extends Component {
  render() {
    return (
      <MenuContext>
        <MainNavigator />
      </MenuContext>
    );
  }
}

Then the way you've implemented your headerRight should work perfectly.

like image 99
Barry Michael Doyle Avatar answered Dec 01 '22 15:12

Barry Michael Doyle