2024-02-03 20:23:31 -07:00
|
|
|
import {
|
|
|
|
DarkTheme,
|
|
|
|
DefaultTheme,
|
2024-02-03 20:30:00 -07:00
|
|
|
NavigationContainer,
|
2024-02-03 20:23:31 -07:00
|
|
|
} from "@react-navigation/native";
|
|
|
|
import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
2024-02-03 20:30:00 -07:00
|
|
|
import { useColorScheme } from "react-native";
|
2024-01-31 16:55:33 -07:00
|
|
|
|
2024-02-03 20:23:31 -07:00
|
|
|
import Login from "../screens/login";
|
2024-02-03 20:30:00 -07:00
|
|
|
import Tabs from "./tab-navigator";
|
2024-01-31 16:55:33 -07:00
|
|
|
|
2024-02-03 20:23:31 -07:00
|
|
|
const Stack = createNativeStackNavigator();
|
2024-01-31 16:55:33 -07:00
|
|
|
|
|
|
|
const ScreensStack = () => (
|
2024-02-03 20:23:31 -07:00
|
|
|
<Stack.Navigator>
|
|
|
|
<Stack.Screen
|
2024-02-05 23:50:24 -07:00
|
|
|
name="Login"
|
|
|
|
component={Login}
|
2024-02-03 20:23:31 -07:00
|
|
|
options={{ headerShown: false }}
|
|
|
|
/>
|
|
|
|
<Stack.Screen
|
2024-02-05 23:50:24 -07:00
|
|
|
name="Tabs"
|
|
|
|
component={Tabs}
|
2024-02-03 20:23:31 -07:00
|
|
|
options={{ headerShown: false }}
|
|
|
|
/>
|
|
|
|
</Stack.Navigator>
|
|
|
|
);
|
2024-01-31 16:55:33 -07:00
|
|
|
/**
|
|
|
|
* Functional component for app navigation. Configures a navigation container with a stack navigator.
|
|
|
|
* Dynamically selects between dark and light themes based on the device's color scheme.
|
|
|
|
* The stack navigator is configured to manage various app screens.
|
|
|
|
*
|
|
|
|
* @returns {React.ComponentType} A NavigationContainer wrapping a Stack.Navigator for app screens.
|
|
|
|
*/
|
|
|
|
export default function AppNavigator(): React.JSX.Element {
|
2024-02-03 20:23:31 -07:00
|
|
|
// useColorScheme get's the theme from device settings
|
|
|
|
const scheme = useColorScheme();
|
2024-01-31 16:55:33 -07:00
|
|
|
|
2024-02-03 20:23:31 -07:00
|
|
|
return (
|
|
|
|
<NavigationContainer theme={scheme === "dark" ? DarkTheme : DefaultTheme}>
|
|
|
|
<Stack.Navigator screenOptions={{ headerShown: false }}>
|
|
|
|
<Stack.Screen name="App" component={ScreensStack} />
|
|
|
|
</Stack.Navigator>
|
|
|
|
</NavigationContainer>
|
|
|
|
);
|
|
|
|
}
|