Page MenuHomePhabricator

D8270.diff
No OneTemporary

D8270.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,44 @@
},
);
+function getChatNavState(
+ navigationState: ?PossiblyStaleNavigationState,
+): ?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);
+ if (!tabState) {
+ return null;
+ }
+ 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;
+}
+
function getRemoveEditMode(
chatRouteState: ?PossiblyStaleNavigationState,
): ?RemoveEditMode {
@@ -362,4 +400,5 @@
drawerSwipeEnabledSelector,
useCurrentLeafRouteName,
getRemoveEditMode,
+ getChatNavState,
};
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 { getRemoveEditMode, getChatNavState } from './nav-selectors.js';
import { removeScreensFromStack } from './navigation-utils.js';
type ClearOverlayModalsAction = {
@@ -56,6 +57,8 @@
action: OverlayRouterNavigationAction,
options: RouterConfigOptions,
) => {
+ const chatNavState = getChatNavState(lastState);
+ const removeEditMode = getRemoveEditMode(chatNavState);
if (action.type === clearOverlayModalsActionType) {
const { keys } = action.payload;
if (!lastState) {
@@ -81,6 +84,8 @@
...lastState,
routes: newRoutes,
};
+ } else if (removeEditMode && removeEditMode(action) === 'ignore_action') {
+ return lastState;
} else {
return baseGetStateForAction(lastState, action, options);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 4, 1:17 PM (10 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2614348
Default Alt Text
D8270.diff (2 KB)

Event Timeline