Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3404760
D8304.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.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 @@
},
);
-function getChatNavState(
+function getTabNavState(
navigationState: ?PossiblyStaleNavigationState,
): ?PossiblyStaleNavigationState {
if (!navigationState) {
@@ -335,6 +335,12 @@
}
const tabState = getStateFromNavigatorRoute(firstCommunityDrawerSubroute);
+ return tabState;
+}
+
+function getChatNavStateFromTabNavState(
+ tabState: ?PossiblyStaleNavigationState,
+): ?PossiblyStaleNavigationState {
if (!tabState) {
return null;
}
@@ -400,5 +406,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,11 @@
action: TabRouterNavigationAction,
options: RouterConfigOptions,
) => {
+ const chatNavState = getChatNavStateFromTabNavState(lastState);
+ const removeEditMode = getRemoveEditMode(chatNavState);
+ if (removeEditMode && removeEditMode(action) === 'ignore_action') {
+ return lastState;
+ }
return baseGetStateForAction(lastState, action, options);
},
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 4, 1:04 PM (10 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2614310
Default Alt Text
D8304.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