Skip to content
Snippets Groups Projects
Commit c3a2eea3 authored by Sofiya Tepikin's avatar Sofiya Tepikin
Browse files

Merge branch 'hotfix-cycleday-data' into 'master'

Fixes the cycle day data is not being passed to the symptom view

See merge request bloodyhealth/drip!242
parents 16cc2cef 525defa1
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,8 @@ class App extends Component {
constructor(props) {
super(props)
this.state = {
currentPage: HOME_PAGE
currentPage: HOME_PAGE,
cycleDay: {},
}
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonPress)
setupNotifications(this.navigate)
......@@ -43,7 +44,7 @@ class App extends Component {
this.backHandler.remove()
}
navigate = (pageName, props) => {
navigate = (pageName, cycleDay) => {
const { currentPage } = this.state
// for the back button to work properly, we want to
// remember two origins: which menu item we came from
......@@ -55,7 +56,7 @@ class App extends Component {
if (!this.isSymptomView()) {
this.originForSymptomView = currentPage
}
this.setState({ currentPage: pageName, currentProps: props })
this.setState({ currentPage: pageName, cycleDay })
}
handleBackButtonPress = () => {
......@@ -65,9 +66,7 @@ class App extends Component {
return false
}
if (this.isSymptomView()) {
this.navigate(
this.originForSymptomView, { date: this.props.date }
)
this.navigate(this.originForSymptomView)
} else if (this.isSettingsView()) {
this.navigate(SETTINGS_MENU_PAGE)
} else if (currentPage === CYCLE_DAY_PAGE) {
......@@ -96,7 +95,7 @@ class App extends Component {
}
render() {
const { currentPage } = this.state
const { currentPage, cycleDay } = this.state
const pages = {
Home,
Calendar,
......@@ -125,6 +124,7 @@ class App extends Component {
<Page
navigate={this.navigate}
cycleDay={cycleDay}
handleBackButtonPress={this.handleBackButtonPress}
/>
......
......@@ -33,7 +33,8 @@ class CycleDayOverView extends Component {
}
navigate(symptom) {
this.props.navigate(symptom)
const { cycleDay } = this.state
this.props.navigate(symptom, cycleDay)
}
render() {
......@@ -77,7 +78,7 @@ class CycleDayOverView extends Component {
key={symptom}
symptom={symptom}
symptomData={symptomData}
onPress={() => this.navigate(symptomEditView)}
onPress={() => this.navigate(symptomEditView, symptomData)}
disabled={dateInFuture}
/>)
})
......
......@@ -17,6 +17,7 @@ import styles, { cycleDayColor, periodColor, secondaryColor } from '../styles'
import AppText from './app-text'
import Button from './button'
import { formatDateForShortText } from './helpers/format-date'
import { getCycleDay } from '../db'
const IconText = ({ children, wrapperStyles }) => {
return (
......@@ -81,7 +82,10 @@ class Home extends Component {
navigateToBleedingEditView = () => {
this.setTodayDate()
this.props.navigate('BleedingEditView')
this.props.navigate(
'BleedingEditView',
getCycleDay(this.todayDateString)
)
}
render() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment