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