import React from 'react'
import SearchPage from '../screens/SearchPage';
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"
import IonIcon from 'react-native-vector-icons/dist/Ionicons';
import colors from '../theme/colors';
import fonts from '../theme/fonts';
import NewscoutTitleHeader from '../components/organisms/Headers/NewscoutTitleHeader';
import BookmarkNavigator from './BookmarkNavigator';
import LandingPageNavigator from './LandingPageNavigator';
import ProfileNavigator from './ProfileNavigator';

const Tab = createBottomTabNavigator();

// tabBar={props => <BottomTabBar {...props}/>}
const HomePageNavigator = ({ route, navigation }) => {
    return (
        <Tab.Navigator
            screenOptions={({ route }) => ({
                tabBarItemStyle: { paddingHorizontal: fonts.getSize(36), flex: 0 },
                tabBarStyle: { height: fonts.getSize(64), alignItems: 'center' },
                tabBarShowLabel: false,
                tabBarIcon: ({ focused, color, size }) => {
                    let iconName;
                    let colorName;

                    switch (route.name) {
                        case "Landing":
                            iconName = "home-outline";
                            break;
                        case "Search":
                            iconName = "search-outline";
                            break
                        case "Bookmark":
                            iconName = "bookmark-outline";
                            break
                        case "Profile":
                            iconName = 'person-outline';
                            break
                        default:
                            break;
                    }

                    colorName = focused ? colors.topColor : colors.baseColor;

                    // You can return any component that you like here!
                    return <IonIcon name={iconName} size={size} color={colorName} />;
                },
            })}

        >
            <Tab.Screen
                name="Landing"
                component={LandingPageNavigator}
                options={(navigation) => ({
                    headerShown: false
                })}/>
            <Tab.Screen
                name="Search"
                component={SearchPage}
                options={(navigation) => ({
                    headerShown: false
                })} />
            <Tab.Screen
                name="Bookmark"
                component={BookmarkNavigator}
                options={(navigation) => ({
                    headerShown: false
                })}
            />
            <Tab.Screen
                name="Profile"
                component={ProfileNavigator}
                options={() => ({
                   headerShown: false
                })}
            />
        </Tab.Navigator>

    )
}

export default HomePageNavigator

