react-native-popup-menu/examples/BasicExample.js

27 lines
716 B
JavaScript
Raw Normal View History

2016-05-18 07:26:58 +00:00
import React from 'react';
import { Text } from 'react-native';
2016-05-16 14:54:39 +00:00
import Menu, {
MenuContext,
MenuOptions,
MenuOption,
MenuTrigger
} from 'react-native-popup-menu';
const BasicExample = () => (
2016-05-19 14:52:19 +00:00
<MenuContext style={{flexDirection: 'column', padding: 30}}>
2016-05-16 14:54:39 +00:00
<Text>Hello world!</Text>
<Menu onSelect={value => alert(`Selected number: ${value}`)}>
<MenuTrigger text='Select option' />
2016-05-16 14:54:39 +00:00
<MenuOptions>
<MenuOption value={1} text='One' />
<MenuOption value={2} text='Two' />
2016-05-30 07:17:00 +00:00
<MenuOption value={3} disabled={true}>
<Text style={{color: '#ccc'}}>Three</Text>
</MenuOption>
2016-05-16 14:54:39 +00:00
</MenuOptions>
</Menu>
</MenuContext>
);
export default BasicExample;