From 5136b9f8e6635ea337a0faa0087deddab4897198 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Thu, 16 Aug 2018 16:12:12 +0200 Subject: [PATCH 1/3] Introduce bottom menu --- app.js | 25 ++++++++++++++++--------- components/calendar.js | 2 +- components/home.js | 27 +-------------------------- 3 files changed, 18 insertions(+), 36 deletions(-) diff --git a/app.js b/app.js index fae73d6..2c567ba 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,4 @@ -import { createStackNavigator } from 'react-navigation' +import { createStackNavigator, createBottomTabNavigator } from 'react-navigation' import Home from './components/home' import Calendar from './components/calendar' @@ -12,11 +12,18 @@ import Stats from './components/stats' import { YellowBox } from 'react-native' YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated']) -export default createStackNavigator({ - home: { screen: Home }, - calendar: { screen: Calendar }, - cycleDay: { screen: CycleDay }, - chart: { screen: Chart }, - settings: { screen: Settings }, - stats: { screen: Stats} -}) +const routes = { + Home: { screen: Home }, + Calendar: createStackNavigator({Calendar, CycleDay}), + Chart: createStackNavigator({Chart, CycleDay}), + Settings: { screen: Settings }, + Stats: { screen: Stats} +} + +const config = { + labeled: true, + shifting: false, + backBehavior: 'none' +} + +export default createBottomTabNavigator(routes, config) \ No newline at end of file diff --git a/components/calendar.js b/components/calendar.js index b447bf2..4aa7f13 100644 --- a/components/calendar.js +++ b/components/calendar.js @@ -29,7 +29,7 @@ export default class CalendarView extends Component { passDateToDayView(result) { const cycleDay = getOrCreateCycleDay(result.dateString) const navigate = this.props.navigation.navigate - navigate('cycleDay', { cycleDay }) + navigate('CycleDay', { cycleDay }) } render() { diff --git a/components/home.js b/components/home.js index 315ea50..5381e3b 100644 --- a/components/home.js +++ b/components/home.js @@ -42,11 +42,10 @@ export default class Home extends Component { const todayDateString = LocalDate.now().toString() const cycleDay = getOrCreateCycleDay(todayDateString) const navigate = this.props.navigation.navigate - navigate('cycleDay', { cycleDay }) + navigate('CycleDay', { cycleDay }) } render() { - const navigate = this.props.navigation.navigate return ( {this.state.welcomeText} @@ -57,24 +56,6 @@ export default class Home extends Component { title="Edit symptoms for today"> - - - - - - - - - - - - ) From e55a18885b8accde9d44e4798652006008336e61 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Thu, 16 Aug 2018 16:33:55 +0200 Subject: [PATCH 2/3] Remove header and add color --- app.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 2c567ba..d9a6c6b 100644 --- a/app.js +++ b/app.js @@ -7,6 +7,8 @@ import Chart from './components/chart/chart' import Settings from './components/settings' import Stats from './components/stats' +import styles 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' @@ -14,8 +16,8 @@ YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated']) const routes = { Home: { screen: Home }, - Calendar: createStackNavigator({Calendar, CycleDay}), - Chart: createStackNavigator({Chart, CycleDay}), + Calendar: createStackNavigator({Calendar, CycleDay}, {headerMode: 'none'}), + Chart: createStackNavigator({Chart, CycleDay}, {headerMode: 'none'}), Settings: { screen: Settings }, Stats: { screen: Stats} } @@ -23,7 +25,10 @@ const routes = { const config = { labeled: true, shifting: false, - backBehavior: 'none' + tabBarOptions: { + style: {backgroundColor: '#ff7e5f'}, + labelStyle: {fontSize: 15, color: 'white'} + }, } export default createBottomTabNavigator(routes, config) \ No newline at end of file From 7d3941a8fd85482a4249c08528c5bb5f3dae9714 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Thu, 16 Aug 2018 16:44:51 +0200 Subject: [PATCH 3/3] Add stack for home screen --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index d9a6c6b..7735256 100644 --- a/app.js +++ b/app.js @@ -15,7 +15,7 @@ import { YellowBox } from 'react-native' YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated']) const routes = { - Home: { screen: Home }, + Home: createStackNavigator({Home, CycleDay}, {headerMode: 'none'}), Calendar: createStackNavigator({Calendar, CycleDay}, {headerMode: 'none'}), Chart: createStackNavigator({Chart, CycleDay}, {headerMode: 'none'}), Settings: { screen: Settings },