Simplify calendar recalculate method
This commit is contained in:
1 parent
d87a856754
commit
d8c8f5034e
1 file changed
+5
-7
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user