Makes also the subpages of Settings to activate the menu item in footer
This commit is contained in:
+9
-4
@@ -5,6 +5,8 @@ import {
|
|||||||
TouchableOpacity
|
TouchableOpacity
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
|
|
||||||
|
import settingsViews from './settings'
|
||||||
|
|
||||||
import { menuTitles } from '../i18n/en/labels'
|
import { menuTitles } from '../i18n/en/labels'
|
||||||
|
|
||||||
import styles, { iconStyles, secondaryColor } from '../styles'
|
import styles, { iconStyles, secondaryColor } from '../styles'
|
||||||
@@ -19,7 +21,7 @@ const menuItems = [
|
|||||||
{
|
{
|
||||||
labelKey: 'Home',
|
labelKey: 'Home',
|
||||||
icon: 'home',
|
icon: 'home',
|
||||||
component: 'Home'
|
component: 'Home',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
labelKey: 'Calendar',
|
labelKey: 'Calendar',
|
||||||
@@ -29,7 +31,7 @@ const menuItems = [
|
|||||||
{
|
{
|
||||||
labelKey: 'Chart',
|
labelKey: 'Chart',
|
||||||
icon: 'chart-line',
|
icon: 'chart-line',
|
||||||
component: 'Chart'
|
component: 'Chart',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
labelKey: 'Stats',
|
labelKey: 'Stats',
|
||||||
@@ -40,6 +42,7 @@ const menuItems = [
|
|||||||
labelKey: 'Settings',
|
labelKey: 'Settings',
|
||||||
icon: 'settings',
|
icon: 'settings',
|
||||||
component: 'SettingsMenu',
|
component: 'SettingsMenu',
|
||||||
|
children: Object.keys(settingsViews),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -61,13 +64,15 @@ const MenuItem = ({ icon, labelKey, active, onPress }) => {
|
|||||||
const Menu = ({ currentPage, navigate }) => {
|
const Menu = ({ currentPage, navigate }) => {
|
||||||
return (
|
return (
|
||||||
<View style={styles.menu}>
|
<View style={styles.menu}>
|
||||||
{ menuItems.map(({ icon, labelKey, component }) => {
|
{ menuItems.map(({ icon, labelKey, component, children }) => {
|
||||||
|
const isActive = (component === currentPage) ||
|
||||||
|
(children && children.indexOf(currentPage) !== -1)
|
||||||
return (
|
return (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={labelKey}
|
key={labelKey}
|
||||||
labelKey={labelKey}
|
labelKey={labelKey}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
active={component === currentPage}
|
active={isActive}
|
||||||
onPress={() => navigate(component)}
|
onPress={() => navigate(component)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user