/**
* App.tsx – root component for the DocuElevate mobile app.
*
* Wraps the entire app in the AuthProvider and renders either the login
* screen (unauthenticated) or the main tab navigator (authenticated).
* Push notification registration is handled by the usePushNotifications hook.
*/
import { NavigationContainer } from "@react-navigation/native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { Ionicons } from "@expo/vector-icons";
import React from "react";
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { AuthProvider, useAuth } from "./src/context/AuthContext";
import { usePushNotifications } from "./src/hooks/usePushNotifications";
import FilesScreen from "./src/screens/FilesScreen";
import LoginScreen from "./src/screens/LoginScreen";
import ProfileScreen from "./src/screens/ProfileScreen";
import UploadScreen from "./src/screens/UploadScreen";
const Tab = createBottomTabNavigator();
function TabNavigator() {
const { isAuthenticated } = useAuth();
usePushNotifications(isAuthenticated);
return (
(
),
headerTitle: "DocuElevate",
}}
/>
(
),
headerTitle: "My Documents",
}}
/>
(
),
headerTitle: "Profile",
}}
/>
);
}
function AppContent() {
const { isLoading, isAuthenticated } = useAuth();
if (isLoading) {
return (
Loading…
);
}
return (
{isAuthenticated ? : }
);
}
export default function App() {
return (
);
}
const styles = StyleSheet.create({
loading: {
flex: 1,
alignItems: "center",
justifyContent: "center",
backgroundColor: "#f9fafb",
gap: 12,
},
loadingText: {
color: "#6b7280",
fontSize: 15,
},
});