diff --git a/front/components/navigators/TabRowNavigator.tsx b/front/components/navigators/TabRowNavigator.tsx index 8c2d9d5..e60cbc1 100644 --- a/front/components/navigators/TabRowNavigator.tsx +++ b/front/components/navigators/TabRowNavigator.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { StyleProp, ViewStyle, StyleSheet } from "react-native"; -import { View, Text, Pressable, Box, Row } from "native-base"; +import { View, Text, Pressable, Box, Row, Icon } from "native-base"; import { createNavigatorFactory, DefaultNavigatorOptions, @@ -22,6 +22,8 @@ type TabNavigationConfig = { // Supported screen options type TabNavigationOptions = { title?: string; + iconProvider?: any; + iconName?: string; }; // Map of event name and the type of data (in event.data) @@ -69,7 +71,15 @@ function TabNavigator({ {state.routes.map((route) => ( {({ isHovered, isPressed }) => ( - { - let colorLevel = 0; - if (isHovered) { - colorLevel += 100; - } - if (route.key === state.routes[state.index].key) { - colorLevel += 300; - } - if (isPressed) { - colorLevel += 200; - } + { + let colorLevel = 0; + if (isHovered) { + colorLevel += 100; + } + if (route.key === state.routes[state.index]?.key) { + colorLevel += 300; + } + if (isPressed) { + colorLevel += 200; + } - if (colorLevel <= 0) { - return "transparent"; - } - return `primary.${colorLevel}`; - })()}> - - {descriptors[route.key].options.title || route.name} - - + if (colorLevel <= 0) { + return "transparent"; + } + return `primary.${colorLevel}`; + })()} + > + {descriptors[route.key]?.options.iconProvider && + descriptors[route.key]?.options.iconName && ( + + )} + + {descriptors[route.key]?.options.title || route.name} + + )} ))} @@ -127,7 +154,7 @@ function TabNavigator({ key={route.key} style={[{ display: i === state.index ? "flex" : "none" }]} > - {descriptors[route.key].render()} + {descriptors[route.key]?.render()} ); })} diff --git a/front/views/SettingsView.tsx b/front/views/SettingsView.tsx index d65b8be..c2b82c0 100644 --- a/front/views/SettingsView.tsx +++ b/front/views/SettingsView.tsx @@ -10,6 +10,7 @@ import { SettingsState, updateSettings } from '../state/SettingsSlice'; import { AvailableLanguages, translate, Translate } from "../i18n/i18n"; import TextButton from '../components/TextButton'; import createTabRowNavigator from '../components/navigators/TabRowNavigator'; +import { FontAwesome } from '@expo/vector-icons'; import API from '../API'; @@ -258,7 +259,7 @@ const TabRow = createTabRowNavigator(); const SetttingsNavigator = () => { return ( - +