615 Use translation library for bottom menu

This commit is contained in:
Lisa Hillebrand
2022-09-30 11:39:00 +02:00
parent 9dfe8b4b05
commit 36c33c69b7
3 changed files with 14 additions and 6 deletions
+6 -3
View File
@@ -6,20 +6,23 @@ import MenuItem from './menu-item'
import { Containers } from '../../styles'
import { pages } from '../pages'
import { useTranslation } from 'react-i18next'
const Menu = ({ currentPage, navigate }) => {
const menuItems = pages.filter((page) => page.isInMenu)
const { t } = useTranslation(null, { keyPrefix: 'bottomMenu' })
return (
<View style={styles.container}>
{menuItems.map(({ icon, label, component }) => {
{menuItems.map(({ icon, labelKey, component }) => {
return (
<MenuItem
isActive={component === currentPage}
onPress={() => navigate(component)}
icon={icon}
key={label}
label={label}
key={labelKey}
label={t(labelKey)}
/>
)
})}
+3 -3
View File
@@ -13,21 +13,21 @@ export const pages = [
component: 'Calendar',
icon: 'calendar',
isInMenu: true,
label: 'Calendar',
labelKey: 'calendar',
parent: 'Home',
},
{
component: 'Chart',
icon: 'chart',
isInMenu: true,
label: 'Chart',
labelKey: 'chart',
parent: 'Home',
},
{
component: 'Stats',
icon: 'statistics',
isInMenu: true,
label: 'Stats',
labelKey: 'stats',
parent: 'Home',
},
{
+5
View File
@@ -1,4 +1,9 @@
{
"bottomMenu": {
"calendar": "Calendar",
"chart": "Chart",
"stats": "Stats"
},
"cycleDay": {
"symptomBox": {
"bleeding": "Bleeding",