615 Use translation library for bottom menu
This commit is contained in:
@@ -6,20 +6,23 @@ import MenuItem from './menu-item'
|
|||||||
|
|
||||||
import { Containers } from '../../styles'
|
import { Containers } from '../../styles'
|
||||||
import { pages } from '../pages'
|
import { pages } from '../pages'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
const Menu = ({ currentPage, navigate }) => {
|
const Menu = ({ currentPage, navigate }) => {
|
||||||
const menuItems = pages.filter((page) => page.isInMenu)
|
const menuItems = pages.filter((page) => page.isInMenu)
|
||||||
|
|
||||||
|
const { t } = useTranslation(null, { keyPrefix: 'bottomMenu' })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
{menuItems.map(({ icon, label, component }) => {
|
{menuItems.map(({ icon, labelKey, component }) => {
|
||||||
return (
|
return (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
isActive={component === currentPage}
|
isActive={component === currentPage}
|
||||||
onPress={() => navigate(component)}
|
onPress={() => navigate(component)}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
key={label}
|
key={labelKey}
|
||||||
label={label}
|
label={t(labelKey)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
|||||||
+3
-3
@@ -13,21 +13,21 @@ export const pages = [
|
|||||||
component: 'Calendar',
|
component: 'Calendar',
|
||||||
icon: 'calendar',
|
icon: 'calendar',
|
||||||
isInMenu: true,
|
isInMenu: true,
|
||||||
label: 'Calendar',
|
labelKey: 'calendar',
|
||||||
parent: 'Home',
|
parent: 'Home',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Chart',
|
component: 'Chart',
|
||||||
icon: 'chart',
|
icon: 'chart',
|
||||||
isInMenu: true,
|
isInMenu: true,
|
||||||
label: 'Chart',
|
labelKey: 'chart',
|
||||||
parent: 'Home',
|
parent: 'Home',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Stats',
|
component: 'Stats',
|
||||||
icon: 'statistics',
|
icon: 'statistics',
|
||||||
isInMenu: true,
|
isInMenu: true,
|
||||||
label: 'Stats',
|
labelKey: 'stats',
|
||||||
parent: 'Home',
|
parent: 'Home',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"bottomMenu": {
|
||||||
|
"calendar": "Calendar",
|
||||||
|
"chart": "Chart",
|
||||||
|
"stats": "Stats"
|
||||||
|
},
|
||||||
"cycleDay": {
|
"cycleDay": {
|
||||||
"symptomBox": {
|
"symptomBox": {
|
||||||
"bleeding": "Bleeding",
|
"bleeding": "Bleeding",
|
||||||
|
|||||||
Reference in New Issue
Block a user