47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import {
|
|
DarkTheme,
|
|
DefaultTheme,
|
|
NavigationContainer,
|
|
} from "@react-navigation/native";
|
|
import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
|
import { useColorScheme } from "react-native";
|
|
|
|
import Login from "../screens/login";
|
|
import Tabs from "./tab-navigator";
|
|
|
|
const Stack = createNativeStackNavigator();
|
|
|
|
const ScreensStack = () => (
|
|
<Stack.Navigator>
|
|
<Stack.Screen
|
|
name="Login"
|
|
component={Login}
|
|
options={{ headerShown: false }}
|
|
/>
|
|
<Stack.Screen
|
|
name="Tabs"
|
|
component={Tabs}
|
|
options={{ headerShown: false }}
|
|
/>
|
|
</Stack.Navigator>
|
|
);
|
|
/**
|
|
* 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 {
|
|
// useColorScheme get's the theme from device settings
|
|
const scheme = useColorScheme();
|
|
|
|
return (
|
|
<NavigationContainer theme={scheme === "dark" ? DarkTheme : DefaultTheme}>
|
|
<Stack.Navigator screenOptions={{ headerShown: false }}>
|
|
<Stack.Screen name="App" component={ScreensStack} />
|
|
</Stack.Navigator>
|
|
</NavigationContainer>
|
|
);
|
|
}
|