Merge branch '258-phase-on-home-screen-seems-to-always-be-2' into 'master'
Fix cycle status edge case Closes #258 See merge request bloodyhealth/drip!128
This commit is contained in:
@@ -9,7 +9,6 @@ import { getCycleDaysSortedByDate } from '../db'
|
||||
import { getFertilityStatusForDay } from '../lib/sympto-adapter'
|
||||
import styles from '../styles'
|
||||
import AppText, { AppTextLight } from './app-text'
|
||||
import nothingChanged from '../db/db-unchanged'
|
||||
import DripHomeIcon from '../assets/drip-home-icons'
|
||||
|
||||
const HomeButton = ({ backgroundColor, children }) => {
|
||||
@@ -42,23 +41,6 @@ export default class Home extends Component {
|
||||
}
|
||||
|
||||
this.cycleDays = getCycleDaysSortedByDate()
|
||||
this.cycleDays.addListener(this.updateState)
|
||||
}
|
||||
|
||||
updateState = (_, changes) => {
|
||||
if (nothingChanged(changes)) return
|
||||
const prediction = this.getBleedingPrediction()
|
||||
const fertilityStatus = getFertilityStatusForDay(this.todayDateString)
|
||||
this.setState({
|
||||
cycleDayNumber: this.getCycleDayNumber(this.todayDateString),
|
||||
predictionText: determinePredictionText(prediction),
|
||||
bleedingPredictionRange: getBleedingPredictionRange(prediction),
|
||||
...fertilityStatus
|
||||
})
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.cycleDays.removeListener(this.updateState)
|
||||
}
|
||||
|
||||
passTodayTo(componentName) {
|
||||
|
||||
Reference in New Issue
Block a user