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

28 lines
720 B
JavaScript

import React from 'react';
import { Text } from 'react-native';
import {
Menu,
MenuProvider,
MenuOptions,
MenuOption,
MenuTrigger
} from 'react-native-popup-menu';
const BasicExample = () => (
<MenuProvider style={{flexDirection: 'column', padding: 30}}>
<Text>Hello world!</Text>
<Menu onSelect={value => alert(`Selected number: ${value}`)}>
<MenuTrigger text='Select option' />
<MenuOptions>
<MenuOption value={1} text='One' />
<MenuOption value={2}>
<Text style={{color: 'red'}}>Two</Text>
</MenuOption>
<MenuOption value={3} disabled={true} text='Three' />
</MenuOptions>
</Menu>
</MenuProvider>
);
export default BasicExample;