Page MenuHomePhabricator

D5734.id20367.diff
No OneTemporary

D5734.id20367.diff

diff --git a/native/chat/thread-screen-pruner.react.js b/native/chat/thread-screen-pruner.react.js
--- a/native/chat/thread-screen-pruner.react.js
+++ b/native/chat/thread-screen-pruner.react.js
@@ -16,6 +16,7 @@
import {
AppRouteName,
ChatRouteName,
+ CommunityDrawerNavigatorRouteName,
TabNavigatorRouteName,
} from '../navigation/route-names';
import { useSelector } from '../redux/redux-utils';
@@ -40,8 +41,15 @@
'Navigation context should contain route for AppNavigator ' +
'when ThreadScreenPruner is rendered',
);
- const tabRoute = getChildRouteFromNavigatorRoute(
+ const communityDrawerRoute = getChildRouteFromNavigatorRoute(
appRoute,
+ CommunityDrawerNavigatorRouteName,
+ );
+ if (!communityDrawerRoute) {
+ return null;
+ }
+ const tabRoute = getChildRouteFromNavigatorRoute(
+ communityDrawerRoute,
TabNavigatorRouteName,
);
if (!tabRoute) {
diff --git a/native/navigation/app-navigator.react.js b/native/navigation/app-navigator.react.js
--- a/native/navigation/app-navigator.react.js
+++ b/native/navigation/app-navigator.react.js
@@ -20,6 +20,7 @@
import { useLoadCommFonts } from '../themes/fonts';
import { waitForInteractions } from '../utils/timers';
import ActionResultModal from './action-result-modal.react';
+import { CommunityDrawerNavigator } from './community-drawer-navigator.react';
import { createOverlayNavigator } from './overlay-navigator.react';
import type {
OverlayNavigationProp,
@@ -27,7 +28,6 @@
} from './overlay-navigator.react';
import type { RootNavigationProp } from './root-navigator.react';
import {
- TabNavigatorRouteName,
ImageModalRouteName,
MultimediaMessageTooltipModalRouteName,
ActionResultModalRouteName,
@@ -37,10 +37,10 @@
RobotextMessageTooltipModalRouteName,
CameraModalRouteName,
VideoPlaybackModalRouteName,
+ CommunityDrawerNavigatorRouteName,
type ScreenParamList,
type OverlayParamList,
} from './route-names';
-import TabNavigator from './tab-navigator.react';
let splashScreenHasHidden = false;
@@ -104,7 +104,10 @@
return (
<KeyboardStateContainer>
<App.Navigator>
- <App.Screen name={TabNavigatorRouteName} component={TabNavigator} />
+ <App.Screen
+ name={CommunityDrawerNavigatorRouteName}
+ component={CommunityDrawerNavigator}
+ />
<App.Screen name={ImageModalRouteName} component={ImageModal} />
<App.Screen
name={MultimediaMessageTooltipModalRouteName}
diff --git a/native/navigation/community-drawer-navigator.react.js b/native/navigation/community-drawer-navigator.react.js
--- a/native/navigation/community-drawer-navigator.react.js
+++ b/native/navigation/community-drawer-navigator.react.js
@@ -1,6 +1,10 @@
// @flow
-import { createDrawerNavigator } from '@react-navigation/drawer';
+import {
+ createDrawerNavigator,
+ type DrawerNavigationHelpers,
+ type DrawerNavigationProp,
+} from '@react-navigation/drawer';
import * as React from 'react';
import { Dimensions, View } from 'react-native';
@@ -8,13 +12,25 @@
import type { AppNavigationProp } from './app-navigator.react';
import CommunityDrawerContent from './community-drawer-content.react';
import { TabNavigatorRouteName } from './route-names';
-import type { NavigationRoute } from './route-names';
+import type {
+ NavigationRoute,
+ ScreenParamList,
+ CommunityDrawerParamList,
+} from './route-names';
import TabNavigator from './tab-navigator.react';
-const Drawer = createDrawerNavigator();
-
const communityDrawerContent = () => <CommunityDrawerContent />;
+export type CommunityDrawerNavigationProp<
+ RouteName: $Keys<CommunityDrawerParamList> = $Keys<CommunityDrawerParamList>,
+> = DrawerNavigationProp<ScreenParamList, RouteName>;
+
+const Drawer = createDrawerNavigator<
+ ScreenParamList,
+ CommunityDrawerParamList,
+ DrawerNavigationHelpers<ScreenParamList>,
+>();
+
type Props = {
+navigation: AppNavigationProp<'CommunityDrawerNavigator'>,
+route: NavigationRoute<'CommunityDrawerNavigator'>,
diff --git a/native/navigation/default-state.js b/native/navigation/default-state.js
--- a/native/navigation/default-state.js
+++ b/native/navigation/default-state.js
@@ -16,6 +16,7 @@
HomeChatThreadListRouteName,
BackgroundChatThreadListRouteName,
AppsRouteName,
+ CommunityDrawerNavigatorRouteName,
} from './route-names';
export type NavInfo = $Exact<BaseNavInfo>;
@@ -31,40 +32,49 @@
index: 0,
routes: [
{
- name: TabNavigatorRouteName,
+ name: CommunityDrawerNavigatorRouteName,
state: {
- type: 'tab',
+ type: 'drawer',
index: 0,
routes: [
{
- name: ChatRouteName,
+ name: TabNavigatorRouteName,
state: {
- type: 'stack',
+ type: 'tab',
index: 0,
routes: [
{
- name: ChatThreadListRouteName,
+ name: ChatRouteName,
state: {
- type: 'tab',
+ type: 'stack',
index: 0,
routes: [
- { name: HomeChatThreadListRouteName },
- { name: BackgroundChatThreadListRouteName },
+ {
+ name: ChatThreadListRouteName,
+ state: {
+ type: 'tab',
+ index: 0,
+ routes: [
+ { name: HomeChatThreadListRouteName },
+ { name: BackgroundChatThreadListRouteName },
+ ],
+ },
+ },
],
},
},
+ {
+ name: ProfileRouteName,
+ state: {
+ type: 'stack',
+ index: 0,
+ routes: [{ name: ProfileScreenRouteName }],
+ },
+ },
+ { name: AppsRouteName },
],
},
},
- {
- name: ProfileRouteName,
- state: {
- type: 'stack',
- index: 0,
- routes: [{ name: ProfileScreenRouteName }],
- },
- },
- { name: AppsRouteName },
],
},
},
diff --git a/native/navigation/nav-selectors.js b/native/navigation/nav-selectors.js
--- a/native/navigation/nav-selectors.js
+++ b/native/navigation/nav-selectors.js
@@ -31,6 +31,7 @@
scrollBlockingModals,
chatRootModals,
threadRoutes,
+ CommunityDrawerNavigatorRouteName,
} from './route-names';
const baseCreateIsForegroundSelector = (routeName: string) =>
@@ -73,10 +74,15 @@
}
const appState = getStateFromNavigatorRoute(currentRootSubroute);
const [firstAppSubroute] = appState.routes;
- if (firstAppSubroute.name !== TabNavigatorRouteName) {
+ if (firstAppSubroute.name !== CommunityDrawerNavigatorRouteName) {
return false;
}
- const tabState = getStateFromNavigatorRoute(firstAppSubroute);
+ const communityDrawerState = getStateFromNavigatorRoute(firstAppSubroute);
+ const [firstCommunityDrawerSubroute] = communityDrawerState.routes;
+ if (firstCommunityDrawerSubroute.name !== TabNavigatorRouteName) {
+ return false;
+ }
+ const tabState = getStateFromNavigatorRoute(firstCommunityDrawerSubroute);
return tabState.routes[tabState.index].name === routeName;
},
);
@@ -155,10 +161,15 @@
}
const appState = getStateFromNavigatorRoute(currentRootSubroute);
const [firstAppSubroute] = appState.routes;
- if (firstAppSubroute.name !== TabNavigatorRouteName) {
+ if (firstAppSubroute.name !== CommunityDrawerNavigatorRouteName) {
+ return null;
+ }
+ const communityDrawerState = getStateFromNavigatorRoute(firstAppSubroute);
+ const [firstCommunityDrawerSubroute] = communityDrawerState.routes;
+ if (firstCommunityDrawerSubroute.name !== TabNavigatorRouteName) {
return null;
}
- const tabState = getStateFromNavigatorRoute(firstAppSubroute);
+ const tabState = getStateFromNavigatorRoute(firstCommunityDrawerSubroute);
const currentTabSubroute = tabState.routes[tabState.index];
if (currentTabSubroute.name !== ChatRouteName) {
return null;
diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js
--- a/native/navigation/route-names.js
+++ b/native/navigation/route-names.js
@@ -39,6 +39,7 @@
export const ColorSelectorModalRouteName = 'ColorSelectorModal';
export const ComposeSubchannelModalRouteName = 'ComposeSubchannelModal';
export const ComposeSubchannelRouteName = 'ComposeSubchannel';
+export const CommunityDrawerNavigatorRouteName = 'CommunityDrawerNavigator';
export const CustomServerModalRouteName = 'CustomServerModal';
export const DefaultNotificationsPreferencesRouteName = 'DefaultNotifications';
export const DeleteAccountRouteName = 'DeleteAccount';
@@ -97,7 +98,7 @@
};
export type OverlayParamList = {
- +TabNavigator: void,
+ +CommunityDrawerNavigator: void,
+ImageModal: ImageModalParams,
+ActionResultModal: ActionResultModalParams,
+CameraModal: CameraModalParams,
@@ -138,6 +139,8 @@
+BlockList: void,
};
+export type CommunityDrawerParamList = { +TabNavigator: void };
+
export type ScreenParamList = {
...RootParamList,
...OverlayParamList,
@@ -145,6 +148,7 @@
...ChatParamList,
...ChatTopTabsParamList,
...ProfileParamList,
+ ...CommunityDrawerParamList,
};
export type NavigationRoute<
diff --git a/native/navigation/tab-navigator.react.js b/native/navigation/tab-navigator.react.js
--- a/native/navigation/tab-navigator.react.js
+++ b/native/navigation/tab-navigator.react.js
@@ -16,6 +16,7 @@
import Profile from '../profile/profile.react';
import { useSelector } from '../redux/redux-utils';
import { useColors } from '../themes/colors';
+import type { CommunityDrawerNavigationProp } from './community-drawer-navigator.react';
import {
CalendarRouteName,
ChatRouteName,
@@ -67,7 +68,7 @@
BottomTabNavigationHelpers<ScreenParamList>,
>();
type Props = {
- +navigation: TabNavigationProp<'TabNavigator'>,
+ +navigation: CommunityDrawerNavigationProp<'TabNavigator'>,
+route: NavigationRoute<'TabNavigator'>,
};
// eslint-disable-next-line no-unused-vars

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 10:38 PM (20 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577520
Default Alt Text
D5734.id20367.diff (10 KB)

Event Timeline