Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3406570
D8304.id28035.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
D8304.id28035.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,7 +317,7 @@
},
);
-const getChatNavState: (
+const getTabNavState: (
navigationState: ?PossiblyStaleNavigationState,
) => ?PossiblyStaleNavigationState = (
navigationState: ?PossiblyStaleNavigationState,
@@ -337,6 +337,14 @@
}
const tabState = getStateFromNavigatorRoute(firstCommunityDrawerSubroute);
+ return tabState;
+};
+
+const getChatNavStateFromTabNavState: (
+ tabState: ?PossiblyStaleNavigationState,
+) => ?PossiblyStaleNavigationState = (
+ tabState: ?PossiblyStaleNavigationState,
+) => {
if (!tabState) {
return null;
}
@@ -402,5 +410,6 @@
drawerSwipeEnabledSelector,
useCurrentLeafRouteName,
getRemoveEditMode,
- getChatNavState,
+ getTabNavState,
+ getChatNavStateFromTabNavState,
};
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,7 +15,11 @@
clearOverlayModalsActionType,
setRouteParamsActionType,
} from './action-types.js';
-import { getRemoveEditMode, getChatNavState } from './nav-selectors.js';
+import {
+ getChatNavStateFromTabNavState,
+ getRemoveEditMode,
+ getTabNavState,
+} from './nav-selectors.js';
import { removeScreensFromStack } from './navigation-utils.js';
type ClearOverlayModalsAction = {
@@ -57,7 +61,8 @@
action: OverlayRouterNavigationAction,
options: RouterConfigOptions,
) => {
- const chatNavState = getChatNavState(lastState);
+ const tabNavState = getTabNavState(lastState);
+ const chatNavState = getChatNavStateFromTabNavState(tabNavState);
const removeEditMode = getRemoveEditMode(chatNavState);
if (action.type === clearOverlayModalsActionType) {
const { keys } = action.payload;
diff --git a/native/navigation/tab-router.js b/native/navigation/tab-router.js
--- a/native/navigation/tab-router.js
+++ b/native/navigation/tab-router.js
@@ -8,6 +8,11 @@
} from '@react-navigation/native';
import { TabRouter } from '@react-navigation/native';
+import {
+ getChatNavStateFromTabNavState,
+ getRemoveEditMode,
+} from './nav-selectors.js';
+
type TabRouterNavigationAction = empty;
export type TabRouterExtraNavigationHelpers = {};
@@ -24,6 +29,12 @@
action: TabRouterNavigationAction,
options: RouterConfigOptions,
) => {
+ const chatNavState = getChatNavStateFromTabNavState(lastState);
+ const removeEditMode = getRemoveEditMode(chatNavState);
+ if (removeEditMode) {
+ removeEditMode(action);
+ return lastState;
+ }
return baseGetStateForAction(lastState, action, options);
},
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 5, 2:22 AM (14 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615622
Default Alt Text
D8304.id28035.diff (2 KB)
Attached To
Mode
D8304: [native] Blocking navigation in edit mode in the TabRouter
Attached
Detach File
Event Timeline
Log In to Comment