Position footer and fix navigating to cycle day view
This commit is contained in:
@@ -23,15 +23,23 @@ export default class App extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
navigate(pageName) {
|
navigate(pageName, props) {
|
||||||
this.setState({currentPage: pageName})
|
this.setState({currentPage: pageName, currentProps: props})
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
<View style={{height: '100%', justifyContent: 'space-between' }}>
|
||||||
<View>
|
<View>
|
||||||
<Header title={this.state.currentPage}/>
|
{this.state.currentPage != 'CycleDay' && <Header title={this.state.currentPage}/>}
|
||||||
<CurrentPage page={this.state.currentPage} />
|
<View>
|
||||||
|
<CurrentPage
|
||||||
|
page={this.state.currentPage}
|
||||||
|
navigate={this.navigate.bind(this)}
|
||||||
|
props={this.state.currentProps}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
<Menu navigate={this.navigate.bind(this)} />
|
<Menu navigate={this.navigate.bind(this)} />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
@@ -40,10 +48,13 @@ export default class App extends Component {
|
|||||||
|
|
||||||
class CurrentPage extends Component {
|
class CurrentPage extends Component {
|
||||||
render () {
|
render () {
|
||||||
console.log('urrentpage render')
|
|
||||||
const page = {
|
const page = {
|
||||||
Home, Calendar, CycleDay, SymptomView, Chart, Settings, Stats
|
Home, Calendar, CycleDay, SymptomView, Chart, Settings, Stats
|
||||||
}[this.props.page]
|
}[this.props.page]
|
||||||
return React.createElement(page)
|
const props = this.props.props || {}
|
||||||
|
return React.createElement(page, {
|
||||||
|
navigate: this.props.navigate,
|
||||||
|
...props
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ export default class CycleDayOverView extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
cycleDay: props.navigation.state.params.cycleDay
|
cycleDay: props.cycleDay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ export default class CycleDayOverView extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigate(symptom) {
|
navigate(symptom) {
|
||||||
this.props.navigation.navigate('SymptomView', {
|
this.props.navigate('SymptomView', {
|
||||||
symptom,
|
symptom,
|
||||||
cycleDay: this.state.cycleDay
|
cycleDay: this.state.cycleDay
|
||||||
})
|
})
|
||||||
@@ -53,7 +53,7 @@ export default class CycleDayOverView extends Component {
|
|||||||
return (
|
return (
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<Header
|
<Header
|
||||||
cycleDayOverView={true}
|
isCycleDayOverView={true}
|
||||||
cycleDayNumber={cycleDayNumber}
|
cycleDayNumber={cycleDayNumber}
|
||||||
date={cycleDay.date}
|
date={cycleDay.date}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { formatDateForViewHeader } from '../components/cycle-day/labels/format'
|
|||||||
export default class Header extends Component {
|
export default class Header extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
this.props.cycleDayOverView ?
|
this.props.isCycleDayOverView ?
|
||||||
<View style={[styles.header, styles.headerCycleDay]}>
|
<View style={[styles.header, styles.headerCycleDay]}>
|
||||||
<Icon
|
<Icon
|
||||||
name='arrow-left-drop-circle'
|
name='arrow-left-drop-circle'
|
||||||
|
|||||||
+1
-2
@@ -6,7 +6,6 @@ import {
|
|||||||
ScrollView
|
ScrollView
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import { LocalDate } from 'js-joda'
|
import { LocalDate } from 'js-joda'
|
||||||
import Header from './header'
|
|
||||||
import styles from '../styles/index'
|
import styles from '../styles/index'
|
||||||
import cycleModule from '../lib/cycle'
|
import cycleModule from '../lib/cycle'
|
||||||
import { getOrCreateCycleDay, bleedingDaysSortedByDate, fillWithDummyData, deleteAll } from '../db'
|
import { getOrCreateCycleDay, bleedingDaysSortedByDate, fillWithDummyData, deleteAll } from '../db'
|
||||||
@@ -42,7 +41,7 @@ export default class Home extends Component {
|
|||||||
passTodayToDayView() {
|
passTodayToDayView() {
|
||||||
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.navigate
|
||||||
navigate('CycleDay', { cycleDay })
|
navigate('CycleDay', { cycleDay })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ export default class Menu extends Component {
|
|||||||
placeActionButtons()
|
placeActionButtons()
|
||||||
:
|
:
|
||||||
<View style={styles.menu}>
|
<View style={styles.menu}>
|
||||||
|
<Text
|
||||||
|
style={styles.dateHeader}
|
||||||
|
onPress={() => this.props.navigate('Home')}
|
||||||
|
>
|
||||||
|
{'Home'}
|
||||||
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
style={styles.dateHeader}
|
style={styles.dateHeader}
|
||||||
onPress={() => this.props.navigate('Calendar')}
|
onPress={() => this.props.navigate('Calendar')}
|
||||||
|
|||||||
+2
-1
@@ -106,7 +106,8 @@ export default StyleSheet.create({
|
|||||||
paddingVertical: 18,
|
paddingVertical: 18,
|
||||||
paddingHorizontal: 15,
|
paddingHorizontal: 15,
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center'
|
justifyContent: 'space-evenly',
|
||||||
|
flexDirection: 'row',
|
||||||
},
|
},
|
||||||
headerCycleDay: {
|
headerCycleDay: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
|
|||||||
Reference in New Issue
Block a user