BottomTabNavigator.jsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import * as React from 'react';
  2. import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
  3. import { useTranslation } from 'react-i18next';
  4. import HomeScreen from '../screens/Main/HomeScreen';
  5. import OrderScreen from '../screens/Order/OrderScreen';
  6. import UserScreen from '../screens/User/UserScreen';
  7. import Icon from '../components/SvgIcon';
  8. import Text from '../components/Text';
  9. const BottomTab = createBottomTabNavigator();
  10. export default function BottomTabNavigator() {
  11. const { t } = useTranslation();
  12. return (
  13. <BottomTab.Navigator initialRouteName="Home">
  14. <BottomTab.Screen
  15. name="Home"
  16. component={HomeScreen}
  17. options={{
  18. title: ({ focused }) => (
  19. <Text size="c2" bold type={focused ? 'primary' : 'info'}>
  20. {t('wai-mai')}
  21. </Text>
  22. ),
  23. tabBarIcon: ({ focused }) => (
  24. <Icon
  25. fillAll={!!focused}
  26. type={focused ? 'primary' : 'info'}
  27. width={37}
  28. name="home"
  29. />
  30. ),
  31. }}
  32. />
  33. <BottomTab.Screen
  34. name="Order"
  35. component={OrderScreen}
  36. options={{
  37. title: ({ focused }) => (
  38. <Text size="c2" bold type={focused ? 'primary' : 'info'}>
  39. {t('ding-dan')}
  40. </Text>
  41. ),
  42. tabBarIcon: ({ focused }) => (
  43. <Icon name={focused ? 'order1' : 'order2'} />
  44. ),
  45. }}
  46. />
  47. <BottomTab.Screen
  48. name="User"
  49. component={UserScreen}
  50. options={{
  51. title: ({ focused }) => (
  52. <Text size="c2" bold type={focused ? 'primary' : 'info'}>
  53. {t('wo-de')}
  54. </Text>
  55. ),
  56. tabBarIcon: ({ focused }) => (
  57. <Icon
  58. type={focused ? 'primary' : 'info'}
  59. fillAll={!!focused}
  60. name="user"
  61. />
  62. ),
  63. }}
  64. />
  65. </BottomTab.Navigator>
  66. );
  67. }