Fixes the cycle day data is not being passed to the symptom view
This commit is contained in:
+7
-7
@@ -33,7 +33,8 @@ class App extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
currentPage: HOME_PAGE
|
currentPage: HOME_PAGE,
|
||||||
|
cycleDay: {},
|
||||||
}
|
}
|
||||||
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonPress)
|
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonPress)
|
||||||
setupNotifications(this.navigate)
|
setupNotifications(this.navigate)
|
||||||
@@ -43,7 +44,7 @@ class App extends Component {
|
|||||||
this.backHandler.remove()
|
this.backHandler.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
navigate = (pageName, props) => {
|
navigate = (pageName, cycleDay) => {
|
||||||
const { currentPage } = this.state
|
const { currentPage } = this.state
|
||||||
// for the back button to work properly, we want to
|
// for the back button to work properly, we want to
|
||||||
// remember two origins: which menu item we came from
|
// remember two origins: which menu item we came from
|
||||||
@@ -55,7 +56,7 @@ class App extends Component {
|
|||||||
if (!this.isSymptomView()) {
|
if (!this.isSymptomView()) {
|
||||||
this.originForSymptomView = currentPage
|
this.originForSymptomView = currentPage
|
||||||
}
|
}
|
||||||
this.setState({ currentPage: pageName, currentProps: props })
|
this.setState({ currentPage: pageName, cycleDay })
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBackButtonPress = () => {
|
handleBackButtonPress = () => {
|
||||||
@@ -65,9 +66,7 @@ class App extends Component {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (this.isSymptomView()) {
|
if (this.isSymptomView()) {
|
||||||
this.navigate(
|
this.navigate(this.originForSymptomView)
|
||||||
this.originForSymptomView, { date: this.props.date }
|
|
||||||
)
|
|
||||||
} else if (this.isSettingsView()) {
|
} else if (this.isSettingsView()) {
|
||||||
this.navigate(SETTINGS_MENU_PAGE)
|
this.navigate(SETTINGS_MENU_PAGE)
|
||||||
} else if (currentPage === CYCLE_DAY_PAGE) {
|
} else if (currentPage === CYCLE_DAY_PAGE) {
|
||||||
@@ -96,7 +95,7 @@ class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { currentPage } = this.state
|
const { currentPage, cycleDay } = this.state
|
||||||
const pages = {
|
const pages = {
|
||||||
Home,
|
Home,
|
||||||
Calendar,
|
Calendar,
|
||||||
@@ -125,6 +124,7 @@ class App extends Component {
|
|||||||
|
|
||||||
<Page
|
<Page
|
||||||
navigate={this.navigate}
|
navigate={this.navigate}
|
||||||
|
cycleDay={cycleDay}
|
||||||
handleBackButtonPress={this.handleBackButtonPress}
|
handleBackButtonPress={this.handleBackButtonPress}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ class CycleDayOverView extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigate(symptom) {
|
navigate(symptom) {
|
||||||
this.props.navigate(symptom)
|
const { cycleDay } = this.state
|
||||||
|
this.props.navigate(symptom, cycleDay)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -77,7 +78,7 @@ class CycleDayOverView extends Component {
|
|||||||
key={symptom}
|
key={symptom}
|
||||||
symptom={symptom}
|
symptom={symptom}
|
||||||
symptomData={symptomData}
|
symptomData={symptomData}
|
||||||
onPress={() => this.navigate(symptomEditView)}
|
onPress={() => this.navigate(symptomEditView, symptomData)}
|
||||||
disabled={dateInFuture}
|
disabled={dateInFuture}
|
||||||
/>)
|
/>)
|
||||||
})
|
})
|
||||||
|
|||||||
+5
-1
@@ -17,6 +17,7 @@ import styles, { cycleDayColor, periodColor, secondaryColor } from '../styles'
|
|||||||
import AppText from './app-text'
|
import AppText from './app-text'
|
||||||
import Button from './button'
|
import Button from './button'
|
||||||
import { formatDateForShortText } from './helpers/format-date'
|
import { formatDateForShortText } from './helpers/format-date'
|
||||||
|
import { getCycleDay } from '../db'
|
||||||
|
|
||||||
const IconText = ({ children, wrapperStyles }) => {
|
const IconText = ({ children, wrapperStyles }) => {
|
||||||
return (
|
return (
|
||||||
@@ -81,7 +82,10 @@ class Home extends Component {
|
|||||||
|
|
||||||
navigateToBleedingEditView = () => {
|
navigateToBleedingEditView = () => {
|
||||||
this.setTodayDate()
|
this.setTodayDate()
|
||||||
this.props.navigate('BleedingEditView')
|
this.props.navigate(
|
||||||
|
'BleedingEditView',
|
||||||
|
getCycleDay(this.todayDateString)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user