The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): disabled iOS header controls now show as disabled (#24088)
Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
Victor Vogel committed
Oct 30, 2026 at 21:13 UTC
59bb4e83bcf753e6ebb99b63b5232f5f41251c8a
3 files changed
+79
apps/mobile/src/native/V5StackHeader.ios.test.tsx
new
+76
@@ -0,0 +1,76 @@
1
+import type { NativeStackHeaderItem } from "@react-navigation/native-stack";
2
+import { act } from "react";
3
+import { createRoot } from "react-dom/client";
4
+import type { StackHeaderConfigProps } from "react-native-screens";
5
+import { expect, it, vi } from "vite-plus/test";
6
+
7
+const bridge = vi.hoisted(() => ({ ios: undefined as StackHeaderConfigProps["ios"] }));
8
+
9
+vi.mock("react-native", () => ({ StyleSheet: { flatten: (style: unknown) => style } }));
10
+vi.mock("react-native-keyboard-controller", () => ({
11
+ KeyboardController: { dismiss: vi.fn() },
12
+ useKeyboardState: () => false,
13
+}));
14
+vi.mock("../lib/useMobileNavigationTheme", () => ({
15
+ useMobileNavigationTheme: () => ({ colors: { card: "white" } }),
16
+}));
17
+vi.mock("./native-layout-metrics", () => ({
18
+ useDeviceType: () => "phone",
19
+ useNativeLayoutMetrics: () => null,
20
+}));
21
+vi.mock("react-native-screens", () => ({
22
+ Stack: {
23
+ HeaderConfig: ({ ios }: StackHeaderConfigProps) => {
24
+ bridge.ios = ios;
25
+ return null;
26
+ },
27
+ },
28
+}));
29
+
30
+import { V5StackHeader } from "./V5StackHeader.ios";
31
+
32
+it.each(["leadingItems", "trailingItems", "toolbarItems"] as const)(
33
+ "updates native enabled state after permissions change in %s",
34
+ (placement) => {
35
+ bridge.ios = undefined;
36
+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
37
+ const root = createRoot(document.createElement("div"));
38
+ const onPress = () => {};
39
+ try {
40
+ for (const disabled of [true, false, undefined, true]) {
41
+ const items: NativeStackHeaderItem[] = [
42
+ { type: "button", label: "Files", disabled, onPress },
43
+ {
44
+ type: "menu",
45
+ label: "Terminal",
46
+ disabled,
47
+ menu: { items: [{ type: "action", label: "Open terminal", onPress }] },
48
+ },
49
+ ];
50
+ act(() =>
51
+ root.render(
52
+ <V5StackHeader
53
+ canGoBack={false}
54
+ options={{
55
+ unstable_headerLeftItems: () => (placement === "leadingItems" ? items : []),
56
+ unstable_headerRightItems: () => (placement === "trailingItems" ? items : []),
57
+ unstable_headerToolbarItems: () => (placement === "toolbarItems" ? items : []),
58
+ }}
59
+ />,
60
+ ),
61
+ );
62
+ const nativeItems = (bridge.ios as StackHeaderConfigProps["ios"])?.[placement];
63
+ expect(nativeItems).toHaveLength(2);
64
+ for (const item of nativeItems ?? []) {
65
+ if (item.type !== "item" || "render" in item)
66
+ throw new Error("Expected a native bar item");
67
+ // RNSHeaderContentFactory sets UIBarButtonItem.enabled to !item.disabled.
68
+ expect(!item.disabled).toBe(!disabled);
69
+ }
70
+ }
71
+ } finally {
72
+ act(() => root.unmount());
73
+ vi.unstubAllGlobals();
74
+ }
75
+ },
76
+);
apps/mobile/src/native/V5StackHeader.ios.tsx
+2
@@ -124,6 +124,7 @@ function convertItems(items: NativeStackHeaderItem[], prefix: string): HeaderIte
124
axisBehavior: item.axisBehavior,
125
icon: convertIcon(item.icon),
126
menu: item.disabled ? undefined : convertMenu(item.menu, `${id}:menu`),
127
+ disabled: item.disabled,
128
variant: item.variant,
129
tintColor: item.tintColor,
130
hidesSharedBackground: item.hidesSharedBackground,
@@ -137,6 +138,7 @@ function convertItems(items: NativeStackHeaderItem[], prefix: string): HeaderIte
138
axisBehavior: item.axisBehavior,
139
icon: convertIcon(item.icon),
140
onPress: item.disabled ? undefined : item.onPress,
141
+ disabled: item.disabled,
142
visibilityPriority:
143
item.visibilityPriority === "default" ? "standard" : item.visibilityPriority,
144
variant: item.variant,
apps/mobile/vite.config.ts
+1
@@ -27,6 +27,7 @@ const reactTests = [
27
"src/features/threads/UsageLimitRecoveryCard.test.tsx",
28
"src/features/threads/NewTaskDraftRouteScreen.test.tsx",
29
"src/native/NativeHeaderToolbar.test.tsx",
30
+ "src/native/V5StackHeader.ios.test.tsx",
31
"src/native/useRestingTopOffset.test.tsx",
32
"src/native/useRetryingImageSource.test.tsx",
33
"src/state/queries.debounce.test.tsx",