Page MenuHomePhabricator

D8270.id27921.diff
No OneTemporary

D8270.id27921.diff

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
@@ -317,6 +317,43 @@
},
);
+const getChatTabSubrouteState: (
+ navigationState: ?PossiblyStaleNavigationState,
+) => ?PossiblyStaleNavigationState = (
+ navigationState: ?PossiblyStaleNavigationState,
+) => {
+ if (!navigationState) {
+ return null;
+ }
+ const [firstAppSubroute] = navigationState.routes;
+ if (firstAppSubroute.name !== CommunityDrawerNavigatorRouteName) {
+ return null;
+ }
+
+ const communityDrawerState = getStateFromNavigatorRoute(firstAppSubroute);
+ const [firstCommunityDrawerSubroute] = communityDrawerState.routes;
+ if (firstCommunityDrawerSubroute.name !== TabNavigatorRouteName) {
+ return null;
+ }
+
+ const tabState = getStateFromNavigatorRoute(firstCommunityDrawerSubroute);
+ let chatRoute;
+ for (const route of tabState.routes) {
+ if (route.name === ChatRouteName) {
+ chatRoute = route;
+ break;
+ }
+ }
+ if (!chatRoute || !chatRoute.state) {
+ return null;
+ }
+ const chatRouteState = getStateFromNavigatorRoute(chatRoute);
+ if (chatRouteState.type !== 'stack') {
+ return null;
+ }
+ return chatRouteState;
+};
+
const getRemoveEditMode: (
chatRouteState: ?PossiblyStaleNavigationState,
) => ?RemoveEditMode = (chatRouteState: ?PossiblyStaleNavigationState) => {
@@ -362,4 +399,5 @@
drawerSwipeEnabledSelector,
useCurrentLeafRouteName,
getRemoveEditMode,
+ getChatTabSubrouteState,
};
diff --git a/native/navigation/overlay-router.js b/native/navigation/overlay-router.js
--- a/native/navigation/overlay-router.js
+++ b/native/navigation/overlay-router.js
@@ -15,6 +15,7 @@
clearOverlayModalsActionType,
setRouteParamsActionType,
} from './action-types.js';
+import { getChatTabSubrouteState, getRemoveEditMode } from './nav-selectors.js';
import { removeScreensFromStack } from './navigation-utils.js';
type ClearOverlayModalsAction = {
@@ -56,6 +57,8 @@
action: OverlayRouterNavigationAction,
options: RouterConfigOptions,
) => {
+ const subrouteState = getChatTabSubrouteState(lastState);
+ const removeEditMode = getRemoveEditMode(subrouteState);
if (action.type === clearOverlayModalsActionType) {
const { keys } = action.payload;
if (!lastState) {
@@ -81,6 +84,9 @@
...lastState,
routes: newRoutes,
};
+ } else if (removeEditMode) {
+ removeEditMode(action);
+ return lastState;
} else {
return baseGetStateForAction(lastState, action, options);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 5, 2:48 AM (13 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615671
Default Alt Text
D8270.id27921.diff (2 KB)

Event Timeline