/** * The app navigator (formerly "AppNavigator" and "MainNavigator") is used for the primary * navigation flows of your app. * Generally speaking, it will contain an auth flow (registration, login, forgot password) * and a "main" flow which the user will use once logged in. */ import { NavigationContainer } from "@react-navigation/native" import { createNativeStackNavigator } from "@react-navigation/native-stack" import Config from "@/config" import { useAuth } from "@/context/AuthContext" import { AboutScreen } from "@/screens/AboutScreen" import { AuthWelcomeScreen } from "@/screens/AuthWelcomeScreen" import { ChangeEmailScreen } from "@/screens/ChangeEmailScreen" import { ChangePasswordScreen } from "@/screens/ChangePasswordScreen" import { ErrorBoundary } from "@/screens/ErrorScreen/ErrorBoundary" import { ForgotPasswordScreen } from "@/screens/ForgotPasswordScreen" import { LanguageScreen } from "@/screens/LanguageScreen" import { LoginScreen } from "@/screens/LoginScreen" import { ProfileScreen } from "@/screens/ProfileScreen" import { RegisterScreen } from "@/screens/RegisterScreen" import { SecurityScreen } from "@/screens/SecurityScreen" import { SessionManagementScreen } from "@/screens/SessionManagementScreen" import { SettingsScreen } from "@/screens/SettingsScreen" import { ThemeScreen } from "@/screens/ThemeScreen" import { WelcomeScreen } from "@/screens/WelcomeScreen" import { useAppTheme } from "@/theme/context" import { MainNavigator } from "./MainNavigator" import type { AppStackParamList, NavigationProps } from "./navigationTypes" import { navigationRef, useBackButtonHandler } from "./navigationUtilities" /** * This is a list of all the route names that will exit the app if the back button * is pressed while in that screen. Only affects Android. */ const exitRoutes = Config.exitRoutes // Documentation: https://reactnavigation.org/docs/stack-navigator/ const Stack = createNativeStackNavigator() const AppStack = () => { const { isAuthenticated } = useAuth() const { theme: { colors }, } = useAppTheme() return ( {isAuthenticated ? ( <> ) : ( <> )} {/** 🔥 Your screens go here */} {/* IGNITE_GENERATOR_ANCHOR_APP_STACK_SCREENS */} ) } export const AppNavigator = (props: NavigationProps) => { const { navigationTheme } = useAppTheme() useBackButtonHandler((routeName) => exitRoutes.includes(routeName)) return ( ) }