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) {
|
||||
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}
|
||||
/>)
|
||||
})
|
||||
|
||||
+5
-1
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user