fix: tab bar not visible on Android #21
@@ -1,6 +1,7 @@
|
|||||||
import { Tabs } from 'expo-router';
|
import { Tabs } from 'expo-router';
|
||||||
import { Ionicons } from '@expo/vector-icons';
|
import { Ionicons } from '@expo/vector-icons';
|
||||||
import { View, StyleSheet, Platform } from 'react-native';
|
import { View, StyleSheet, Platform } from 'react-native';
|
||||||
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import { colors, shadows } from '../../constants/theme';
|
import { colors, shadows } from '../../constants/theme';
|
||||||
|
|
||||||
function ScanIcon({ color, size }: { color: string; size: number }) {
|
function ScanIcon({ color, size }: { color: string; size: number }) {
|
||||||
@@ -14,12 +15,19 @@ function ScanIcon({ color, size }: { color: string; size: number }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function TabLayout() {
|
export default function TabLayout() {
|
||||||
|
const insets = useSafeAreaInsets();
|
||||||
|
const bottomPadding = Platform.OS === 'ios' ? insets.bottom : 8;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs
|
<Tabs
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
tabBarActiveTintColor: colors.primary,
|
tabBarActiveTintColor: colors.primary,
|
||||||
tabBarInactiveTintColor: colors.textSecondary,
|
tabBarInactiveTintColor: colors.textSecondary,
|
||||||
tabBarStyle: styles.tabBar,
|
tabBarStyle: {
|
||||||
|
...styles.tabBar,
|
||||||
|
height: 60 + bottomPadding,
|
||||||
|
paddingBottom: bottomPadding,
|
||||||
|
},
|
||||||
tabBarLabelStyle: styles.tabBarLabel,
|
tabBarLabelStyle: styles.tabBarLabel,
|
||||||
headerStyle: styles.header,
|
headerStyle: styles.header,
|
||||||
headerTintColor: colors.primary,
|
headerTintColor: colors.primary,
|
||||||
@@ -84,8 +92,6 @@ const styles = StyleSheet.create({
|
|||||||
tabBar: {
|
tabBar: {
|
||||||
backgroundColor: colors.card,
|
backgroundColor: colors.card,
|
||||||
borderTopColor: colors.border,
|
borderTopColor: colors.border,
|
||||||
height: Platform.OS === 'ios' ? 88 : 64,
|
|
||||||
paddingBottom: Platform.OS === 'ios' ? 24 : 8,
|
|
||||||
paddingTop: 8,
|
paddingTop: 8,
|
||||||
},
|
},
|
||||||
tabBarLabel: {
|
tabBarLabel: {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { Stack } from 'expo-router';
|
|||||||
import { StatusBar } from 'expo-status-bar';
|
import { StatusBar } from 'expo-status-bar';
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||||
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||||
import { useAuthStore } from '../store/authStore';
|
import { useAuthStore } from '../store/authStore';
|
||||||
import { registerForPushNotifications, addNotificationListener, addNotificationResponseListener } from '../services/notifications';
|
import { registerForPushNotifications, addNotificationListener, addNotificationResponseListener } from '../services/notifications';
|
||||||
import { colors } from '../constants/theme';
|
import { colors } from '../constants/theme';
|
||||||
@@ -35,6 +36,7 @@ export default function RootLayout() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GestureHandlerRootView style={{ flex: 1 }}>
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
||||||
|
<SafeAreaProvider>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<Stack
|
<Stack
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
@@ -76,6 +78,7 @@ export default function RootLayout() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
<StatusBar style="auto" />
|
<StatusBar style="auto" />
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
|
</SafeAreaProvider>
|
||||||
</GestureHandlerRootView>
|
</GestureHandlerRootView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user