/* This file is part of the Notesnook project (https://notesnook.com/) Copyright (C) 2022 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 { NavigationContainer } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import * as React from "react"; import Container from "../components/container"; import Intro from "../components/intro"; import Favorites from "../screens/favorites"; import Home from "../screens/home"; import Notebook from "../screens/notebook"; import Notebooks from "../screens/notebooks"; import { ColoredNotes } from "../screens/notes/colored"; import { Monographs } from "../screens/notes/monographs"; import { TaggedNotes } from "../screens/notes/tagged"; import { TopicNotes } from "../screens/notes/topic-notes"; import { Search } from "../screens/search"; import Settings from "../screens/settings"; import AppLock from "../screens/settings/app-lock"; import Tags from "../screens/tags"; import Trash from "../screens/trash"; import { eSendEvent } from "../services/event-manager"; import SettingsService from "../services/settings"; import useNavigationStore from "../stores/use-navigation-store"; import { useSelectionStore } from "../stores/use-selection-store"; import { useThemeStore } from "../stores/use-theme-store"; import { history } from "../utils"; import { rootNavigatorRef } from "../utils/global-refs"; import { hideAllTooltips } from "../hooks/use-tooltip"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useSettingStore } from "../stores/use-setting-store"; const NativeStack = createNativeStackNavigator(); const IntroStack = createNativeStackNavigator(); /** * Intro Stack: * * Welcome Page * Select Privacy Mode Page * Login/Signup Page * */ const IntroStackNavigator = () => { const colors = useThemeStore((state) => state.colors); return ( ); }; const _Tabs = () => { const colors = useThemeStore((state) => state.colors); const homepage = SettingsService.get().homepage; const introCompleted = useSettingStore( (state) => state.settings.introCompleted ); const height = useSettingStore((state) => state.dimensions.height); const insets = useSafeAreaInsets(); const screenHeight = height - (50 + insets.top + insets.bottom); React.useEffect(() => { setTimeout(() => { useNavigationStore.getState().update({ name: homepage }); }, 1000); }, [homepage]); return ( null} initialRouteName={!introCompleted ? "Welcome" : homepage} backBehavior="history" screenOptions={{ headerShown: false, lazy: false, animation: "none", contentStyle: { backgroundColor: colors.bg, height: !introCompleted ? undefined : screenHeight } }} > ); }; const Tabs = React.memo(_Tabs, () => true); const _NavigationStack = () => { const clearSelection = useSelectionStore((state) => state.clearSelection); const onStateChange = React.useCallback(() => { if (history.selectionMode) { clearSelection(true); } hideAllTooltips(); eSendEvent("navigate"); }, [clearSelection]); return ( ); }; export const NavigationStack = React.memo(_NavigationStack, () => true);