HomePageNavigator.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import React from 'react'
  2. import SearchPage from '../screens/SearchPage';
  3. import BookmarkPage from '../screens/BookmarkPage';
  4. import SettingsPage from '../screens/SettingsPage';
  5. import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"
  6. import IonIcon from 'react-native-vector-icons/dist/Ionicons';
  7. import colors from '../theme/colors';
  8. import fonts from '../theme/fonts';
  9. import NewscoutHomeHeader from '../components/organisms/Headers/NewscoutHomeHeader';
  10. import NewscoutTitleHeader from '../components/organisms/Headers/NewscoutTitleHeader';
  11. import BookmarkNavigator from './BookmarkNavigator';
  12. import LandingPageNavigator from './LandingPageNavigator';
  13. const Tab = createBottomTabNavigator();
  14. // tabBar={props => <BottomTabBar {...props}/>}
  15. const HomePageNavigator = ({ route, navigation }) => {
  16. return (
  17. <Tab.Navigator
  18. screenOptions={({ route }) => ({
  19. tabBarItemStyle: { paddingHorizontal: fonts.getSize(36), flex: 0 },
  20. tabBarStyle: { height: fonts.getSize(64), alignItems: 'center' },
  21. tabBarShowLabel: false,
  22. tabBarIcon: ({ focused, color, size }) => {
  23. let iconName;
  24. let colorName;
  25. switch (route.name) {
  26. case "Landing":
  27. iconName = "home-outline";
  28. break;
  29. case "Search":
  30. iconName = "search-outline";
  31. break
  32. case "Bookmark":
  33. iconName = "bookmark-outline";
  34. break
  35. case "Settings":
  36. iconName = 'person-outline';
  37. break
  38. default:
  39. break;
  40. }
  41. colorName = focused ? colors.topColor : colors.baseColor;
  42. // You can return any component that you like here!
  43. return <IonIcon name={iconName} size={size} color={colorName} />;
  44. },
  45. })}
  46. >
  47. <Tab.Screen
  48. name="Landing"
  49. component={LandingPageNavigator}
  50. options={(navigation) => ({
  51. headerShown: false
  52. })}/>
  53. <Tab.Screen
  54. name="Search"
  55. component={SearchPage}
  56. options={(navigation) => ({
  57. headerShown: false
  58. })} />
  59. <Tab.Screen
  60. name="Bookmark"
  61. component={BookmarkNavigator}
  62. options={(navigation) => ({
  63. headerShown: false
  64. })}
  65. />
  66. <Tab.Screen
  67. name="Settings"
  68. component={SettingsPage}
  69. options={() => ({
  70. header: () => <NewscoutTitleHeader title={"Settings"} backButtonShown={true}></NewscoutTitleHeader>
  71. })}
  72. />
  73. </Tab.Navigator>
  74. )
  75. }
  76. export default HomePageNavigator