Fix back behavior
This commit is contained in:
+5
-1
@@ -7,6 +7,7 @@ import Calendar from './calendar'
|
|||||||
import CycleDay from './cycle-day/cycle-day-overview'
|
import CycleDay from './cycle-day/cycle-day-overview'
|
||||||
import symptomViews from './cycle-day/symptoms'
|
import symptomViews from './cycle-day/symptoms'
|
||||||
import Chart from './chart/chart'
|
import Chart from './chart/chart'
|
||||||
|
import SettingsMenu from './settings/settings-menu'
|
||||||
import settingsViews from './settings'
|
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'
|
||||||
@@ -24,6 +25,7 @@ const menuTitlesLowerCase = Object.keys(menuTitles).reduce((acc, curr) => {
|
|||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
const isSymptomView = name => Object.keys(symptomViews).includes(name)
|
const isSymptomView = name => Object.keys(symptomViews).includes(name)
|
||||||
|
const isSettingsView = name => Object.keys(settingsViews).includes(name)
|
||||||
const isMenuItem = name => Object.keys(menuTitles).includes(name)
|
const isMenuItem = name => Object.keys(menuTitles).includes(name)
|
||||||
|
|
||||||
export default class App extends Component {
|
export default class App extends Component {
|
||||||
@@ -58,6 +60,8 @@ export default class App extends Component {
|
|||||||
this.navigate(
|
this.navigate(
|
||||||
this.originForSymptomView, { date: this.state.currentProps.date }
|
this.originForSymptomView, { date: this.state.currentProps.date }
|
||||||
)
|
)
|
||||||
|
} else if (isSettingsView(this.state.currentPage)) {
|
||||||
|
this.navigate('SettingsMenu')
|
||||||
} else if(this.state.currentPage === 'CycleDay') {
|
} else if(this.state.currentPage === 'CycleDay') {
|
||||||
this.navigate(this.menuOrigin)
|
this.navigate(this.menuOrigin)
|
||||||
} else {
|
} else {
|
||||||
@@ -68,7 +72,7 @@ export default class App extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const page = {
|
const page = {
|
||||||
Home, Calendar, CycleDay, Chart, ...settingsViews, Stats, ...symptomViews
|
Home, Calendar, CycleDay, Chart, SettingsMenu, ...settingsViews, Stats, ...symptomViews
|
||||||
}[this.state.currentPage]
|
}[this.state.currentPage]
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={{flex: 1}}>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import SettingsMenu from './settings-menu'
|
|
||||||
import Reminders from './reminders'
|
import Reminders from './reminders'
|
||||||
import NfpSettings from './nfp-settings'
|
import NfpSettings from './nfp-settings'
|
||||||
import ImportExport from './import-export'
|
import ImportExport from './import-export'
|
||||||
@@ -6,5 +5,5 @@ import Password from './password'
|
|||||||
import About from './about'
|
import About from './about'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
SettingsMenu, Reminders, NfpSettings, ImportExport, Password, About
|
Reminders, NfpSettings, ImportExport, Password, About
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user