Last active
November 22, 2016 09:07
-
-
Save JWPapi/12cd5c8ca33f3a8ba83095b3551d8be9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component, PropTypes} from 'react' | |
import MainPage from './MainPage' | |
import ClubOverview from './ClubOverview' | |
import Board from './Board' | |
import {Page, Navigator, Tabbar, Tab} from 'react-onsenui' | |
require('moment/locale/de') | |
class Tabs extends Component { | |
constructor (props) { | |
super(props) | |
this.state = { | |
index: 1 | |
} | |
} | |
render () { | |
return ( | |
<Page renderBottomToolbar={() => <Tabbar index={this.state.index} onPreChange={event => { | |
if (event.index !== this.state.index) { | |
this.setState({index: event.index}) | |
} | |
}} renderTabs={() => [ | |
{ | |
content: <MainPage key='MainPage' navigator={this.props.navigator} />, | |
tab: <Tab key='Events' label='Events' icon='fa-calendar'/> | |
}, | |
{ | |
content: <ClubOverview key='ClubOverview' navigator={this.props.navigator}/>, | |
tab: <Tab key='Clubs' label='Clubs' icon='fa-glass'/> | |
}, { | |
content: <Board key='Board' navigator={this.props.navigator} />, | |
tab: <Tab key='Board' label='Board' icon='fa-comments'/> | |
} | |
]}/> } /> | |
) | |
} | |
} | |
Tabs.propTypes = { | |
navigator: PropTypes.object | |
} | |
const App = () => { | |
const renderPage = (route, navigator) => { | |
return <route.component key={route.key} navigator={navigator} {...route.props}/> | |
} | |
return <Navigator renderPage={renderPage} initialRoute={{component: Tabs, key: 'Tabs'}}/> | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment