@devries-cameron20 / t3code Mirror · read-only / commits / 002e941fbb
Fork 0

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 22, 19:30 UTC

fix(mobile): preserve new-thread drafts and native header layout (#23366)

Julius Marminge committed Oct 21, 2026 at 21:36 UTC 002e941fbb2ec01a4f4b02355995117e68452322
5 files changed +27 -17
apps/mobile/src/Stack.tsx
+17 -1
@@ -1059,10 +1059,19 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
1059 const nativeMetrics = useNativeLayoutMetrics();
1060 const usesSplitView = deriveLayout({ width, height, nativeMetrics }).usesSplitView;
1061 const usesWorkspaceFlowScreens = Platform.OS === "android" || usesSplitView;
1062 + const flowPresentations = useRef(new Map<string, boolean>());
1063
1064 return (
1065 <Navigator
1066 screenLayout={(props) => <GuardedScreenLayout {...props} />}
1067 + screenListeners={{
1068 + state: ({ data }) => {
1069 + const keys = new Set(data.state.routes.map((route) => route.key));
1070 + for (const key of flowPresentations.current.keys()) {
1071 + if (!keys.has(key)) flowPresentations.current.delete(key);
1072 + }
1073 + },
1074 + }}
1075 screenOptions={({ route }) => {
1076 if (route.name !== "SettingsSheet" && route.name !== "NewTaskSheet") {
1077 return Platform.OS === "android"
@@ -1070,7 +1079,14 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
1079 : {};
1080 }
1081
1073 - return usesWorkspaceFlowScreens
1082 + // Moving an open flow between a sheet and a split column remounts its nested
1083 + // navigator. Keep its presentation until dismissal so folding preserves the draft.
1084 + let usesCard = flowPresentations.current.get(route.key);
1085 + if (usesCard === undefined) {
1086 + usesCard = usesWorkspaceFlowScreens;
1087 + flowPresentations.current.set(route.key, usesCard);
1088 + }
1089 + return usesCard
1090 ? { presentation: "card" }
1091 : {
1092 presentation: "formSheet",
apps/mobile/src/features/layout/WorkspaceEmptyDetail.tsx
+1 -1
@@ -65,7 +65,7 @@ export function WorkspaceEmptyDetail(props: {
65 className="mt-2 flex-row items-center gap-2 rounded-full bg-primary px-5 py-3 active:opacity-70"
66 onPress={props.onStartNewTask}
67 >
68 - <Text className="text-base font-t3-bold text-primary-foreground">New Task</Text>
68 + <Text className="text-base font-t3-bold text-primary-foreground">New thread</Text>
69 </Pressable>
70 )
71 ) : null}
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+2 -2
@@ -282,8 +282,8 @@ function WorkspaceColumns(
282 <WorkspaceEmptyDetail
283 tab={selectedTab}
284 onStartNewTask={
285 - // The detail bar or a visible sidebar already carries compose.
286 - detailCompose || panes.primarySidebarVisible ? undefined : openNewTask
285 + // Duo provides compose in the detail bar; iPad uses the empty-state action.
286 + detailCompose ? undefined : openNewTask
287 }
288 />
289 </ColumnContent>
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+5 -10
@@ -21,9 +21,9 @@ import {
21 usePreventRemove,
22 type NavigationAction,
23 } from "@react-navigation/native";
24 -import { HeaderHeightContext } from "@react-navigation/elements";
25 -import { useContext, useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from "react";
26 -import { Platform, Pressable, ScrollView, View } from "react-native";
24 +import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from "react";
25 +import { Platform, Pressable, View } from "react-native";
26 +import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
27 import {
28 KeyboardController,
29 KeyboardStickyView,
@@ -215,9 +215,6 @@ export function NewTaskDraftScreen(props: {
215 reserveShare,
216 } = useIncomingShare();
217 const insets = useSafeAreaInsets();
218 - // The iOS glass header floats over the hero, and its height differs between an
219 - // iPhone sheet and an iPad column that also carries the status bar.
220 - const navigationHeaderHeight = useContext(HeaderHeightContext) ?? insets.top + 56;
218 const isKeyboardVisible = useKeyboardState((state) => state.isVisible);
219 const controlsBottomPadding = Math.max(insets.bottom, 10);
220 const keyboardOpenedOffset = Math.max(0, controlsBottomPadding - 8);
@@ -1553,11 +1550,8 @@ export function NewTaskDraftScreen(props: {
1550 <ScrollView
1551 alwaysBounceVertical={isKeyboardVisible}
1552 className="flex-1"
1556 - contentInsetAdjustmentBehavior="never"
1553 + contentInsetAdjustmentBehavior="automatic"
1554 contentContainerClassName="grow items-center pb-[236px] pt-12"
1558 - contentContainerStyle={
1559 - Platform.OS === "ios" ? { paddingTop: navigationHeaderHeight + 16 } : undefined
1560 - }
1555 keyboardDismissMode={Platform.OS === "ios" ? "interactive" : "on-drag"}
1556 keyboardShouldPersistTaps="handled"
1557 showsVerticalScrollIndicator={false}
@@ -1851,6 +1845,7 @@ export function NewTaskDraftScreen(props: {
1845 headerBackVisible: false,
1846 headerShadowVisible: false,
1847 title: "New thread",
1848 + unstable_navigationItemStyle: "editor",
1849 }}
1850 />
1851 <SheetHeader
apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+2 -3
@@ -67,9 +67,8 @@ export function WorkspaceToolbar(props: {
67 // On the Duo, compose belongs to the threads tab, in the detail column's bar when unfolded.
68 const nativeToolbarCompose =
69 Platform.OS === "ios" &&
70 - (isDuoDevice(deviceType)
71 - ? deviceType === "duo-folded" && workspace.state.selectedTab === "threads"
72 - : deviceType === "pad");
70 + deviceType === "duo-folded" &&
71 + workspace.state.selectedTab === "threads";
72 // The Duo searches from a field at the bottom of the list in every pose. UIKit has no such
73 // placement once the vertical bar holds the toolbar, and re-placing its search controller on
74 // each fold replaces the search field.