Reputation: 2189
In android cell phones contact page there are a three dots icon on the top right-hand corner (first image). When clicked, a menu will show up (second image).
I have searched, but couldn't find any third party package for this behavior. I don't want to use Picker or something similar.
Upvotes: 0
Views: 3843
Reputation: 38
I would use some package like that: https://www.npmjs.com/package/react-native-material-menu
Here is simple snippet how to use this package:
import React from 'react';
import { View, Text } from 'react-native';
import Menu, { MenuItem, MenuDivider } from 'react-native-material-menu';
class App extends React.PureComponent {
_menu = null;
setMenuRef = ref => {
this._menu = ref;
};
hideMenu = () => {
this._menu.hide();
};
showMenu = () => {
this._menu.show();
};
render() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Menu
ref={this.setMenuRef}
button={<Text onPress={this.showMenu}>Show menu</Text>}
>
<MenuItem onPress={this.hideMenu}>Menu item 1</MenuItem>
<MenuItem onPress={this.hideMenu}>Menu item 2</MenuItem>
<MenuItem onPress={this.hideMenu} disabled>
Menu item 3
</MenuItem>
<MenuDivider />
<MenuItem onPress={this.hideMenu}>Menu item 4</MenuItem>
</Menu>
</View>
);
}
}
export default App;
Upvotes: 2