Moves navigation to the state

This commit is contained in:
Sofiya Tepikin
2019-09-15 18:59:11 +02:00
parent f444de0b87
commit e479b93638
13 changed files with 254 additions and 202 deletions
+3 -6
View File
@@ -3,6 +3,7 @@ import { ScrollView, View } from 'react-native'
import { connect } from 'react-redux'
import { getDate, setDate } from '../../slices/date'
import { navigate } from '../../slices/navigation'
import { LocalDate } from 'js-joda'
import Header from '../header'
@@ -41,11 +42,6 @@ class CycleDayOverView extends Component {
this.updateCycleDay(nextDate)
}
navigate(symptom) {
const { cycleDay } = this.state
this.props.navigate(symptom, cycleDay)
}
render() {
const { cycleDay } = this.state
const { date } = this.props
@@ -89,7 +85,7 @@ class CycleDayOverView extends Component {
key={symptom}
symptom={symptom}
symptomData={symptomData}
onPress={() => this.navigate(symptomEditView, symptomData)}
onPress={() => this.props.navigate(symptomEditView)}
disabled={dateInFuture}
/>)
})
@@ -115,6 +111,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return({
setDate: (date) => dispatch(setDate(date)),
navigate: (page) => dispatch(navigate(page)),
})
}