Merge branch '132-add-menu-bar-and-basic-navigation' into 'master'
Resolve "add menu bar and basic navigation" Closes #132 See merge request bloodyhealth/drip!53
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { createStackNavigator } from 'react-navigation'
|
import { createStackNavigator, createBottomTabNavigator } from 'react-navigation'
|
||||||
import Home from './components/home'
|
import Home from './components/home'
|
||||||
|
|
||||||
import Calendar from './components/calendar'
|
import Calendar from './components/calendar'
|
||||||
@@ -7,16 +7,28 @@ import Chart from './components/chart/chart'
|
|||||||
import Settings from './components/settings'
|
import Settings from './components/settings'
|
||||||
import Stats from './components/stats'
|
import Stats from './components/stats'
|
||||||
|
|
||||||
|
import styles from './styles'
|
||||||
|
|
||||||
// this is until react native fixes this bugg, see
|
// this is until react native fixes this bugg, see
|
||||||
// https://github.com/facebook/react-native/issues/18868#issuecomment-382671739
|
// https://github.com/facebook/react-native/issues/18868#issuecomment-382671739
|
||||||
import { YellowBox } from 'react-native'
|
import { YellowBox } from 'react-native'
|
||||||
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated'])
|
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated'])
|
||||||
|
|
||||||
export default createStackNavigator({
|
const routes = {
|
||||||
home: { screen: Home },
|
Home: createStackNavigator({Home, CycleDay}, {headerMode: 'none'}),
|
||||||
calendar: { screen: Calendar },
|
Calendar: createStackNavigator({Calendar, CycleDay}, {headerMode: 'none'}),
|
||||||
cycleDay: { screen: CycleDay },
|
Chart: createStackNavigator({Chart, CycleDay}, {headerMode: 'none'}),
|
||||||
chart: { screen: Chart },
|
Settings: { screen: Settings },
|
||||||
settings: { screen: Settings },
|
Stats: { screen: Stats}
|
||||||
stats: { screen: Stats}
|
}
|
||||||
})
|
|
||||||
|
const config = {
|
||||||
|
labeled: true,
|
||||||
|
shifting: false,
|
||||||
|
tabBarOptions: {
|
||||||
|
style: {backgroundColor: '#ff7e5f'},
|
||||||
|
labelStyle: {fontSize: 15, color: 'white'}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default createBottomTabNavigator(routes, config)
|
||||||
@@ -29,7 +29,7 @@ export default class CalendarView extends Component {
|
|||||||
passDateToDayView(result) {
|
passDateToDayView(result) {
|
||||||
const cycleDay = getOrCreateCycleDay(result.dateString)
|
const cycleDay = getOrCreateCycleDay(result.dateString)
|
||||||
const navigate = this.props.navigation.navigate
|
const navigate = this.props.navigation.navigate
|
||||||
navigate('cycleDay', { cycleDay })
|
navigate('CycleDay', { cycleDay })
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
+1
-26
@@ -42,11 +42,10 @@ export default class Home extends Component {
|
|||||||
const todayDateString = LocalDate.now().toString()
|
const todayDateString = LocalDate.now().toString()
|
||||||
const cycleDay = getOrCreateCycleDay(todayDateString)
|
const cycleDay = getOrCreateCycleDay(todayDateString)
|
||||||
const navigate = this.props.navigation.navigate
|
const navigate = this.props.navigation.navigate
|
||||||
navigate('cycleDay', { cycleDay })
|
navigate('CycleDay', { cycleDay })
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const navigate = this.props.navigation.navigate
|
|
||||||
return (
|
return (
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<Text style={styles.welcome}>{this.state.welcomeText}</Text>
|
<Text style={styles.welcome}>{this.state.welcomeText}</Text>
|
||||||
@@ -57,24 +56,6 @@ export default class Home extends Component {
|
|||||||
title="Edit symptoms for today">
|
title="Edit symptoms for today">
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.homeButton}>
|
|
||||||
<Button
|
|
||||||
onPress={() => navigate('calendar')}
|
|
||||||
title="Go to calendar">
|
|
||||||
</Button>
|
|
||||||
</View>
|
|
||||||
<View style={styles.homeButton}>
|
|
||||||
<Button
|
|
||||||
onPress={() => navigate('chart')}
|
|
||||||
title="Go to chart">
|
|
||||||
</Button>
|
|
||||||
</View>
|
|
||||||
<View style={styles.homeButton}>
|
|
||||||
<Button
|
|
||||||
onPress={() => navigate('settings')}
|
|
||||||
title="Go to settings">
|
|
||||||
</Button>
|
|
||||||
</View>
|
|
||||||
<View style={styles.homeButton}>
|
<View style={styles.homeButton}>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => fillWithDummyData()}
|
onPress={() => fillWithDummyData()}
|
||||||
@@ -87,12 +68,6 @@ export default class Home extends Component {
|
|||||||
title="delete everything">
|
title="delete everything">
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.homeButton}>
|
|
||||||
<Button
|
|
||||||
onPress={() => navigate('stats')}
|
|
||||||
title="Go to stats">
|
|
||||||
</Button>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user