Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32233150
D8270.1765219049.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D8270.1765219049.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 8, 6:37 PM (18 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5849888
Default Alt Text
D8270.1765219049.diff (2 KB)
Attached To
Mode
D8270: [native] Blocking navigation in edit mode in OverlayRouter
Attached
Detach File
Event Timeline
Log In to Comment