Add db change listener

This commit is contained in:
Julia Friesel
2018-06-08 17:47:08 +02:00
parent 291992f49a
commit 2bd0a144ec
+4 -2
View File
@@ -4,14 +4,16 @@ import { Calendar } from 'react-native-calendars'
import * as styles from './styles'
import { getOrCreateCycleDay, bleedingDaysSortedByDate } from './db'
export default class DatePickView extends Component {
constructor(props) {
super(props)
this.state = {
cycleDays: bleedingDaysSortedByDate
}
// so we rerender the calendar when there are new bleeding days
bleedingDaysSortedByDate.addListener(() => {
this.setState({ cycleDays: bleedingDaysSortedByDate })
})
}
passDateToDayView(result) {