Question: I'm using your react-native-popup-menu for logout button.
when button clicked the authentication deleted and screen will go to login .
but the menu still left.

How to close this menu when screen switched?

```js
<Menu>
  <MenuTrigger>
    <Icon
      name='more-vert'
      color='#fff'
    />
  </MenuTrigger>
  <MenuOptions>
    <MenuOption value={1}>
      <Text onPress={() => {
        this.props.onLogout()
      }}>logout</Text>
    </MenuOption>
  </MenuOptions>
</Menu>

```

*Originally asked by bexoss on react-native-popup-menu GitHub.*

Answer: 
All other answers here will work. Here is another (simpler) solution to the problem depending on what are your requirements.

You are handling logout event in Text component and therefore handlers to close menu are not triggered. Try to pass it to the `onSelect` property of MenuOption:

```js
<MenuOption onSelect={() => this.props.onLogout()}>
  <Text>logout</Text>
</MenuOption>

```

Note: If you returned `false` from your handler, menu would not close.
<https://github.com/instea/react-native-popup-menu/blob/master/doc/api.md>

The API document above states that there is a close() method.

So what you need to do is just declare the ref attribute to access your Menu component directly. E.g "menuRef":

```
<Menu uref='menuRef'>
  <MenuTrigger>
    <Icon
      name='more-vert'
      color='#fff'
    />
  </MenuTrigger>
  <MenuOptions>
    <MenuOption value={1}>
      <Text onPress={() => {
        this.props.onLogout()
      }}>logout</Text>
    </MenuOption>
  </MenuOptions>
</Menu>

```

and then you can simply call from any where in your current component: `this.refs.menuRef.close();`

This approach will also animate the closing.