Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32564344
D5734.1767369560.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
11 KB
Referenced Files
None
Subscribers
None
D5734.1767369560.diff
View Options
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
@@ -17,6 +17,7 @@
import {
AppRouteName,
ChatRouteName,
+ CommunityDrawerNavigatorRouteName,
TabNavigatorRouteName,
} from '../navigation/route-names';
import { useSelector } from '../redux/redux-utils';
@@ -41,8 +42,12 @@
'Navigation context should contain route for AppNavigator ' +
'when ThreadScreenPruner is rendered',
);
- const tabRoute = getChildRouteFromNavigatorRoute(
+ const communityDrawerRoute = getChildRouteFromNavigatorRoute(
appRoute,
+ CommunityDrawerNavigatorRouteName,
+ );
+ const tabRoute = getChildRouteFromNavigatorRoute(
+ communityDrawerRoute,
TabNavigatorRouteName,
);
const chatRoute = getChildRouteFromNavigatorRoute(
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
@@ -19,6 +19,7 @@
import { RootContext } from '../root-context';
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,
@@ -26,7 +27,6 @@
} from './overlay-navigator.react';
import type { RootNavigationProp } from './root-navigator.react';
import {
- TabNavigatorRouteName,
ImageModalRouteName,
MultimediaMessageTooltipModalRouteName,
ActionResultModalRouteName,
@@ -36,10 +36,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'>,
@@ -27,9 +43,7 @@
return (
<View style={styles.drawerView}>
<Drawer.Navigator
- screenOptions={{
- drawerStyle: styles.drawerStyle,
- }}
+ screenOptions={{ drawerStyle: styles.drawerStyle }}
drawerContent={communityDrawerContent}
>
<Drawer.Screen name={TabNavigatorRouteName} component={TabNavigator} />
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
@@ -38,6 +38,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';
@@ -94,7 +95,7 @@
};
export type OverlayParamList = {
- +TabNavigator: void,
+ +CommunityDrawerNavigator: void,
+ImageModal: ImageModalParams,
+ActionResultModal: ActionResultModalParams,
+CameraModal: CameraModalParams,
@@ -135,6 +136,8 @@
+BlockList: void,
};
+export type CommunityDrawerParamList = { +TabNavigator: void };
+
export type ScreenParamList = {
...RootParamList,
...OverlayParamList,
@@ -142,6 +145,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
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 2, 3:59 PM (10 h, 20 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5880107
Default Alt Text
D5734.1767369560.diff (11 KB)
Attached To
Mode
D5734: [native] Add community drawer to navigation hierarchy
Attached
Detach File
Event Timeline
Log In to Comment