MianTabNavigator.tsx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
  2. import { createStackNavigator } from '@react-navigation/stack';
  3. import * as React from 'react';
  4. import { Icon, Text } from 'react-native-magnus';
  5. import Colors from '../constants/Colors';
  6. import useColorScheme from '../hooks/useColorScheme';
  7. import MineScreen from '../mine/MineScreen';
  8. import NoticeScreen from '../notice/NoticeScreen';
  9. import OrderScreen from '../order/OrderScreen';
  10. import { useTranslation } from 'react-i18next';
  11. import { MainTabParamList } from '../types';
  12. const MainTab = createBottomTabNavigator<MainTabParamList>();
  13. export default function MainTabNavigator() {
  14. const colorScheme = useColorScheme();
  15. const { t } = useTranslation();
  16. return (
  17. <MainTab.Navigator
  18. initialRouteName="Order"
  19. tabBarOptions={{ activeTintColor: Colors[colorScheme].tint }}
  20. >
  21. <MainTab.Screen
  22. name="Order"
  23. component={OrderScreen}
  24. options={{
  25. tabBarIcon: ({ color }) => (
  26. <Icon
  27. name="clipboard"
  28. fontFamily="Feather"
  29. fontSize="5xl"
  30. color={color}
  31. />
  32. ),
  33. tabBarLabel: ({ focused }) => (
  34. <Text fontSize="xs" color={focused ? 'yellow500' : 'black'}>
  35. {t('ding-dan')}
  36. </Text>
  37. ),
  38. }}
  39. />
  40. <MainTab.Screen
  41. name="Notice"
  42. component={NoticeScreen}
  43. options={{
  44. tabBarIcon: ({ color }) => (
  45. <Icon
  46. name="message-circle"
  47. fontSize="5xl"
  48. fontFamily="Feather"
  49. color={color}
  50. />
  51. ),
  52. tabBarLabel: ({ focused }) => (
  53. <Text fontSize="xs" color={focused ? 'yellow500' : 'black'}>
  54. {t('xiao-xi')}
  55. </Text>
  56. ),
  57. }}
  58. />
  59. <MainTab.Screen
  60. name="Mine"
  61. component={MineScreen}
  62. options={{
  63. tabBarIcon: ({ color }) => (
  64. <Icon
  65. name="user"
  66. fontSize="5xl"
  67. fontFamily="Feather"
  68. color={color}
  69. />
  70. ),
  71. tabBarLabel: ({ focused }) => (
  72. <Text fontSize="xs" color={focused ? 'yellow500' : 'black'}>
  73. {t('wo-de')}
  74. </Text>
  75. ),
  76. }}
  77. />
  78. </MainTab.Navigator>
  79. );
  80. }