廓形仪rn版本-技术调研
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.5 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. import { Tabs } from 'expo-router';
  2. import React from 'react';
  3. import { Platform, View, Image, StyleSheet } from 'react-native';
  4. import { HapticTab } from '@/components/HapticTab';
  5. import { IconSymbol } from '@/components/ui/IconSymbol';
  6. import TabBarBackground from '@/components/ui/TabBarBackground';
  7. import { Colors } from '@/constants/Colors';
  8. import { useColorScheme } from '@/hooks/useColorScheme';
  9. const icon_tab1_s = require('@/assets/images/tab/icon_tab1_s.png');
  10. const icon_tab1_u = require('@/assets/images/tab/icon_tab1_u.png');
  11. const icon_tab2_s = require('@/assets/images/tab/icon_tab2_s.png');
  12. const icon_tab2_u = require('@/assets/images/tab/icon_tab2_u.png');
  13. const icon_tab3_s = require('@/assets/images/tab/icon_tab3_s.png');
  14. const icon_tab3_u = require('@/assets/images/tab/icon_tab3_u.png');
  15. const icon_tab4_s = require('@/assets/images/tab/icon_tab4_s.png');
  16. const icon_tab4_u = require('@/assets/images/tab/icon_tab4_u.png');
  17. export default function TabLayout() {
  18. const colorScheme = useColorScheme();
  19. return (
  20. <Tabs
  21. screenOptions={{
  22. tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
  23. headerShown: true,
  24. tabBarButton: HapticTab,
  25. tabBarBackground: TabBarBackground,
  26. tabBarStyle: Platform.select({
  27. ios: {
  28. // Use a transparent background on iOS to show the blur effect
  29. position: 'absolute',
  30. },
  31. default: {},
  32. }),
  33. }}>
  34. <Tabs.Screen
  35. name="(home)"
  36. options={{
  37. title: '测量',
  38. headerShown: false,
  39. tabBarIcon: ({ focused }) => (
  40. <Image style={styles.tabIcon} source={focused ? icon_tab1_s : icon_tab1_u} />
  41. ),
  42. }}
  43. />
  44. <Tabs.Screen
  45. name="setting"
  46. options={{
  47. title: '设置',
  48. tabBarIcon: ({ focused }) => (
  49. <Image style={styles.tabIcon} source={focused ? icon_tab2_s : icon_tab2_u} />
  50. ),
  51. }}
  52. />
  53. <Tabs.Screen
  54. name="ble"
  55. options={{
  56. title: '蓝牙',
  57. tabBarIcon: ({ focused }) => (
  58. <Image style={styles.tabIcon} source={focused ? icon_tab3_s : icon_tab3_u} />
  59. ),
  60. }}
  61. />
  62. <Tabs.Screen
  63. name="mine"
  64. options={{
  65. title: '我的',
  66. tabBarIcon: ({ focused }) => (
  67. <Image style={styles.tabIcon} source={focused ? icon_tab4_s : icon_tab4_u} />
  68. ),
  69. }}
  70. />
  71. </Tabs>
  72. );
  73. }
  74. const styles = StyleSheet.create({
  75. tabIcon: {
  76. width: 24,
  77. height: 24,
  78. },
  79. });