Files
rn-app/app/(tabs)/_layout.tsx

60 lines
1.7 KiB
TypeScript
Raw Normal View History

2025-11-04 13:27:19 +08:00
import React from 'react';
import FontAwesome from '@expo/vector-icons/FontAwesome';
import { Link, Tabs } from 'expo-router';
import { Pressable } from 'react-native';
2025-11-12 00:13:26 +08:00
import { Colors } from '@/theme';
2025-11-06 16:37:01 +08:00
import { useColorScheme, useClientOnlyValue } from '@/hooks';
2025-11-04 13:27:19 +08:00
// You can explore the built-in icon families and icons on the web at https://icons.expo.fyi/
function TabBarIcon(props: {
name: React.ComponentProps<typeof FontAwesome>['name'];
color: string;
}) {
return <FontAwesome size={28} style={{ marginBottom: -3 }} {...props} />;
}
export default function TabLayout() {
const colorScheme = useColorScheme();
return (
<Tabs
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
// Disable the static render of the header on web
// to prevent a hydration error in React Navigation v6.
headerShown: useClientOnlyValue(false, true),
2025-11-05 17:24:55 +08:00
}}
>
2025-11-04 13:27:19 +08:00
<Tabs.Screen
name="index"
options={{
2025-11-11 18:48:54 +08:00
title: '首页',
tabBarIcon: ({ color }) => <TabBarIcon name="home" color={color} />,
2025-11-04 13:27:19 +08:00
}}
/>
<Tabs.Screen
name="two"
options={{
2025-11-11 18:48:54 +08:00
title: '充值',
2025-11-04 13:27:19 +08:00
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
}}
/>
<Tabs.Screen
name="demo"
options={{
2025-11-11 18:48:54 +08:00
title: '活动',
2025-11-04 13:27:19 +08:00
tabBarIcon: ({ color }) => <TabBarIcon name="rocket" color={color} />,
}}
/>
2025-11-04 13:49:20 +08:00
<Tabs.Screen
name="paper"
options={{
2025-11-11 18:48:54 +08:00
title: '我的',
2025-11-04 13:49:20 +08:00
tabBarIcon: ({ color }) => <TabBarIcon name="paint-brush" color={color} />,
}}
/>
2025-11-04 13:27:19 +08:00
</Tabs>
);
}