2016-11-18 14:17:30 +00:00
|
|
|
import React from 'react';
|
2017-02-13 16:08:27 +00:00
|
|
|
import { Text, View, } from 'react-native';
|
2016-11-18 14:17:30 +00:00
|
|
|
import Menu, {
|
|
|
|
MenuContext,
|
|
|
|
MenuOptions,
|
|
|
|
MenuOption,
|
|
|
|
MenuTrigger
|
|
|
|
} from 'react-native-popup-menu';
|
|
|
|
|
|
|
|
import {Scene, Router, Actions} from 'react-native-router-flux';
|
|
|
|
|
|
|
|
const Page = () => (
|
2017-02-13 16:08:27 +00:00
|
|
|
<View style={{flexDirection: 'column', padding: 70}}>
|
2016-11-18 14:17:30 +00:00
|
|
|
<Text>Hello world with react-native-router-flux!</Text>
|
|
|
|
<Menu>
|
|
|
|
<MenuTrigger text='Select option' />
|
|
|
|
<MenuOptions>
|
|
|
|
<MenuOption onSelect={() => Actions.login()} text='Login' />
|
|
|
|
<MenuOption onSelect={() => Actions.register()} text='Register' />
|
|
|
|
<MenuOption onSelect={() => Actions.home()} text='Home' />
|
|
|
|
</MenuOptions>
|
|
|
|
</Menu>
|
2017-02-13 16:08:27 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
|
|
|
const NavigatorMenu = () => (
|
|
|
|
<Menu>
|
|
|
|
<MenuTrigger text='...' />
|
|
|
|
<MenuOptions>
|
|
|
|
<MenuOption onSelect={() => Actions.login()} text='Navigation Login' />
|
|
|
|
<MenuOption onSelect={() => Actions.register()} text='Navigation Register' />
|
|
|
|
<MenuOption onSelect={() => Actions.home()} text='Navigation Home' />
|
|
|
|
</MenuOptions>
|
|
|
|
</Menu>
|
2016-11-18 14:17:30 +00:00
|
|
|
);
|
|
|
|
|
2017-03-19 02:32:48 +00:00
|
|
|
class NavigatorExample extends React.Component {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<MenuContext>
|
2017-09-11 15:31:11 +00:00
|
|
|
<Router>
|
|
|
|
<Scene key="root" >
|
|
|
|
<Scene key="login" component={Page} title="Login" renderRightButton={NavigatorMenu}/>
|
|
|
|
<Scene key="register" component={Page} title="Register"/>
|
|
|
|
<Scene key="home" component={Page}/>
|
|
|
|
</Scene>
|
|
|
|
</Router>
|
2017-03-19 02:32:48 +00:00
|
|
|
</MenuContext>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-18 14:17:30 +00:00
|
|
|
export default NavigatorExample;
|