diff --git a/app.js b/app.js
index 0baccba..58b22ae 100644
--- a/app.js
+++ b/app.js
@@ -1,6 +1,8 @@
-import { createStackNavigator, createBottomTabNavigator } from 'react-navigation'
+import React, { Component } from 'react'
+import { View } from 'react-native'
+import Header from './components/header'
+import Menu from './components/menu'
import Home from './components/home'
-
import Calendar from './components/calendar'
import CycleDay from './components/cycle-day/cycle-day-overview'
import SymptomView from './components/cycle-day/symptoms'
@@ -8,30 +10,40 @@ import Chart from './components/chart/chart'
import Settings from './components/settings'
import Stats from './components/stats'
-import styles, { primaryColor } from './styles'
-
// this is until react native fixes this bugg, see
// https://github.com/facebook/react-native/issues/18868#issuecomment-382671739
import { YellowBox } from 'react-native'
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated'])
-const CycleDayStack = createStackNavigator({CycleDay, SymptomView}, {headerMode: 'none'})
+export default class App extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ currentPage: 'Home'
+ }
+ }
-const routes = {
- Home: createStackNavigator({Home, CycleDayStack}, {headerMode: 'none'}),
- Calendar: createStackNavigator({Calendar, CycleDayStack}, {headerMode: 'none'}),
- Chart: createStackNavigator({Chart, CycleDay}, {headerMode: 'none'}),
- Settings: { screen: Settings },
- Stats: { screen: Stats}
-}
+ navigate(pageName) {
+ this.setState({currentPage: pageName})
+ }
-const config = {
- labeled: true,
- shifting: false,
- tabBarOptions: {
- style: {backgroundColor: primaryColor },
- labelStyle: styles.menuLabel
+ render() {
+ return (
+
+
+ )
}
}
-export default createBottomTabNavigator(routes, config)
\ No newline at end of file
+class CurrentPage extends Component {
+ render () {
+ console.log('urrentpage render')
+ const page = {
+ Home, Calendar, CycleDay, SymptomView, Chart, Settings, Stats
+ }[this.props.page]
+ return React.createElement(page)
+ }
+}
\ No newline at end of file
diff --git a/components/calendar.js b/components/calendar.js
index dbff83c..3159b0c 100644
--- a/components/calendar.js
+++ b/components/calendar.js
@@ -1,7 +1,6 @@
import React, { Component } from 'react'
import { View } from 'react-native'
import { CalendarList } from 'react-native-calendars'
-import Header from './header'
import * as styles from '../styles'
import { getOrCreateCycleDay, bleedingDaysSortedByDate } from '../db'
@@ -11,9 +10,11 @@ export default class CalendarView extends Component {
this.state = {
bleedingDaysInCalFormat: toCalFormat(bleedingDaysSortedByDate)
}
+ console.log(Object.keys(this.state.bleedingDaysInCalFormat))
this.setStateWithCalFormattedDays = (function (CalendarComponent) {
- return function() {
+ return function(_, changes) {
+ if (Object.values(changes).every(x => x && !x.length)) return
CalendarComponent.setState({
bleedingDaysInCalFormat: toCalFormat(bleedingDaysSortedByDate)
})
@@ -34,9 +35,9 @@ export default class CalendarView extends Component {
}
render() {
+ console.log('cal render')
return (
-
-
{this.state.welcomeText}
diff --git a/components/menu.js b/components/menu.js
new file mode 100644
index 0000000..ea95b1f
--- /dev/null
+++ b/components/menu.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react'
+import {
+ View,
+ Text
+} from 'react-native'
+import styles, { iconStyles } from '../styles'
+import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
+
+export default class Menu extends Component {
+ render() {
+ return (
+ this.props.symptomView ?
+ placeActionButtons()
+ :
+
+ this.props.navigate('Calendar')}
+ >
+ {'Calendar'}
+
+ this.props.navigate('Settings')}
+ >
+ {'Settings'}
+
+
+ )
+ }
+}
+
+function placeActionButtons() {}
\ No newline at end of file
diff --git a/styles/index.js b/styles/index.js
index f55ef4e..a89d5ca 100644
--- a/styles/index.js
+++ b/styles/index.js
@@ -82,6 +82,13 @@ export default StyleSheet.create({
alignItems: 'center',
justifyContent: 'center'
},
+ menu: {
+ backgroundColor: primaryColor,
+ paddingVertical: 18,
+ paddingHorizontal: 15,
+ alignItems: 'center',
+ justifyContent: 'center'
+ },
headerCycleDay: {
flexDirection: 'row',
justifyContent: 'space-between'