import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; import React, {Fragment, useEffect, useState} from 'react'; import {useSelector} from 'react-redux'; import {NavigationIcon} from '../../components'; import {NO_NOTIFICATIONS} from '../../store/initialStates'; import {RootState} from '../../store/rootReducer'; import {ScreenType} from '../../types'; import {haveUnreadNotifications} from '../../utils'; import MainStackScreen from '../main/MainStackScreen'; const Tabs = createBottomTabNavigator(); const NavigationBar: React.FC = () => { const {isOnboardedUser, newNotificationReceived} = useSelector( (state: RootState) => state.user, ); const {notifications: {notifications} = NO_NOTIFICATIONS} = useSelector( (state: RootState) => state, ); const [ unreadNotificationsPresent, setUnreadNotificationsPresent, ] = useState(false); useEffect(() => { const determine = async () => { setUnreadNotificationsPresent( await haveUnreadNotifications(notifications), ); }; determine(); }, [notifications]); return ( ({ tabBarIcon: ({focused}) => { switch (route.name) { case 'Home': return ; case 'Search': return ; case 'Upload': return ; case 'Notifications': return ( ); case 'Profile': return ; case 'SuggestedPeople': return ( ); default: return ; } }, })} initialRouteName={isOnboardedUser ? 'Profile' : 'SuggestedPeople'} tabBarOptions={{ showLabel: false, style: { backgroundColor: 'transparent', position: 'absolute', borderTopWidth: 0, left: 0, right: 0, bottom: '1%', }, }}> ); }; export default NavigationBar;