mirror of
https://github.com/status-im/status-react.git
synced 2025-01-10 11:06:25 +00:00
dc4841f041
Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
30 lines
582 B
JavaScript
30 lines
582 B
JavaScript
'use strict';
|
|
|
|
type MenuItems = Array<{
|
|
text?: string,
|
|
onPress?: ?Function,
|
|
}>;
|
|
|
|
const NativeModules = require('react-native').NativeModules;
|
|
|
|
class DesktopMenu {
|
|
|
|
static show(
|
|
menuItems?: MenuItems
|
|
): void {
|
|
var itemNames = menuItems.map(i => i.text);
|
|
var itemMap = new Map();
|
|
for (let i = 0; i < menuItems.length; ++i) {
|
|
itemMap.set(menuItems[i].text, menuItems[i].onPress);
|
|
}
|
|
NativeModules.DesktopMenuManager.show(
|
|
itemNames,
|
|
(name) => {
|
|
(itemMap.get(name))();
|
|
}
|
|
);
|
|
}
|
|
}
|
|
|
|
module.exports = DesktopMenu;
|