The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 17:15 UTC
fix(mobile): a sub-agent opened from its parent on a narrow iPad keeps Back (#36175)
Julius Marminge committed
Nov 13, 2026 at 05:59 UTC
095611d1b55930ba23e22068b6659df4c4b53f83
1 file changed
+14
-3
apps/mobile/src/components/ui/AppBar.tsx
+14
-3
@@ -1,8 +1,8 @@
1
import { Toolbar } from "./Toolbar";
2
import { AppActivityIndicator } from "./AppActivityIndicator";
3
import type { HeaderBarButtonMailSearchToolbarItem, SearchBarCommands } from "react-native-screens";
4
-import { NavigationContext } from "@react-navigation/native";
5
-import { use, useId, useLayoutEffect, useRef } from "react";
4
+import { NavigationContext, NavigationRouteContext } from "@react-navigation/native";
5
+import { use, useId, useLayoutEffect, useRef, useSyncExternalStore } from "react";
6
import { View } from "react-native";
7
import { createNativeHeaderMenu } from "./nativeHeaderMenu.ios";
8
import { ScreenHeaderButton } from "./ScreenHeaderButton";
@@ -63,6 +63,17 @@ export function AppBar(props: AppBarProps) {
63
? { ...props.backInSplitView, onPress: splitBackPress }
64
: null;
65
const navigation = use(NavigationContext);
66
+ const route = use(NavigationRouteContext);
67
+ // A thread opened from another thread sits on it, not beside the list, so it keeps Back.
68
+ const threadBelow = useSyncExternalStore(
69
+ (onChange) => navigation?.addListener("state", onChange) ?? (() => {}),
70
+ () => {
71
+ const routes = navigation?.getState()?.routes;
72
+ const index = routes?.findIndex((candidate) => candidate.key === route?.key) ?? -1;
73
+ return route?.name === "Thread" && index > 0 && routes?.[index - 1]?.name === "Thread";
74
+ },
75
+ );
76
+ const listBeside = layout.usesSplitView && props.onBackToList !== undefined && !threadBelow;
77
const rootBack =
78
!layout.usesSplitView && props.onBackToList && navigation?.canGoBack() === false
79
? props.onBackToList
@@ -113,7 +124,7 @@ export function AppBar(props: AppBarProps) {
124
headerBackVisible:
125
props.onClose === undefined &&
126
splitBack === null &&
116
- !(layout.usesSplitView && props.onBackToList) &&
127
+ !listBeside &&
128
!(props.guardBack && props.onBack),
129
...(props.guardBack ? { gestureEnabled: false } : undefined),
130
title: props.title,