/* This file is part of the Notesnook project (https://notesnook.com/) Copyright (C) 2023 Streetwriters (Private) Limited This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ import { useThemeColors } from "@notesnook/theme"; import { NavigationContainer } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import * as React from "react"; import { hideAllTooltips } from "../hooks/use-tooltip"; import SettingsService from "../services/settings"; import useNavigationStore, { RouteParams } from "../stores/use-navigation-store"; import { useSelectionStore } from "../stores/use-selection-store"; import { useSettingStore } from "../stores/use-setting-store"; import { rootNavigatorRef } from "../utils/global-refs"; const RootStack = createNativeStackNavigator(); const AppStack = createNativeStackNavigator(); let Notes: any = null; let Notebook: any = null; let Search: any = null; let Favorites: any = null; let Trash: any = null; let Reminders: any = null; let Monographs: any = null; let TaggedNotes: any = null; let ColoredNotes: any = null; const AppNavigation = React.memo( () => { const { colors } = useThemeColors(); const homepage = SettingsService.get().homepage; React.useEffect(() => { setTimeout(() => { useNavigationStore.getState().update(homepage as keyof RouteParams); useNavigationStore.getState().setFocusedRouteId(homepage); }, 300); }, [homepage]); return ( { Notes = Notes || require("../screens/home").default; return Notes; }} /> { Favorites = Favorites || require("../screens/favorites").default; return Favorites; }} /> { Trash = Trash || require("../screens/trash").default; return Trash; }} /> { TaggedNotes = TaggedNotes || require("../screens/notes/tagged").default; return TaggedNotes; }} /> { ColoredNotes = ColoredNotes || require("../screens/notes/colored").default; return ColoredNotes; }} /> { Reminders = Reminders || require("../screens/reminders").default; return Reminders; }} /> { Monographs = Monographs || require("../screens/notes/monographs").default; return Monographs; }} /> { Notebook = Notebook || require("../screens/notebook").default; return Notebook; }} /> { Search = Search || require("../screens/search").default; return Search; }} /> ); }, () => true ); AppNavigation.displayName = "AppNavigation"; let Intro: any = null; let Auth: any = null; let FluidPanelsView: any = null; let LinkNotebooks: any = null; let MoveNotebook: any = null; let MoveNotes: any = null; let Settings: any = null; export const RootNavigation = () => { const introCompleted = useSettingStore( (state) => state.settings.introCompleted ); const clearSelection = useSelectionStore((state) => state.clearSelection); const onStateChange = React.useCallback(() => { if (useSelectionStore.getState().selectionMode) { clearSelection(); } hideAllTooltips(); }, [clearSelection]); return ( { Intro = Intro || require("../components/intro").default; return Intro; }} /> { Auth = Auth || require("../components/auth").default; return Auth; }} /> { FluidPanelsView = FluidPanelsView || require("../navigation/fluid-panels-view").default; return FluidPanelsView; }} /> { LinkNotebooks = LinkNotebooks || require("../screens/link-notebooks").default; return LinkNotebooks; }} /> { MoveNotebook = MoveNotebook || require("../screens/move-notebook").default; return MoveNotebook; }} /> { MoveNotes = MoveNotes || require("../screens/move-notes").default; return MoveNotes; }} /> { Settings = Settings || require("../screens/settings").default; return Settings; }} /> ); }; export const AppNavigationStack = React.memo( () => { return ; }, () => true ); AppNavigationStack.displayName = "AppNavigationStack";