Fixes reopenning after back button
This commit is contained in:
+5
-1
@@ -12,6 +12,7 @@ import settingsViews from './settings'
|
|||||||
import Stats from './stats'
|
import Stats from './stats'
|
||||||
import {headerTitles, menuTitles} from '../i18n/en/labels'
|
import {headerTitles, menuTitles} from '../i18n/en/labels'
|
||||||
import setupNotifications from '../lib/notifications'
|
import setupNotifications from '../lib/notifications'
|
||||||
|
import { closeDb } from '../db'
|
||||||
|
|
||||||
// design wants everyhting lowercased, but we don't
|
// design wants everyhting lowercased, but we don't
|
||||||
// have CSS pseudo properties
|
// have CSS pseudo properties
|
||||||
@@ -55,7 +56,10 @@ export default class App extends Component {
|
|||||||
|
|
||||||
handleBackButtonPress = () => {
|
handleBackButtonPress = () => {
|
||||||
const { currentPage, currentProps } = this.state
|
const { currentPage, currentProps } = this.state
|
||||||
if (currentPage === HOME_PAGE) return false
|
if (currentPage === HOME_PAGE) {
|
||||||
|
closeDb()
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (this.isSymptomView()) {
|
if (this.isSymptomView()) {
|
||||||
this.navigate(
|
this.navigate(
|
||||||
this.originForSymptomView, { date: currentProps.date }
|
this.originForSymptomView, { date: currentProps.date }
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ export async function openDb (hash) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function closeDb() {
|
||||||
|
db.close()
|
||||||
|
}
|
||||||
|
|
||||||
export function getBleedingDaysSortedByDate() {
|
export function getBleedingDaysSortedByDate() {
|
||||||
return db.objects('CycleDay').filtered('bleeding != null').sorted('date', true)
|
return db.objects('CycleDay').filtered('bleeding != null').sorted('date', true)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user