-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
73 lines (64 loc) · 2.4 KB
/
App.tsx
File metadata and controls
73 lines (64 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// App.tsx
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { Ionicons } from '@expo/vector-icons'; // 图标库
import HomeScreen from './src/screens/HomeScreen';
import GameScreen from './src/screens/GameScreen/GameScreen';
import ChangelogScreen from './src/screens/ChangelogScreen';
import { useAutoUpdate } from './src/hooks/useAutoUpdate';
import BattleHistory from './src/screens/HistoryScreen/BattleHistory';
// 定义底部导航类型
export type BottomTabParamList = {
Home: undefined;
Game: undefined;
History: undefined;
Changelog: undefined;
};
const Tab = createBottomTabNavigator<BottomTabParamList>();
export default function App() {
useAutoUpdate();
console.log("Build ID: 3e0f7a23-8eae-4c16-b3cd-xxxxxx");
return (
<NavigationContainer>
<Tab.Navigator
initialRouteName="Home"
screenOptions={({ route }) => ({
headerShown: false, // 不显示顶部标题栏
tabBarActiveTintColor: '#4caf50',
tabBarInactiveTintColor: '#aaa',
tabBarStyle: {
backgroundColor: '#fff',
borderTopWidth: 0.5,
borderTopColor: '#ccc',
},
tabBarIcon: ({ color, size }) => {
let iconName: keyof typeof Ionicons.glyphMap;
switch (route.name) {
case 'Home':
iconName = 'home-outline';
break;
case 'Game':
iconName = 'game-controller-outline';
break;
case 'History':
iconName = 'time-outline';
break;
case 'Changelog':
iconName = 'document-text-outline';
break;
default:
iconName = 'ellipse-outline';
}
return <Ionicons name={iconName} size={size} color={color} />;
},
})}
>
<Tab.Screen name="Home" component={HomeScreen} options={{ title: '首页' }} />
<Tab.Screen name="Game" component={GameScreen} options={{ title: '游戏' }} />
<Tab.Screen name="History" component={BattleHistory} options={{ title: '历史对战' }} />
<Tab.Screen name="Changelog" component={ChangelogScreen} options={{ title: '更新日志' }} />
</Tab.Navigator>
</NavigationContainer>
);
}