@devries-cameron20 / t3code-1 / commits / 95ffbc9028
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

revert(mobile): take the folded Duo search tab back out for now (#24626)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 24, 2026 at 17:34 UTC 95ffbc90287f5b1a3bd6ca2e78fabfe1da7af809
5 files changed +30 -78
apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx
+1 -46
@@ -5,12 +5,7 @@ import {
5 } from "./navigation-tabs";
6 import { useCallback, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from "react";
7 import { View, useWindowDimensions, type NativeSyntheticEvent } from "react-native";
8 -import {
9 - Tabs,
10 - type TabSelectedEvent,
11 - type TabSelectionPreventedEvent,
12 - type TabSelectionRejectedEvent,
13 -} from "react-native-screens";
8 +import { Tabs, type TabSelectedEvent, type TabSelectionRejectedEvent } from "react-native-screens";
9
10 import { WorkspaceTabsContext, useWorkspaceTabs } from "./WorkspaceTabsContext";
11 import {
@@ -31,7 +26,6 @@ import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
26 import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
27
28 const PULL_REQUEST_ICON = require("../../../assets/icons/pull-request.png");
34 -const SEARCH_SLOT = "search";
29
30 /** Retain each native controller tree; removing its root can leave RNS's stack empty. */
31 function RetainedWorkspaceTab(props: {
@@ -99,17 +93,6 @@ export function WorkspaceNativeTabs(props: {
93 const { colors } = useControlTheme();
94 const selectedTab = workspace.state.selectedTab;
95 const selectedSlot = workspace.settingsOpen ? -1 : primaryTabs.indexOf(selectedTab);
102 - // The folded Duo opens list search from a search tab UIKit sets apart below the others.
103 - const searchTab = deviceType === "duo-folded";
104 - // Searching is list state: the list's toolbar mounts its field and focuses it.
105 - const openSearch = () => {
106 - const tab =
107 - !workspace.settingsOpen && workspaceUsesColumns(selectedTab) ? selectedTab : "threads";
108 - // Back on the tab's list first: folded, a chat open on top would hide the field.
109 - selectTab(tab);
110 - workspace.dispatch({ type: "scroll", tab, offset: workspace.getScrollOffset(tab) });
111 - workspace.dispatch({ type: "search", tab });
112 - };
96 const request = useMemo(
97 () => ({
98 selectedScreenKey:
@@ -133,19 +116,9 @@ export function WorkspaceNativeTabs(props: {
116 }: NativeSyntheticEvent<TabSelectionRejectedEvent>) =>
117 setProvenance(nativeEvent.provenance)
118 }
136 - onTabSelectionPrevented={({
137 - nativeEvent,
138 - }: NativeSyntheticEvent<TabSelectionPreventedEvent>) => {
139 - if (nativeEvent.preventedScreenKey === SEARCH_SLOT) openSearch();
140 - }}
119 onTabSelected={({ nativeEvent }: NativeSyntheticEvent<TabSelectedEvent>) => {
120 setProvenance(nativeEvent.provenance);
121 if (nativeEvent.actionOrigin === "programmatic-js") return;
144 - // UIKit reports reselecting a tab here even when its selection is prevented.
145 - if (nativeEvent.selectedScreenKey === SEARCH_SLOT) {
146 - openSearch();
147 - return;
148 - }
122 const tab = workspaceTabForNativeSlot(primaryTabs, nativeEvent.selectedScreenKey);
123 if (tab) selectTab(tab);
124 }}
@@ -183,24 +156,6 @@ export function WorkspaceNativeTabs(props: {
156 </Tabs.Screen>
157 );
158 })}
186 - {searchTab ? (
187 - // It never becomes the selected tab; pressing it opens the current list's search.
188 - <Tabs.Screen
189 - key={SEARCH_SLOT}
190 - screenKey={SEARCH_SLOT}
191 - title=""
192 - tabBarItemAccessibilityLabel="Search"
193 - preventNativeSelection
194 - ios={{
195 - role: "search",
196 - systemItem: "search",
197 - // iOS 27 only sets the search tab apart while it activates search.
198 - automaticallyActivatesSearch: true,
199 - }}
200 - >
201 - <View />
202 - </Tabs.Screen>
203 - ) : null}
159 </Tabs.Host>
160 {(deviceType === "pad" ||
161 compactTabs ||
apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+20 -4
@@ -121,19 +121,32 @@ export function WorkspaceToolbar(props: {
121 separateBackground
122 />
123 ) : null;
124 + const searchButton = foldedSearch ? (
125 + <Toolbar.Button
126 + identifier="workspace-search"
127 + accessibilityLabel={
128 + searchVisible
129 + ? "Close search"
130 + : selectedTab === "pullRequests"
131 + ? "Search pull requests"
132 + : "Search threads"
133 + }
134 + icon={searchVisible ? "xmark" : "magnifyingglass"}
135 + onPress={searchVisible ? () => searchRef.current?.cancelSearch() : focusSearch}
136 + separateBackground
137 + />
138 + ) : null;
139 return (
140 <>
141 <NativeStackScreenOptions
127 - optionsVersion={[selectedTab, tab.searchMode, tab.searchFocusRequest]}
142 + optionsVersion={[selectedTab, tab.searchMode]}
143 listeners={{ transitionEnd: restoreSearch }}
144 options={{
130 - // Each search request focuses the field once it exists, after it mounts if need be.
131 - unstable_headerSearchFocusRequest:
132 - tab.searchMode === "active" ? tab.searchFocusRequest : undefined,
145 headerSearchBarOptions:
146 (NATIVE_LIQUID_GLASS_SUPPORTED || tab.searchMode !== "resting") && searchVisible
147 ? {
148 ref: searchRef,
149 + autoFocus: tab.searchMode === "active",
150 autoCapitalize: "none",
151 hideNavigationBar: false,
152 hideWhenScrolling: false,
@@ -149,6 +162,7 @@ export function WorkspaceToolbar(props: {
162 sidebarTabs !== "picker",
163 placeholder:
164 selectedTab === "pullRequests" ? "Search pull requests" : "Search threads",
165 + cancelButtonHidden: foldedSearch,
166 onFocus: searchFocused,
167 onBlur: () => workspace.dispatch({ type: "expand", tab: selectedTab }),
168 onSearchButtonPress: () => searchRef.current?.blur(),
@@ -165,6 +179,8 @@ export function WorkspaceToolbar(props: {
179 />
180 {/* UIKit lays trailing items out from the edge inward. */}
181 <Toolbar placement="right">
182 + {searchButton}
183 + {nativeToolbarCompose && foldedSearch ? <Toolbar.Spacer width={8} /> : null}
184 {composeButton}
185 {selectedTab !== "threads" ||
186 isDuoDevice(deviceType) ||
apps/mobile/src/features/workspace/workspace-tabs-state.ts
+1 -10
@@ -24,8 +24,6 @@ export interface WorkspaceTabState {
24 readonly searchMode: WorkspaceSearchMode;
25 readonly scrollOffset: number;
26 readonly searchEntryOffset: number;
27 - /** Counts requests to focus the search field; the header focuses once per request. */
28 - readonly searchFocusRequest: number;
27 }
28
29 export interface WorkspaceTabsState {
@@ -35,13 +33,7 @@ export interface WorkspaceTabsState {
33 }
34
35 function emptyTab(): WorkspaceTabState {
38 - return {
39 - query: "",
40 - searchMode: "resting",
41 - scrollOffset: 0,
42 - searchEntryOffset: 0,
43 - searchFocusRequest: 0,
44 - };
36 + return { query: "", searchMode: "resting", scrollOffset: 0, searchEntryOffset: 0 };
37 }
38
39 export function initialWorkspaceTabsState(): WorkspaceTabsState {
@@ -87,7 +79,6 @@ export function workspaceTabsReducer(
79 searchMode: "active",
80 searchEntryOffset:
81 current.searchMode === "resting" ? current.scrollOffset : current.searchEntryOffset,
90 - searchFocusRequest: current.searchFocusRequest + 1,
82 };
83 break;
84 case "query":
apps/mobile/src/native/StackHeader.tsx
-2
@@ -34,8 +34,6 @@ export type AppNativeStackNavigationOptions = Omit<
34 readonly unstable_headerToolbarItems?: unknown;
35 readonly unstable_navigationItemStyle?: unknown;
36 readonly unstable_headerMinimizationBehavior?: unknown;
37 - /** Focuses the header search field once for each new value, as soon as the field exists. */
38 - readonly unstable_headerSearchFocusRequest?: number;
37 };
38
39 function useNativeStackNavigation(): NativeStackNavigationProp<ParamListBase> | null {
apps/mobile/src/native/V5StackHeader.ios.tsx
+8 -16
@@ -3,7 +3,7 @@ import type {
3 NativeStackHeaderItemMenu,
4 NativeStackNavigationOptions,
5 } from "@react-navigation/native-stack";
6 -import { isValidElement, useEffect, useRef, type RefObject } from "react";
6 +import { isValidElement, useEffect, useRef } from "react";
7 import { StyleSheet } from "react-native";
8 import { isDuoDevice } from "../lib/device-type";
9 import { useMobileNavigationTheme } from "../lib/useMobileNavigationTheme";
@@ -29,7 +29,6 @@ type ToolbarItem =
29 type Options = NativeStackNavigationOptions & {
30 readonly unstable_navigationItemStyle?: "editor" | "navigator";
31 readonly unstable_headerMinimizationBehavior?: StackHeaderMinimizationBehaviorIOS;
32 - readonly unstable_headerSearchFocusRequest?: number;
32 readonly headerSubtitle?: string;
33 readonly unstable_headerSubtitle?: string;
34 readonly headerSubtitleStyle?: { color?: string; fontSize?: number; fontFamily?: string };
@@ -244,18 +243,12 @@ export function V5StackHeader(props: {
243 ? options.headerTitle({ children: title ?? "", tintColor: options.headerTintColor })
244 : undefined;
245 const searchOptions = options.headerSearchBarOptions;
247 - const searchBarRef = searchOptions?.ref ?? searchRef;
248 - const focusRequest = options.unstable_headerSearchFocusRequest;
249 - const focusedRequest = useRef<number | undefined>(undefined);
250 - // The field can attach a render after the request, since it mounts through these options, and
251 - // Screens re-attaches its commands on every render; so focus once per request, on attach.
252 - const attachSearchBar = (instance: SearchBarCommands | null) => {
253 - searchBarRef.current = instance;
254 - if (instance && focusRequest !== undefined && focusedRequest.current !== focusRequest) {
255 - focusedRequest.current = focusRequest;
256 - instance.focus();
257 - }
258 - };
246 + const autofocusRef = searchOptions?.ref ?? searchRef;
247 + useEffect(() => {
248 + if (!searchOptions?.autoFocus) return;
249 + const frame = requestAnimationFrame(() => autofocusRef.current?.focus());
250 + return () => cancelAnimationFrame(frame);
251 + }, [searchOptions?.autoFocus, autofocusRef]);
252 const titleStyle = StyleSheet.flatten(options.headerTitleStyle);
253 const headerStyle = StyleSheet.flatten(options.headerStyle);
254 const appearance = {
@@ -295,8 +288,7 @@ export function V5StackHeader(props: {
288 mailSearch || searchOptions ? (
289 <SearchBar
290 {...searchOptions}
298 - // React accepts callback refs here; Screens only types the object form.
299 - ref={attachSearchBar as unknown as RefObject<SearchBarCommands | null>}
291 + ref={searchOptions?.ref ?? searchRef}
292 hideNavigationBar={false}
293 hideWhenScrolling={false}
294 allowToolbarIntegration={searchOptions?.allowToolbarIntegration ?? true}