diff --git a/native/navigation/tab-navigator.react.js b/native/navigation/tab-navigator.react.js
index 77c54dd3f..7c16b07c9 100644
--- a/native/navigation/tab-navigator.react.js
+++ b/native/navigation/tab-navigator.react.js
@@ -1,131 +1,137 @@
// @flow
import type {
BottomTabNavigationHelpers,
BottomTabNavigationProp,
} from '@react-navigation/bottom-tabs';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import * as React from 'react';
import { unreadCount } from 'lib/selectors/thread-selectors';
import AppsDirectory from '../apps/apps-directory.react';
import Calendar from '../calendar/calendar.react';
import Chat from '../chat/chat.react';
import SWMansionIcon from '../components/swmansion-icon.react';
import Profile from '../profile/profile.react';
import { useSelector } from '../redux/redux-utils';
+import { useColors } from '../themes/colors';
import {
CalendarRouteName,
ChatRouteName,
ProfileRouteName,
AppsRouteName,
type ScreenParamList,
type TabParamList,
} from './route-names';
import type { NavigationRoute } from './route-names';
import { tabBar } from './tab-bar.react';
const calendarTabOptions = {
tabBarLabel: 'Calendar',
// eslint-disable-next-line react/display-name
tabBarIcon: ({ color }) => (
),
};
const getChatTabOptions = (badge: number) => ({
tabBarLabel: 'Inbox',
// eslint-disable-next-line react/display-name
tabBarIcon: ({ color }) => (
),
tabBarBadge: badge ? badge : undefined,
});
const profileTabOptions = {
tabBarLabel: 'Profile',
// eslint-disable-next-line react/display-name
tabBarIcon: ({ color }) => (
),
};
const appsTabOptions = {
tabBarLabel: 'Apps',
// eslint-disable-next-line react/display-name
tabBarIcon: ({ color }) => (
),
};
export type TabNavigationProp<
RouteName: $Keys = $Keys,
> = BottomTabNavigationProp;
const Tab = createBottomTabNavigator<
ScreenParamList,
TabParamList,
BottomTabNavigationHelpers,
>();
-const tabBarScreenOptions = {
- headerShown: false,
- tabBarHideOnKeyboard: false,
- tabBarActiveTintColor: '#AE94DB',
- tabBarStyle: {
- backgroundColor: '#0A0A0A',
- borderTopWidth: 1,
- },
- lazy: false,
-};
type Props = {
+navigation: TabNavigationProp<'TabNavigator'>,
+route: NavigationRoute<'TabNavigator'>,
};
// eslint-disable-next-line no-unused-vars
function TabNavigator(props: Props): React.Node {
+ const colors = useColors();
const chatBadge = useSelector(unreadCount);
const isCalendarEnabled = useSelector(state => state.enabledApps.calendar);
let calendarTab;
if (isCalendarEnabled) {
calendarTab = (
);
}
+ const tabBarScreenOptions = React.useMemo(
+ () => ({
+ headerShown: false,
+ tabBarHideOnKeyboard: false,
+ tabBarActiveTintColor: '#AE94DB',
+ tabBarStyle: {
+ backgroundColor: colors.tabBarBackground,
+ borderTopWidth: 1,
+ },
+ lazy: false,
+ }),
+ [colors.tabBarBackground],
+ );
+
return (
{calendarTab}
);
}
const styles = {
icon: {
fontSize: 28,
},
};
export default TabNavigator;