BottomTabNavigator.jsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import * as React from 'react'
  2. import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
  3. import HomeScreen from '../screens/Home/HomeScreen'
  4. import LinksScreen from '../screens/Home/LinksScreen'
  5. import Icon from '../components/SvgIcon'
  6. import Text from '../components/Text'
  7. const BottomTab = createBottomTabNavigator()
  8. export default function BottomTabNavigator() {
  9. return (
  10. <BottomTab.Navigator initialRouteName="Home">
  11. <BottomTab.Screen
  12. name="Home"
  13. component={HomeScreen}
  14. options={{
  15. title: ({ focused }) => (
  16. <Text size="c2" bold type={focused ? 'primary' : 'info'}>
  17. 外卖
  18. </Text>
  19. ),
  20. tabBarIcon: ({ focused }) => (
  21. <Icon type={focused ? 'primary' : 'info'} name="home" />
  22. ),
  23. }}
  24. />
  25. <BottomTab.Screen
  26. name="Links"
  27. component={LinksScreen}
  28. options={{
  29. title: ({ focused }) => (
  30. <Text size="c2" bold type={focused ? 'primary' : 'info'}>
  31. 订单
  32. </Text>
  33. ),
  34. tabBarIcon: ({ focused }) => (
  35. <Icon type={focused ? 'primary' : 'info'} name="order" />
  36. ),
  37. }}
  38. />
  39. <BottomTab.Screen
  40. name="User"
  41. component={LinksScreen}
  42. options={{
  43. title: ({ focused }) => (
  44. <Text size="c2" bold type={focused ? 'primary' : 'info'}>
  45. 我的
  46. </Text>
  47. ),
  48. tabBarIcon: ({ focused }) => (
  49. <Icon type={focused ? 'primary' : 'info'} name="user" />
  50. ),
  51. }}
  52. />
  53. </BottomTab.Navigator>
  54. )
  55. }