Simplify calendar recalculate method

This commit is contained in:
Julia Friesel
2018-09-17 16:01:21 +02:00
parent d87a856754
commit d8c8f5034e
+5 -7
View File
@@ -18,19 +18,17 @@ export default class CalendarView extends Component {
todayInCalFormat: todayToCalFormat()
}
this.setStateWithCalFormattedDays = (function (CalendarComponent) {
return function() {
this.bleedingDays.addListener(this.setStateWithCalFormattedDays)
}
setStateWithCalFormattedDays = () => {
const predictedMenses = cycleModule().getPredictedMenses()
CalendarComponent.setState({
this.setState({
bleedingDaysInCalFormat: toCalFormat(this.bleedingDays),
predictedBleedingDaysInCalFormat: predictionToCalFormat(predictedMenses),
todayInCalFormat: todayToCalFormat()
})
}
})(this)
this.bleedingDays.addListener(this.setStateWithCalFormattedDays)
}
componentWillUnmount() {
this.bleedingDays.removeListener(this.setStateWithCalFormattedDays)