import React, { useEffect } from 'react'; import { useIsFocused } from '@react-navigation/native'; import { createStackNavigator, StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack'; import { createDrawerNavigator } from '@react-navigation/drawer'; import { ThemeContext } from '../../theme'; import { FadeFromCenterModal, StackAnimation, defaultHeader, themedHeader, drawerStyle } from '../../lib/methods/helpers/navigation'; // Chats Stack import RoomView from '../../views/RoomView'; import RoomsListView from '../../views/RoomsListView'; import RoomActionsView from '../../views/RoomActionsView'; import RoomInfoView from '../../views/RoomInfoView'; import RoomInfoEditView from '../../views/RoomInfoEditView'; import RoomMembersView from '../../views/RoomMembersView'; import SearchMessagesView from '../../views/SearchMessagesView'; import SelectedUsersView from '../../views/SelectedUsersView'; import InviteUsersView from '../../views/InviteUsersView'; import InviteUsersEditView from '../../views/InviteUsersEditView'; import MessagesView from '../../views/MessagesView'; import AutoTranslateView from '../../views/AutoTranslateView'; import DirectoryView from '../../views/DirectoryView'; import NotificationPrefView from '../../views/NotificationPreferencesView'; import ForwardLivechatView from '../../views/ForwardLivechatView'; import CloseLivechatView from '../../views/CloseLivechatView'; import CannedResponsesListView from '../../views/CannedResponsesListView'; import CannedResponseDetail from '../../views/CannedResponseDetail'; import LivechatEditView from '../../views/LivechatEditView'; import PickerView from '../../views/PickerView'; import ThreadMessagesView from '../../views/ThreadMessagesView'; import TeamChannelsView from '../../views/TeamChannelsView'; import MarkdownTableView from '../../views/MarkdownTableView'; import ReadReceiptsView from '../../views/ReadReceiptView'; import ProfileView from '../../views/ProfileView'; import DisplayPrefsView from '../../views/DisplayPrefsView'; import SettingsView from '../../views/SettingsView'; import LanguageView from '../../views/LanguageView'; import ThemeView from '../../views/ThemeView'; import DefaultBrowserView from '../../views/DefaultBrowserView'; import ScreenLockConfigView from '../../views/ScreenLockConfigView'; import AdminPanelView from '../../views/AdminPanelView'; import NewMessageView from '../../views/NewMessageView'; import CreateChannelView from '../../views/CreateChannelView'; import UserPreferencesView from '../../views/UserPreferencesView'; import UserNotificationPrefView from '../../views/UserNotificationPreferencesView'; import SecurityPrivacyView from '../../views/SecurityPrivacyView'; import E2EEncryptionSecurityView from '../../views/E2EEncryptionSecurityView'; // InsideStackNavigator import AttachmentView from '../../views/AttachmentView'; import ModalBlockView from '../../views/ModalBlockView'; import JitsiMeetView from '../../views/JitsiMeetView'; import StatusView from '../../views/StatusView'; import CreateDiscussionView from '../../views/CreateDiscussionView'; import E2ESaveYourPasswordView from '../../views/E2ESaveYourPasswordView'; import E2EHowItWorksView from '../../views/E2EHowItWorksView'; import E2EEnterYourPasswordView from '../../views/E2EEnterYourPasswordView'; import { deleteKeyCommands, setKeyCommands } from '../../commands'; import ShareView from '../../views/ShareView'; import QueueListView from '../../ee/omnichannel/views/QueueListView'; import AddChannelTeamView from '../../views/AddChannelTeamView'; import AddExistingChannelView from '../../views/AddExistingChannelView'; import SelectListView from '../../views/SelectListView'; import DiscussionsView from '../../views/DiscussionsView'; import { ModalContainer } from './ModalContainer'; import { MasterDetailChatsStackParamList, MasterDetailDrawerParamList, MasterDetailInsideStackParamList, ModalStackParamList } from './types'; // ChatsStackNavigator const ChatsStack = createStackNavigator(); const ChatsStackNavigator = React.memo(() => { const { theme } = React.useContext(ThemeContext); const isFocused = useIsFocused(); useEffect(() => { if (isFocused) { setKeyCommands(); } else { deleteKeyCommands(); } return () => { deleteKeyCommands(); }; }, [isFocused]); return ( ); }); // DrawerNavigator const Drawer = createDrawerNavigator(); const DrawerNavigator = React.memo(() => ( } > )); export interface INavigation { navigation: StackNavigationProp; } const ModalStack = createStackNavigator(); const ModalStackNavigator = React.memo(({ navigation }: INavigation) => { const { theme } = React.useContext(ThemeContext); return ( DirectoryView.navigationOptions!({ ...props, isMasterDetail: true })} /> ReadReceiptsView.navigationOptions!({ ...props, isMasterDetail: true })} /> SettingsView.navigationOptions!({ ...props, isMasterDetail: true })} /> ); }); // InsideStackNavigator const InsideStack = createStackNavigator(); const InsideStackNavigator = React.memo(() => { const { theme } = React.useContext(ThemeContext); return ( ); }); export default InsideStackNavigator;