import * as React from 'react'; import { useEffect } 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'; import { rpx } from './src/utils/rpx'; import { AMapSdk, MapView, Marker, MapType } from 'react-native-amap3d'; enableScreens(); type RootStackParamList = { '爱车': undefined; '商城': undefined; '个人中心': undefined; }; const Tab = createBottomTabNavigator(); function App() { useEffect(() => { AMapSdk.init( Platform.select({ android: "812efd3a950ba3675f928630302c6463", }) ); }, []); 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;