import * as React from 'react'; import { NavigationContainer } from '@react-navigation/native'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { View, StyleSheet, Image, Platform } from 'react-native'; import ShopScreens from './src/views/ShopScreen'; import ProfileScreens from './src/views/ProfileScreen'; import 'react-native-gesture-handler'; import { enableScreens } from 'react-native-screens'; import HomeStackNavigator from './src/views/HomeStackNavigator'; import { getFocusedRouteNameFromRoute } from '@react-navigation/native'; enableScreens(); type RootStackParamList = { '爱车': undefined; '商城': undefined; '个人中心': undefined; }; const Tab = createBottomTabNavigator(); function App() { const getTabBarVisibility = (route: any) => { const routeName = getFocusedRouteNameFromRoute(route) ?? 'Home'; const showOnScreens = ['Home']; // 只在 Home 页面显示底部导航栏 return showOnScreens.includes(routeName) ? 'flex' : 'none'; }; return ( ({ tabBarIcon: ({ color, size }) => ( ), tabBarStyle: { display: getTabBarVisibility(route) } })} /> ( ), }} /> ( ), }} /> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', }, }); export default App;