Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3406664
D8270.id27921.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D8270.id27921.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,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
Details
Attached
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)
Attached To
Mode
D8270: [native] Blocking navigation in edit mode in OverlayRouter
Attached
Detach File
Event Timeline
Log In to Comment