Fix redirect to TemperatureEditView from reminder
This commit is contained in:
@@ -65,6 +65,7 @@ class App extends Component {
|
||||
const title = headerTitles[currentPage]
|
||||
|
||||
const isSettingsSubView = isSettingsView(currentPage)
|
||||
const isTemperatureEditView = currentPage === 'TemperatureEditView'
|
||||
|
||||
const headerProps = {
|
||||
title,
|
||||
@@ -74,6 +75,7 @@ class App extends Component {
|
||||
const pageProps = {
|
||||
cycleDay: date && getCycleDay(date),
|
||||
date,
|
||||
isTemperatureEditView,
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import { StyleSheet, View } from 'react-native'
|
||||
import PropTypes from 'prop-types'
|
||||
import { LocalDate } from 'js-joda'
|
||||
|
||||
import AppPage from '../common/app-page'
|
||||
import SymptomBox from './symptom-box'
|
||||
@@ -26,12 +27,17 @@ class CycleDayOverView extends Component {
|
||||
setDate: PropTypes.func,
|
||||
cycleDay: PropTypes.object,
|
||||
date: PropTypes.string,
|
||||
isTemperatureEditView: PropTypes.bool,
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.state = { cycleDay: getCycleDay(props.date), data: null }
|
||||
if (props.isTemperatureEditView) {
|
||||
const todayDateString = LocalDate.now().toString()
|
||||
props.setDate(todayDateString)
|
||||
}
|
||||
}
|
||||
|
||||
updateCycleDay = (date) => {
|
||||
@@ -41,7 +47,7 @@ class CycleDayOverView extends Component {
|
||||
|
||||
render() {
|
||||
const { cycleDay } = this.state
|
||||
const { date } = this.props
|
||||
const { date, isTemperatureEditView } = this.props
|
||||
|
||||
const { getCycleDayNumber } = cycleModule()
|
||||
const cycleDayNumber = getCycleDayNumber(date)
|
||||
@@ -59,6 +65,8 @@ class CycleDayOverView extends Component {
|
||||
const symptomData = cycleDay && cycleDay[symptom]
|
||||
? cycleDay[symptom] : null
|
||||
|
||||
const isSymptomEdited = isTemperatureEditView && symptom === 'temperature'
|
||||
|
||||
return(
|
||||
<SymptomBox
|
||||
key={symptom}
|
||||
@@ -66,6 +74,7 @@ class CycleDayOverView extends Component {
|
||||
symptomData={symptomData}
|
||||
symptomDataToDisplay={getData(symptom, symptomData)}
|
||||
updateCycleDayData={this.updateCycleDay}
|
||||
isSymptomEdited={isSymptomEdited}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
|
||||
@@ -17,16 +17,23 @@ class SymptomBox extends Component {
|
||||
|
||||
static propTypes = {
|
||||
date: PropTypes.string.isRequired,
|
||||
isSymptomEdited: PropTypes.bool,
|
||||
symptom: PropTypes.string.isRequired,
|
||||
symptomData: PropTypes.object,
|
||||
symptomDataToDisplay: PropTypes.string,
|
||||
updateCycleDayData: PropTypes.func.isRequired
|
||||
updateCycleDayData: PropTypes.func.isRequired,
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
isSymptomEdited: false,
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.state = { isSymptomEdited: false }
|
||||
this.state = {
|
||||
isSymptomEdited: props.isSymptomEdited
|
||||
}
|
||||
}
|
||||
|
||||
onFinishEditing = () => {
|
||||
@@ -158,4 +165,4 @@ const mapStateToProps = (state) => {
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
null,
|
||||
)(SymptomBox)
|
||||
)(SymptomBox)
|
||||
|
||||
+2
-1
@@ -10,8 +10,9 @@ export const viewsList = {
|
||||
Home,
|
||||
Calendar,
|
||||
CycleDay,
|
||||
TemperatureEditView: CycleDay,
|
||||
Chart,
|
||||
SettingsMenu,
|
||||
...settingsViews,
|
||||
Stats
|
||||
Stats,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {tempReminderObservable, periodReminderObservable} from '../local-storage'
|
||||
import Notification from 'react-native-push-notification'
|
||||
import { LocalDate } from 'js-joda'
|
||||
import Moment from 'moment'
|
||||
import labels from '../i18n/en/settings'
|
||||
import { getBleedingDaysSortedByDate } from '../db'
|
||||
@@ -11,7 +10,7 @@ export default function setupNotifications(navigate) {
|
||||
Notification.configure({
|
||||
onNotification: (notification) => {
|
||||
if (notification.id === '1') {
|
||||
navigate('TemperatureEditView', { date: LocalDate.now().toString() })
|
||||
navigate('TemperatureEditView')
|
||||
} else {
|
||||
navigate('Home')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user