Adds navigation tree to define the hierarchy

This commit is contained in:
Sofiya Tepikin
2019-11-06 18:58:40 +01:00
parent e479b93638
commit e66ca3f8db
6 changed files with 105 additions and 52 deletions
+8 -7
View File
@@ -7,20 +7,21 @@ import MenuItem from './menu-item'
import { connect } from 'react-redux'
import { getNavigation, navigate } from '../../slices/navigation'
import { menuItems } from './menu-config'
import { pages } from '../pages'
import styles from '../../styles'
const Menu = ({ navigation, navigate }) => {
const Menu = ({ navigate, navigation }) => {
const menuItems = pages.filter(page => page.isInMenu)
return (
<View style={styles.menu}>
{ menuItems.map(({ icon, labelKey, component, children }) => {
const isActive = (component === navigation.current) ||
(children && children.indexOf(navigation.current) !== -1)
{ menuItems.map(({ icon, label, component, children }) => {
const isActive = (component === navigation.currentPage) ||
(children && children.indexOf(navigation.currentPage) !== -1)
return (
<MenuItem
key={labelKey}
labelKey={labelKey}
key={label}
label={label}
icon={icon}
active={isActive}
onPress={() => navigate(component)}