From 036e481ec0bd26b49d32f0dd3a1c12c4c5743112 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 29 Jun 2026 22:12:22 -0700 Subject: [PATCH] Fix native iOS thread header integration --- .../features/threads/ThreadGitControls.tsx | 188 +++++++++--------- .../features/threads/ThreadRouteScreen.tsx | 22 +- patches/expo-router@56.2.11.patch | 27 ++- pnpm-lock.yaml | 44 ++-- 4 files changed, 151 insertions(+), 130 deletions(-) diff --git a/apps/mobile/src/features/threads/ThreadGitControls.tsx b/apps/mobile/src/features/threads/ThreadGitControls.tsx index 428b560717..df170b24ca 100644 --- a/apps/mobile/src/features/threads/ThreadGitControls.tsx +++ b/apps/mobile/src/features/threads/ThreadGitControls.tsx @@ -426,115 +426,111 @@ export function ThreadGitControls(props: ThreadGitControlsProps) { /> ) : null} {showActionControls ? ( - <> - - {props.projectScripts.length > 0 ? ( - props.projectScripts.map((script) => ( - void props.onRunProjectScript(script)} - subtitle={script.command} - > - {projectScriptMenuLabel(script)} - - )) - ) : ( + + {props.projectScripts.length > 0 ? ( + props.projectScripts.map((script) => ( {}} - subtitle="This project has no saved scripts yet" + key={script.id} + icon={projectScriptMenuIcon(script.icon)} + onPress={() => void props.onRunProjectScript(script)} + subtitle={script.command} > - No project scripts + {projectScriptMenuLabel(script)} - )} - {props.terminalSessions.map((session) => ( - props.onOpenTerminal(session.terminalId)} - subtitle={[ - getTerminalStatusLabel({ - status: session.status, - hasRunningSubprocess: session.hasRunningSubprocess, - }), - basename(session.cwd), - ] - .filter(Boolean) - .join(" · ")} - > - {session.displayLabel} - - ))} + )) + ) : ( - Open new terminal - - - {props.showDirectFileControl ? ( - - ) : null} - - {}} - subtitle={compactMenuStatus(props.gitStatus)} + subtitle="This project has no saved scripts yet" > - - {compactMenuBranchLabel(model.currentBranchLabel)} - + No project scripts + )} + {props.terminalSessions.map((session) => ( void model.runQuickAction()} - subtitle={model.quickActionHint ?? undefined} + key={session.terminalId} + icon="terminal" + onPress={() => props.onOpenTerminal(session.terminalId)} + subtitle={[ + getTerminalStatusLabel({ + status: session.status, + hasRunningSubprocess: session.hasRunningSubprocess, + }), + basename(session.cwd), + ] + .filter(Boolean) + .join(" · ")} > - {model.quickAction.label} + {session.displayLabel} - - Review changes - - - Files - - - More - - - + ))} + + Open new terminal + + ) : null} - {props.showSearchSlot ? ( - <> - - - + {showActionControls && props.showDirectFileControl ? ( + ) : null} + {showActionControls ? ( + + {}} + subtitle={compactMenuStatus(props.gitStatus)} + > + + {compactMenuBranchLabel(model.currentBranchLabel)} + + + void model.runQuickAction()} + subtitle={model.quickActionHint ?? undefined} + > + {model.quickAction.label} + + + Review changes + + + Files + + + More + + + ) : null} + {props.showSearchSlot ? : null} + {props.showSearchSlot ? : null} ); } diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx index 2618e6a021..d9b57608bb 100644 --- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx @@ -674,20 +674,8 @@ function ThreadRouteContent( type: "button" as const, width: 58, }, - { - flexible: true, - spacing: 0, - type: "spacing" as const, - }, - ...threadCenterHeaderItems, - ], - [ - panes.primarySidebarVisible, - props.onReturnToThread, - router, - threadCenterHeaderItems, - togglePrimarySidebar, ], + [panes.primarySidebarVisible, props.onReturnToThread, router, togglePrimarySidebar], ); if (!environmentId || !threadId) { @@ -749,11 +737,17 @@ function ThreadRouteContent( : undefined, unstable_headerLeftItems: layout.usesSplitView && Platform.OS === "ios" ? () => splitLeftHeaderItems : undefined, + unstable_headerCenterItems: + layout.usesSplitView && Platform.OS === "ios" + ? () => threadCenterHeaderItems + : undefined, + unstable_headerSubtitle: + usesNativeHeaderGlass && !layout.usesSplitView ? headerSubtitle : undefined, unstable_navigationItemStyle: usesNativeHeaderGlass ? "editor" : undefined, }} /> - {layout.usesSplitView ? null : ( + {layout.usesSplitView || usesNativeHeaderGlass ? null : ( NativeStackHeaderItem[]; @@ -24,6 +24,14 @@ index 6de73e0c33cedbaaaffdcb092ba21fc9ff71862e..78929fe237b7f9d7808f8de2b844e822 + */ + unstable_headerToolbarItems?: (props: NativeStackHeaderItemProps) => NonNullable; + /** ++ * String displayed below the compact navigation title on iOS 26+. ++ * ++ * This is an unstable API and might change in the future. ++ * ++ * @platform ios ++ */ ++ unstable_headerSubtitle?: ScreenStackHeaderConfigProps['subtitle']; ++ /** + * Native iOS navigation item style to apply to the header. + * + * This is an unstable API and might change in the future. @@ -34,7 +42,7 @@ index 6de73e0c33cedbaaaffdcb092ba21fc9ff71862e..78929fe237b7f9d7808f8de2b844e822 /** * String or a function that returns a React Element to be used by the header. * Defaults to screen `title` or route name. -@@ -1115,7 +1140,8 @@ export type NativeStackHeaderItemCustom = { +@@ -1115,7 +1148,8 @@ export type NativeStackHeaderItemCustom = { * if the items don't fit the available space, they will be collapsed into a menu automatically. * Items with `type: 'custom'` will not be included in this automatic collapsing behavior. */ @@ -53,7 +61,7 @@ index 218c4291fdb57600a45d32fbcefe3707a520fe79..5fdbb2754755a27589ad1555eae892b5 route: Route; }; -export declare function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, }: Props): ScreenStackHeaderConfigProps; -+export declare function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, unstable_headerCenterItems: headerCenterItems, unstable_headerToolbarItems: headerToolbarItems, unstable_navigationItemStyle: navigationItemStyle, }: Props): ScreenStackHeaderConfigProps; ++export declare function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, unstable_headerCenterItems: headerCenterItems, unstable_headerToolbarItems: headerToolbarItems, unstable_headerSubtitle: headerSubtitle, unstable_navigationItemStyle: navigationItemStyle, }: Props): ScreenStackHeaderConfigProps; export {}; //# sourceMappingURL=useHeaderConfigProps.d.ts.map diff --git a/build/react-navigation/native-stack/views/useHeaderConfigProps.js b/build/react-navigation/native-stack/views/useHeaderConfigProps.js @@ -75,27 +83,32 @@ index 2de6d160cedffb4ffb124adf7cd10979ec6ee778..9d839442e00e136204630663f207a45c }; }; -function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled = headerLargeTitleDeprecated, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, }) { -+function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled = headerLargeTitleDeprecated, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, unstable_headerCenterItems: headerCenterItems, unstable_headerToolbarItems: headerToolbarItems, unstable_navigationItemStyle: navigationItemStyle, }) { ++function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled = headerLargeTitleDeprecated, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, unstable_headerCenterItems: headerCenterItems, unstable_headerToolbarItems: headerToolbarItems, unstable_headerSubtitle: headerSubtitle, unstable_navigationItemStyle: navigationItemStyle, }) { const { direction } = (0, native_1.useLocale)(); const { colors, fonts, dark } = (0, native_1.useTheme)(); const tintColor = headerTintColor ?? (react_native_1.Platform.OS === 'ios' ? colors.primary : colors.text); -@@ -216,6 +219,10 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac +@@ -216,6 +219,14 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac tintColor, canGoBack, }); + const centerItems = headerCenterItems?.({ + tintColor, + canGoBack, ++ }); ++ const toolbarItems = headerToolbarItems?.({ ++ tintColor, ++ canGoBack, + }); if (rightItems) { // iOS renders right items in reverse order // So we need to reverse them here to match the order -@@ -270,6 +277,9 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac +@@ -270,6 +281,10 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac children, headerLeftBarButtonItems: processBarButtonItems(leftItems, colors, fonts), headerRightBarButtonItems: processBarButtonItems(rightItems, colors, fonts), ++ subtitle: headerSubtitle, + headerCenterBarButtonItems: processBarButtonItems(centerItems, colors, fonts), -+ headerToolbarItems, ++ headerToolbarItems: toolbarItems, + navigationItemStyle, experimental_userInterfaceStyle: dark ? 'dark' : 'light', }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 80d36c1cf9..1b3a615d05 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,15 +66,33 @@ overrides: packageExtensionsChecksum: sha256-FV3+2NW/9MFbunJaPsMxvO0LAzyfccoPtPiKoIXAwUU= patchedDependencies: - '@effect/vitest@4.0.0-beta.78': 42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f - '@expo/metro-config@56.0.14': 8cb08b5bb7051ed9d2dbe46a2c293c5a1e17f1bd6ddf30de27909e18c921ff46 - '@ff-labs/fff-node@0.9.4': 2b16019ce7ab61aec6478dd02f79ef468cc1d5c51e9d00764f7d2ab8167210c8 - '@pierre/diffs@1.3.0-beta.5': 7cb6da88544119adda056b2f46f43956f99326227732da0b345081e285a6c53a - effect@4.0.0-beta.78: c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5 - expo-modules-jsi@56.0.10: 9170f8074ae4e35a0a086e756c8f815794fd3abe51eac67ca3ba02804225ec1f - expo-router@56.2.11: d63025d5ca8999d61e090361acb374aebe9917ae1da7c4d65c2cc44977bd844c - react-native-nitro-modules@0.35.9: 825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675 - react-native-screens@4.25.2: 9a555061147ecd74107ca21a77697a0515cd6a9359abbe4baf8b44295565e61b + '@effect/vitest@4.0.0-beta.78': + hash: 42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f + path: patches/@effect__vitest@4.0.0-beta.78.patch + '@expo/metro-config@56.0.14': + hash: 8cb08b5bb7051ed9d2dbe46a2c293c5a1e17f1bd6ddf30de27909e18c921ff46 + path: patches/@expo%2Fmetro-config@56.0.14.patch + '@ff-labs/fff-node@0.9.4': + hash: 2b16019ce7ab61aec6478dd02f79ef468cc1d5c51e9d00764f7d2ab8167210c8 + path: patches/@ff-labs__fff-node@0.9.4.patch + '@pierre/diffs@1.3.0-beta.5': + hash: 7cb6da88544119adda056b2f46f43956f99326227732da0b345081e285a6c53a + path: patches/@pierre%2Fdiffs@1.3.0-beta.5.patch + effect@4.0.0-beta.78: + hash: c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5 + path: patches/effect@4.0.0-beta.78.patch + expo-modules-jsi@56.0.10: + hash: 9170f8074ae4e35a0a086e756c8f815794fd3abe51eac67ca3ba02804225ec1f + path: patches/expo-modules-jsi@56.0.10.patch + expo-router@56.2.11: + hash: 3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8 + path: patches/expo-router@56.2.11.patch + react-native-nitro-modules@0.35.9: + hash: 825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675 + path: patches/react-native-nitro-modules@0.35.9.patch + react-native-screens@4.25.2: + hash: 9a555061147ecd74107ca21a77697a0515cd6a9359abbe4baf8b44295565e61b + path: patches/react-native-screens@4.25.2.patch importers: @@ -309,7 +327,7 @@ importers: version: 0.1.15(expo@56.0.12)(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) expo-router: specifier: ~56.2.11 - version: 56.2.11(patch_hash=d63025d5ca8999d61e090361acb374aebe9917ae1da7c4d65c2cc44977bd844c)(708fd680682731bfd53a5282341dd27a) + version: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(708fd680682731bfd53a5282341dd27a) expo-secure-store: specifier: ~56.0.4 version: 56.0.4(expo@56.0.12) @@ -12003,7 +12021,7 @@ snapshots: ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) zod: 3.25.76 optionalDependencies: - expo-router: 56.2.11(patch_hash=d63025d5ca8999d61e090361acb374aebe9917ae1da7c4d65c2cc44977bd844c)(708fd680682731bfd53a5282341dd27a) + expo-router: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(708fd680682731bfd53a5282341dd27a) react-native: 0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6) transitivePeerDependencies: - '@expo/dom-webview' @@ -12301,7 +12319,7 @@ snapshots: react: 19.2.3 optionalDependencies: '@expo/metro-runtime': 56.0.15(@expo/log-box@56.0.13)(expo@56.0.12)(react-dom@19.2.3(react@19.2.3))(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) - expo-router: 56.2.11(patch_hash=d63025d5ca8999d61e090361acb374aebe9917ae1da7c4d65c2cc44977bd844c)(708fd680682731bfd53a5282341dd27a) + expo-router: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(708fd680682731bfd53a5282341dd27a) react-dom: 19.2.3(react@19.2.3) transitivePeerDependencies: - supports-color @@ -16217,7 +16235,7 @@ snapshots: react: 19.2.3 react-native: 0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6) - expo-router@56.2.11(patch_hash=d63025d5ca8999d61e090361acb374aebe9917ae1da7c4d65c2cc44977bd844c)(708fd680682731bfd53a5282341dd27a): + expo-router@56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(708fd680682731bfd53a5282341dd27a): dependencies: '@expo/log-box': 56.0.13(@expo/dom-webview@56.0.5)(expo@56.0.12)(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) '@expo/metro-runtime': 56.0.15(@expo/log-box@56.0.13)(expo@56.0.12)(react-dom@19.2.3(react@19.2.3))(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3)