import { Tabs, Redirect } from "expo-router";
import { Ionicons } from "@expo/vector-icons";
import { View, ActivityIndicator, StyleSheet } from "react-native";
import { useAuthStore, useMatchStore } from "../../src/store";
export default function AppLayout() {
const { isAuthenticated, isLoading } = useAuthStore();
const { newMatchesCount } = useMatchStore();
// Show loading state while checking authentication
if (isLoading) {
return (
);
}
// Redirect to login if not authenticated
if (!isAuthenticated) {
return ;
}
return (
(
),
}}
/>
(
),
}}
/>
(
),
}}
/>
(
),
tabBarBadge: newMatchesCount > 0 ? newMatchesCount : undefined,
tabBarBadgeStyle: {
backgroundColor: "#e94560",
fontSize: 10,
},
}}
/>
(
),
}}
/>
);
}
const styles = StyleSheet.create({
loadingContainer: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#1a1a2e",
},
});