The best way to control Claude Code, Codex and more from any computer or phone
fix(android): foldable sidebar and layout fixes (#21071)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 17, 2026 at 20:52 UTC
6a6ebb278dc70dd859439a3c28960a7d23a1e645
22 files changed
+297
-259
apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3WorkspaceNavigationModule.kt
+24
-59
@@ -3,16 +3,12 @@ package expo.modules.t3nativecontrols
3
import android.content.Context
4
import android.view.ViewGroup
5
import androidx.compose.foundation.layout.WindowInsets
6
-import androidx.compose.foundation.layout.Spacer
6
import androidx.compose.foundation.layout.fillMaxSize
7
import androidx.compose.material3.Icon
8
import androidx.compose.material3.MaterialTheme
9
import androidx.compose.material3.NavigationBar
10
import androidx.compose.material3.NavigationBarItem
11
import androidx.compose.material3.NavigationBarItemDefaults
13
-import androidx.compose.material3.NavigationRail
14
-import androidx.compose.material3.NavigationRailItem
15
-import androidx.compose.material3.NavigationRailItemDefaults
12
import androidx.compose.material3.Text
13
import androidx.compose.material3.darkColorScheme
14
import androidx.compose.material3.lightColorScheme
@@ -39,7 +35,6 @@ class T3WorkspaceNavigationModule : Module() {
35
Prop("selectedTab") { view: T3WorkspaceNavigationView, value: String ->
36
view.selectedTab = value
37
}
42
- Prop("rail") { view: T3WorkspaceNavigationView, value: Boolean -> view.rail = value }
38
Prop("dark") { view: T3WorkspaceNavigationView, value: Boolean -> view.dark = value }
39
Prop("textScale") { view: T3WorkspaceNavigationView, value: Float -> view.textScale = value }
40
Prop("containerColor") { view: T3WorkspaceNavigationView, value: Int ->
@@ -59,7 +54,7 @@ class T3WorkspaceNavigationModule : Module() {
54
}
55
}
56
62
-/** One Material3 selection surface moves from below the list to its leading edge. */
57
+/** Material3 bottom navigation for the compact workspace. */
58
class T3WorkspaceNavigationView(
59
context: Context,
60
appContext: AppContext
@@ -69,7 +64,6 @@ class T3WorkspaceNavigationView(
64
65
private val onTabSelected by EventDispatcher()
66
var selectedTab by mutableStateOf("threads")
72
- var rail by mutableStateOf(false)
67
var dark by mutableStateOf(false)
68
var textScale by mutableStateOf(1f)
69
var containerColor by mutableStateOf(0)
@@ -108,58 +102,29 @@ class T3WorkspaceNavigationView(
102
setContent {
103
MaterialTheme(colorScheme = if (dark) darkColorScheme() else lightColorScheme()) {
104
val tabs = listOf("threads", "pullRequests")
111
- if (rail) {
112
- NavigationRail(
113
- modifier = Modifier.fillMaxSize(),
114
- containerColor = Color(containerColor),
115
- windowInsets = WindowInsets(0),
116
- ) {
117
- Spacer(Modifier.weight(1f))
118
- tabs.forEach { tab ->
119
- NavigationRailItem(
120
- selected = selectedTab == tab,
121
- onClick = { onTabSelected(mapOf("tab" to tab)) },
122
- icon = { tabIcon(tab) },
123
- label = {
124
- val title = if (tab == "threads") "Chats" else "PRs"
125
- Text(title, fontSize = (12 * textScale).sp)
126
- },
127
- colors = NavigationRailItemDefaults.colors(
128
- selectedIconColor = Color(selectedColor),
129
- selectedTextColor = Color(selectedColor),
130
- indicatorColor = Color(indicatorColor),
131
- unselectedIconColor = Color(unselectedColor),
132
- unselectedTextColor = Color(unselectedColor),
133
- ),
134
- )
135
- }
136
- Spacer(Modifier.weight(1f))
137
- }
138
- } else {
139
- NavigationBar(
140
- modifier = Modifier.fillMaxSize(),
141
- containerColor = Color(containerColor),
142
- tonalElevation = androidx.compose.ui.unit.Dp(0f),
143
- windowInsets = WindowInsets(0),
144
- ) {
145
- tabs.forEach { tab ->
146
- NavigationBarItem(
147
- selected = selectedTab == tab,
148
- onClick = { onTabSelected(mapOf("tab" to tab)) },
149
- icon = { tabIcon(tab) },
150
- label = {
151
- val title = if (tab == "threads") "Chats" else "Pull requests"
152
- Text(title, fontSize = (12 * textScale).sp)
153
- },
154
- colors = NavigationBarItemDefaults.colors(
155
- selectedIconColor = Color(selectedColor),
156
- selectedTextColor = Color(selectedColor),
157
- indicatorColor = Color(indicatorColor),
158
- unselectedIconColor = Color(unselectedColor),
159
- unselectedTextColor = Color(unselectedColor),
160
- ),
161
- )
162
- }
105
+ NavigationBar(
106
+ modifier = Modifier.fillMaxSize(),
107
+ containerColor = Color(containerColor),
108
+ tonalElevation = androidx.compose.ui.unit.Dp(0f),
109
+ windowInsets = WindowInsets(0),
110
+ ) {
111
+ tabs.forEach { tab ->
112
+ NavigationBarItem(
113
+ selected = selectedTab == tab,
114
+ onClick = { onTabSelected(mapOf("tab" to tab)) },
115
+ icon = { tabIcon(tab) },
116
+ label = {
117
+ val title = if (tab == "threads") "Chats" else "Pull requests"
118
+ Text(title, fontSize = (12 * textScale).sp)
119
+ },
120
+ colors = NavigationBarItemDefaults.colors(
121
+ selectedIconColor = Color(selectedColor),
122
+ selectedTextColor = Color(selectedColor),
123
+ indicatorColor = Color(indicatorColor),
124
+ unselectedIconColor = Color(unselectedColor),
125
+ unselectedTextColor = Color(unselectedColor),
126
+ ),
127
+ )
128
}
129
}
130
}
apps/mobile/src/Stack.tsx
+6
-3
@@ -30,6 +30,7 @@ import {
30
import { useResolveClassNames } from "uniwind";
31
32
import { AppText as Text } from "./components/ui/AppText";
33
+import { androidWorkspaceDestinationAnimation } from "./lib/android-workspace-navigation";
34
import { getCompactBrandHeaderOptions } from "./components/CompactBrandTitle";
35
import { WorkspaceRootScreen } from "./features/workspace/WorkspaceRootScreen";
36
import { AndroidWorkspaceTabsProvider } from "./features/workspace/AndroidWorkspaceTabsProvider";
@@ -1009,15 +1010,17 @@ function ScreenRenderFallback(props: RenderFailureProps & { readonly routeName:
1010
export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navigator }) {
1011
const { width, height } = useWindowDimensions();
1012
const nativeMetrics = useNativeLayoutMetrics();
1012
- const usesWorkspaceFlowScreens =
1013
- Platform.OS === "android" || deriveLayout({ width, height, nativeMetrics }).usesSplitView;
1013
+ const usesSplitView = deriveLayout({ width, height, nativeMetrics }).usesSplitView;
1014
+ const usesWorkspaceFlowScreens = Platform.OS === "android" || usesSplitView;
1015
1016
return (
1017
<Navigator
1018
screenLayout={(props) => <GuardedScreenLayout {...props} />}
1019
screenOptions={({ route }) => {
1020
if (route.name !== "SettingsSheet" && route.name !== "NewTaskSheet") {
1020
- return {};
1021
+ return Platform.OS === "android"
1022
+ ? { animation: androidWorkspaceDestinationAnimation(route.name, usesSplitView) }
1023
+ : {};
1024
}
1025
1026
return usesWorkspaceFlowScreens
apps/mobile/src/components/CompactBrandTitle.tsx
+48
-17
@@ -1,6 +1,7 @@
1
import { NATIVE_WORKSPACE_COLUMNS_SUPPORTED } from "../native/NativeWorkspaceColumns";
2
import Constants from "expo-constants";
3
import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
4
+import { useState } from "react";
5
import { Platform, View } from "react-native";
6
7
import { AppText as Text } from "./ui/AppText";
@@ -18,20 +19,37 @@ export function CompactBrandTitle(
19
props: {
20
readonly allowFontScaling?: boolean;
21
readonly accessibilityLabel?: string;
22
+ /**
23
+ * Fills the parent row and drops the stage badge when the full title does not fit.
24
+ * Narrow Android sidebar headers otherwise draw their actions over the badge.
25
+ */
26
+ readonly fit?: boolean;
27
} = {},
28
) {
29
const stageLabel = resolveMobileStageLabel(Constants.expoConfig?.extra?.appVariant);
30
const titleOffset = brandTitleOffset();
31
const { scale } = useAndroidControlSizing();
32
+ const [availableWidth, setAvailableWidth] = useState<number | null>(null);
33
+ // Measured only while the badge shows, so hiding it does not make it look like it fits.
34
+ const [fullWidth, setFullWidth] = useState<number | null>(null);
35
+ const showStage =
36
+ !props.fit || availableWidth === null || fullWidth === null || fullWidth <= availableWidth;
37
27
- return (
38
+ const title = (
39
<View
40
+ onLayout={
41
+ props.fit && showStage ? (event) => setFullWidth(event.nativeEvent.layout.width) : undefined
42
+ }
43
aria-level={1}
44
accessibilityLabel={props.accessibilityLabel ?? "T3 Code, Threads"}
45
accessible
46
role="heading"
47
className="flex-row items-center gap-1.5"
34
- style={[{ marginLeft: titleOffset }, Platform.OS === "android" && { gap: 5.25 * scale }]}
48
+ style={[
49
+ { marginLeft: titleOffset },
50
+ Platform.OS === "android" && { gap: 5.25 * scale },
51
+ props.fit && { flexShrink: 0 },
52
+ ]}
53
>
54
<T3Wordmark colorClassName="accent-icon" height={Math.round(15 * scale)} />
55
<Text
@@ -41,23 +59,36 @@ export function CompactBrandTitle(
59
>
60
Code
61
</Text>
44
- <View
45
- className="rounded-full bg-subtle px-1.5 py-0.5"
46
- style={
47
- Platform.OS === "android"
48
- ? { paddingHorizontal: 5.25 * scale, paddingVertical: 1.75 * scale }
49
- : undefined
50
- }
51
- >
52
- <Text
53
- allowFontScaling={props.allowFontScaling}
54
- className="font-t3-bold text-foreground-muted uppercase"
55
- style={{ fontSize: 9 * scale, letterSpacing: 0.9 * scale }}
62
+ {showStage ? (
63
+ <View
64
+ className="rounded-full bg-subtle px-1.5 py-0.5"
65
+ style={
66
+ Platform.OS === "android"
67
+ ? { paddingHorizontal: 5.25 * scale, paddingVertical: 1.75 * scale }
68
+ : undefined
69
+ }
70
>
57
- {stageLabel}
58
- </Text>
59
- </View>
71
+ <Text
72
+ allowFontScaling={props.allowFontScaling}
73
+ className="font-t3-bold text-foreground-muted uppercase"
74
+ style={{ fontSize: 9 * scale, letterSpacing: 0.9 * scale }}
75
+ >
76
+ {stageLabel}
77
+ </Text>
78
+ </View>
79
+ ) : null}
80
+ </View>
81
+ );
82
+
83
+ return props.fit ? (
84
+ <View
85
+ className="min-w-0 flex-1 flex-row items-center"
86
+ onLayout={(event) => setAvailableWidth(event.nativeEvent.layout.width)}
87
+ >
88
+ {title}
89
</View>
90
+ ) : (
91
+ title
92
);
93
}
94
apps/mobile/src/components/ui/NativeSwitch.android.tsx
+11
-12
@@ -1,35 +1,34 @@
1
import { NativeThemeHost } from "./NativeThemeHost.android";
2
import { Switch as ComposeSwitch } from "@expo/ui/jetpack-compose";
3
-import { View } from "react-native";
3
+import { Pressable, View } from "react-native";
4
import type { ThemedSwitchProps } from "./NativeSwitch.types";
5
6
import { useControlTheme } from "./useControlTheme";
7
8
-/** Material's native switch, with the same palette and accessibility contract as our RN controls. */
8
+/**
9
+ * Material's native switch, with the same palette and accessibility contract as our RN controls.
10
+ * Compose only draws it. The RN Pressable owns the touch so it wins over a pressable parent row;
11
+ * with Compose handling touches, a tap on the switch ran the row's onPress instead.
12
+ */
13
export function NativeSwitch(props: ThemedSwitchProps) {
14
const { colors } = useControlTheme();
11
- const toggle = () => {
12
- if (!props.disabled) props.onValueChange?.(!props.value);
13
- };
15
16
return (
16
- <View
17
- accessible
17
+ <Pressable
18
+ disabled={props.disabled}
19
+ onPress={() => props.onValueChange?.(!props.value)}
20
accessibilityLabel={props.accessibilityLabel}
21
accessibilityHint={props.accessibilityHint}
22
accessibilityRole="switch"
23
accessibilityState={{ checked: Boolean(props.value), disabled: Boolean(props.disabled) }}
22
- accessibilityActions={[{ name: "activate", label: "Toggle" }]}
23
- onAccessibilityAction={toggle}
24
style={props.style}
25
testID={props.testID}
26
>
27
- <View importantForAccessibility="no-hide-descendants">
27
+ <View importantForAccessibility="no-hide-descendants" pointerEvents="none">
28
<NativeThemeHost ignoreSafeAreaKeyboardInsets style={{ width: 52, height: 48 }}>
29
<ComposeSwitch
30
value={Boolean(props.value)}
31
enabled={!props.disabled}
32
- onCheckedChange={props.onValueChange ?? undefined}
32
colors={{
33
checkedTrackColor: colors["--color-switch-active-track"],
34
checkedThumbColor: colors["--color-switch-active-thumb"],
@@ -41,6 +40,6 @@ export function NativeSwitch(props: ThemedSwitchProps) {
40
/>
41
</NativeThemeHost>
42
</View>
44
- </View>
43
+ </Pressable>
44
);
45
}
apps/mobile/src/features/home/HomeScreen.tsx
+20
-2
@@ -18,6 +18,7 @@ import { use, useCallback, useEffect, useMemo, useRef, useState, type ComponentP
18
import {
19
Platform,
20
ScrollView,
21
+ useWindowDimensions,
22
View,
23
type ScrollViewProps,
24
type GestureResponderEvent,
@@ -30,6 +31,10 @@ import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSw
31
import { useSafeAreaInsets } from "react-native-safe-area-context";
32
33
import { cn } from "../../lib/cn";
34
+import {
35
+ ANDROID_READING_MAX_WIDTH,
36
+ deriveCenteredContentHorizontalPadding,
37
+} from "../../lib/layout";
38
import { EmptyState } from "../../components/ui/EmptyState";
39
import { FloatingActionButton } from "../../components/ui/FloatingActionButton";
40
import type { WorkspaceEnvironment, WorkspaceState } from "../../state/workspaceModel";
@@ -264,6 +269,17 @@ export function HomeScreen(props: HomeScreenProps) {
269
const contentSideInsets = usesNativeWorkspaceColumns
270
? (columnMetrics ?? screenMetrics)?.safeArea
271
: undefined;
272
+ // Android lists that span a wide window (foldables in portrait) keep the
273
+ // reading width, so rows stay clear of the edges and the camera cutout.
274
+ const { width: windowWidth } = useWindowDimensions();
275
+ const androidListGutter =
276
+ Platform.OS === "android"
277
+ ? deriveCenteredContentHorizontalPadding({
278
+ viewportWidth: windowWidth,
279
+ maxContentWidth: ANDROID_READING_MAX_WIDTH,
280
+ minimumPadding: 0,
281
+ })
282
+ : 0;
283
const iosBottomClearance = Math.max(
284
columnMetrics?.safeArea.bottom ?? insets.bottom,
285
24,
@@ -1027,8 +1043,10 @@ export function HomeScreen(props: HomeScreenProps) {
1043
{...scrollGateHandlers}
1044
scrollEventThrottle={16}
1045
contentContainerStyle={{
1030
- paddingLeft: (contentSideInsets?.left ?? 0) + (primaryColumn ? 8 : 0),
1031
- paddingRight: (contentSideInsets?.right ?? 0) + (primaryColumn ? 8 : 0),
1046
+ paddingLeft:
1047
+ (contentSideInsets?.left ?? 0) + (primaryColumn ? 8 : 0) + androidListGutter,
1048
+ paddingRight:
1049
+ (contentSideInsets?.right ?? 0) + (primaryColumn ? 8 : 0) + androidListGutter,
1050
paddingBottom:
1051
Platform.OS === "ios"
1052
? iosBottomClearance
apps/mobile/src/features/home/ThreadListToolbar.tsx
+10
-1
@@ -1,6 +1,7 @@
1
import { useCallback, useEffect, useRef, useState, type ComponentProps } from "react";
2
import { useNavigation, useNavigationState } from "@react-navigation/native";
3
import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
4
+import { useWorkspaceListNavigation } from "../workspace/useAndroidWorkspaceNavigation";
5
import {
6
BackHandler,
7
Keyboard,
@@ -47,6 +48,7 @@ export function ThreadListToolbar(props: {
48
const { height: toolbarHeight, ...headerPadding } = useToolbarLayout();
49
const { state } = useWorkspaceState();
50
const { onRequestVisibility, onSearchQueryChange } = props;
51
+ const showPullRequests = useWorkspaceListNavigation("pullRequests");
52
const searchRef = useRef<TextInputInstance>(null);
53
const [searchOpen, setSearchOpen] = useState(false);
54
const searching = searchOpen || props.searchQuery.length > 0;
@@ -121,9 +123,16 @@ export function ThreadListToolbar(props: {
123
<WorkspaceConnectionTitle
124
grow
125
onPress={props.onOpenEnvironments}
124
- brand={<CompactBrandTitle allowFontScaling={false} />}
126
+ brand={<CompactBrandTitle allowFontScaling={false} fit />}
127
/>
128
</View>
129
+ {props.sidebar && workspace ? (
130
+ <AndroidHeaderIconButton
131
+ accessibilityLabel="Show pull requests"
132
+ icon="arrow.triangle.pull"
133
+ onPress={showPullRequests}
134
+ />
135
+ ) : null}
136
<AndroidHeaderIconButton
137
accessibilityLabel="Search threads"
138
icon="magnifyingglass"
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+13
-47
@@ -60,11 +60,6 @@ import {
60
useHardwareKeyboardCommand,
61
} from "../keyboard/hardwareKeyboardCommands";
62
import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
63
-import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
64
-import {
65
- AndroidWorkspaceNavigation,
66
- ANDROID_WORKSPACE_RAIL_WIDTH,
67
-} from "../workspace/AndroidWorkspaceNavigation";
63
import { AndroidWorkspaceSidebar } from "../workspace/AndroidWorkspaceSidebar";
64
import { useAndroidWorkspaceSelection } from "../workspace/useAndroidWorkspaceSelection";
65
import { HomeListOptionsProvider } from "../home/home-list-options";
@@ -241,7 +236,6 @@ function AdaptiveWorkspaceLayoutContent(
236
const windowDimensions = useWindowDimensions();
237
const nativeMetrics = useNativeLayoutMetrics();
238
const { width: viewportWidth, height } = nativeMetrics ?? windowDimensions;
244
- const { scale: androidControlScale } = useAndroidControlSizing();
239
const pathname = props.pathname;
240
const navigation = useNavigation();
241
const activeRoleOwner = useRef<symbol | null>(null);
@@ -267,11 +261,6 @@ function AdaptiveWorkspaceLayoutContent(
261
usesSplitView: baseLayout.usesSplitView,
262
});
263
const showPrimarySidebar = primarySidebarPinned || primarySidebarPreferredVisible;
270
- const shouldRenderNavigationRail = Platform.OS === "android" && baseLayout.usesSplitView;
271
- const navigationRailWidth =
272
- shouldRenderNavigationRail && showPrimarySidebar
273
- ? ANDROID_WORKSPACE_RAIL_WIDTH * Math.max(1, androidControlScale)
274
- : 0;
264
const [hinge, setHinge] = useState<VerticalHinge | null>(null);
265
const [windowHinge, setWindowHinge] = useState<VerticalHinge | null>(null);
266
const handleHingeChange = useCallback(
@@ -282,29 +271,28 @@ function AdaptiveWorkspaceLayoutContent(
271
[],
272
);
273
const layout = useMemo(
285
- () =>
286
- alignListPaneToHinge({
287
- layout: baseLayout,
288
- hinge,
289
- viewportWidth,
290
- leadingWidth: navigationRailWidth,
291
- }),
292
- [baseLayout, hinge, viewportWidth, navigationRailWidth],
274
+ () => alignListPaneToHinge({ layout: baseLayout, hinge, viewportWidth }),
275
+ [baseLayout, hinge, viewportWidth],
276
);
294
- const width = viewportWidth - navigationRailWidth;
277
const shouldRenderPrimarySidebar = layout.usesSplitView;
278
const fileInspector = useMemo(
279
() =>
280
deriveFileInspectorPaneLayout({
281
layout,
300
- viewportWidth: width,
282
+ viewportWidth,
283
preferredWidth: fileInspectorPreferredWidth ?? undefined,
284
reservedLeadingWidth:
285
shouldRenderPrimarySidebar && showPrimarySidebar
286
? (layout.listPaneWidth ?? 0) + (layout.listPaneGap ?? 0)
287
: 0,
288
}),
307
- [fileInspectorPreferredWidth, layout, showPrimarySidebar, shouldRenderPrimarySidebar, width],
289
+ [
290
+ fileInspectorPreferredWidth,
291
+ layout,
292
+ showPrimarySidebar,
293
+ shouldRenderPrimarySidebar,
294
+ viewportWidth,
295
+ ],
296
);
297
const auxiliaryPaneRole: WorkspaceAuxiliaryPaneRole =
298
focusedAuxiliaryPaneRole ?? (/\/files(?:\/|$)/.test(pathname) ? "inspector" : "supplementary");
@@ -320,7 +308,7 @@ function AdaptiveWorkspaceLayoutContent(
308
() =>
309
deriveWorkspacePaneLayout({
310
layout,
323
- viewportWidth: width,
311
+ viewportWidth,
312
primarySidebarPreferredVisible: showPrimarySidebar,
313
auxiliaryPanePreferredVisible,
314
auxiliaryPaneRole,
@@ -332,7 +320,7 @@ function AdaptiveWorkspaceLayoutContent(
320
auxiliaryPanePreferredWidth,
321
layout,
322
showPrimarySidebar,
335
- width,
323
+ viewportWidth,
324
],
325
);
326
const activeThread = parseActiveThreadPath(pathname);
@@ -582,7 +570,6 @@ function AdaptiveWorkspaceLayoutContent(
570
const renderedSidebarWidth = useSharedValue(
571
panes.primarySidebarVisible ? (layout.listPaneWidth ?? 0) + (layout.listPaneGap ?? 0) : 0,
572
);
585
- const renderedRailWidth = useSharedValue(navigationRailWidth);
573
useEffect(() => {
574
if (nativeWorkspace) return;
575
const targetWidth = panes.primarySidebarVisible
@@ -591,19 +578,15 @@ function AdaptiveWorkspaceLayoutContent(
578
renderedSidebarWidth.value = withTiming(targetWidth, WORKSPACE_PANE_TIMING, (finished) => {
579
if (finished && Platform.OS === "android") runOnJS(settleContentWidth)(contentRevision);
580
});
594
- renderedRailWidth.set(withTiming(navigationRailWidth, WORKSPACE_PANE_TIMING));
581
}, [
582
nativeWorkspace,
597
- navigationRailWidth,
583
layout.listPaneWidth,
584
layout.listPaneGap,
585
panes.primarySidebarVisible,
586
renderedSidebarWidth,
602
- renderedRailWidth,
587
settleContentWidth,
588
contentRevision,
589
]);
606
- const railAnimatedStyle = useAnimatedStyle(() => ({ width: renderedRailWidth.value }));
590
// Showing or hiding the sidebar clips a fixed-width list. A hinge resize instead tracks the
591
// animated edge, so the header actions slide with it rather than jumping or being covered.
592
const listPaneGap = layout.listPaneGap ?? 0;
@@ -624,13 +607,7 @@ function AdaptiveWorkspaceLayoutContent(
607
// merely clip/reveal it over a matching background.
608
const renderedInspectorWidth = useSharedValue(inspectorColumnTargetWidth);
609
const renderedContentWidth = useDerivedValue(() =>
627
- Math.max(
628
- 0,
629
- viewportWidth -
630
- renderedRailWidth.value -
631
- renderedSidebarWidth.value -
632
- renderedInspectorWidth.value,
633
- ),
610
+ Math.max(0, viewportWidth - renderedSidebarWidth.value - renderedInspectorWidth.value),
611
);
612
613
const selectAndroidWorkspace = useAndroidWorkspaceSelection();
@@ -745,17 +722,6 @@ function AdaptiveWorkspaceLayoutContent(
722
className={Platform.OS === "android" ? "flex-1 flex-row bg-header" : "flex-1 flex-row"}
723
>
724
<AndroidHingeObserver onChange={handleHingeChange} />
748
- {shouldRenderNavigationRail ? (
749
- <Animated.View
750
- className="self-stretch overflow-hidden"
751
- accessibilityElementsHidden={navigationRailWidth === 0}
752
- importantForAccessibility={navigationRailWidth > 0 ? "auto" : "no-hide-descendants"}
753
- pointerEvents={navigationRailWidth > 0 ? "auto" : "none"}
754
- style={railAnimatedStyle}
755
- >
756
- <AndroidWorkspaceNavigation rail onSelect={revealPrimarySidebar} />
757
- </Animated.View>
758
- ) : null}
725
{shouldRenderPrimarySidebar && layout.listPaneWidth !== null ? (
726
<Animated.View
727
className="self-stretch overflow-hidden"
apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx
+16
-1
@@ -10,15 +10,20 @@ import { SearchField } from "../../components/ui/SearchField";
10
import { WorkspaceConnectionTitle } from "../home/WorkspaceConnectionTitle";
11
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
12
import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
13
+import { useWorkspaceListNavigation } from "../workspace/useAndroidWorkspaceNavigation";
14
15
/** PR search shares the thread list's native Android header placement. */
15
-export function PullRequestToolbar(props: { readonly onRequestVisibility?: () => void }) {
16
+export function PullRequestToolbar(props: {
17
+ readonly sidebar?: boolean;
18
+ readonly onRequestVisibility?: () => void;
19
+}) {
20
const navigation = useNavigation();
21
const workspace = useWorkspaceTabs()!;
22
const { dispatch, getScrollOffset, recordScrollOffset, isTabActive } = workspace;
23
const homeFocused = useNavigationState((state) => state.routes[state.index]?.name === "Home");
24
const listFocused = homeFocused && workspace.state.selectedTab === "pullRequests";
25
const { onRequestVisibility } = props;
26
+ const showThreads = useWorkspaceListNavigation("threads");
27
const tab = workspace.state.tabs.pullRequests;
28
const input = useRef<TextInputInstance>(null);
29
const searching = tab.searchMode !== "resting";
@@ -73,6 +78,7 @@ export function PullRequestToolbar(props: { readonly onRequestVisibility?: () =>
78
<CompactBrandTitle
79
allowFontScaling={false}
80
accessibilityLabel="T3 Code, Pull requests"
81
+ fit
82
/>
83
}
84
onPress={() =>
@@ -98,6 +104,15 @@ export function PullRequestToolbar(props: { readonly onRequestVisibility?: () =>
104
searching
105
? []
106
: [
107
+ ...(props.sidebar
108
+ ? [
109
+ {
110
+ accessibilityLabel: "Show threads",
111
+ icon: "text.bubble",
112
+ onPress: showThreads,
113
+ } as const,
114
+ ]
115
+ : []),
116
{
117
accessibilityLabel: "Search pull requests",
118
icon: "magnifyingglass",
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+11
-2
@@ -97,7 +97,11 @@ import type { ComposerEditorHandle } from "../../components/ComposerEditor";
97
import type { StatusTone } from "../../components/StatusPill";
98
import type { DraftComposerAttachment } from "../../lib/composerImages";
99
import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
100
-import { CHAT_CONTENT_MAX_WIDTH, type LayoutVariant } from "../../lib/layout";
100
+import {
101
+ ANDROID_READING_MAX_WIDTH,
102
+ CHAT_CONTENT_MAX_WIDTH,
103
+ type LayoutVariant,
104
+} from "../../lib/layout";
105
import { editPendingThreadMessage } from "../../state/edit-pending-thread-message";
106
import { deviceEnvironment } from "../../state/device";
107
import { useEnvironmentQuery } from "../../state/query";
@@ -768,7 +772,12 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
772
const showContent = props.showContent ?? true;
773
const layoutVariant = props.layoutVariant ?? "compact";
774
const isSplitLayout = layoutVariant === "split";
771
- const contentMaxWidth = isSplitLayout ? CHAT_CONTENT_MAX_WIDTH : undefined;
775
+ const contentMaxWidth =
776
+ Platform.OS === "android"
777
+ ? ANDROID_READING_MAX_WIDTH
778
+ : isSplitLayout
779
+ ? CHAT_CONTENT_MAX_WIDTH
780
+ : undefined;
781
const providerSubagentProvider = props.serverConfig?.providers.find(
782
(provider) => provider.instanceId === props.selectedThread.modelSelection.instanceId,
783
);
apps/mobile/src/features/threads/thread-list-v2-items.tsx
+2
-1
@@ -1205,7 +1205,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
1205
</RowPressable>
1206
);
1207
1208
- if (!canOperateThread) return rowContent(() => {});
1208
+ if (!canOperateThread)
1209
+ return <View style={rowAppearance.swipeContainerStyle}>{rowContent(() => {})}</View>;
1210
1211
return (
1212
<View collapsable={false}>
apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
+8
-31
@@ -1,6 +1,6 @@
1
import { requireNativeView } from "expo";
2
-import { CommonActions, useNavigation } from "@react-navigation/native";
3
-import { androidWorkspaceNavigationState } from "../../lib/android-workspace-navigation";
2
+import { useNavigation } from "@react-navigation/native";
3
+import { resetAndroidWorkspace } from "../../lib/android-workspace-navigation";
4
import {
5
Keyboard,
6
processColor,
@@ -17,10 +17,7 @@ import { useAppearancePreferences } from "../settings/appearance/AppearancePrefe
17
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
18
import type { WorkspaceTab } from "./workspace-tabs-state";
19
20
-export const ANDROID_WORKSPACE_RAIL_WIDTH = 80;
21
-
20
interface NativeNavigationProps extends ViewProps {
23
- readonly rail: boolean;
21
readonly selectedTab: WorkspaceTab;
22
readonly dark: boolean;
23
readonly textScale: number;
@@ -38,37 +35,20 @@ function nativeColor(value: string) {
35
return typeof color === "number" ? color : 0;
36
}
37
41
-export function AndroidWorkspaceNavigation(props: {
42
- readonly rail?: boolean;
43
- readonly onSelect?: () => void;
44
-}) {
38
+export function AndroidWorkspaceNavigation() {
39
const workspace = useWorkspaceTabs()!;
40
const navigation = useNavigation();
41
const insets = useSafeAreaInsets();
42
const keyboardVisible = useKeyboardState((state) => state.isVisible);
43
const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
44
const { scale } = useAndroidControlSizing();
51
- const rail = Boolean(props.rail);
45
const { containerColor, indicatorColor, selectedColor, unselectedColor } =
53
- androidWorkspaceNavigationColors(colors, rail);
54
- if (!rail && keyboardVisible) return null;
46
+ androidWorkspaceNavigationColors(colors);
47
+ if (keyboardVisible) return null;
48
49
return (
57
- <View
58
- style={{
59
- backgroundColor: containerColor,
60
- ...(rail
61
- ? {
62
- flex: 1,
63
- width: ANDROID_WORKSPACE_RAIL_WIDTH * Math.max(1, scale),
64
- paddingTop: insets.top,
65
- paddingBottom: insets.bottom,
66
- }
67
- : { paddingBottom: insets.bottom }),
68
- }}
69
- >
50
+ <View style={{ backgroundColor: containerColor, paddingBottom: insets.bottom }}>
51
<NativeNavigation
71
- rail={rail}
52
selectedTab={workspace.state.selectedTab}
53
dark={themeAppearance === "dark"}
54
textScale={scale}
@@ -81,13 +61,10 @@ export function AndroidWorkspaceNavigation(props: {
61
const tab = event.nativeEvent.tab;
62
if (tab !== workspace.state.selectedTab) {
63
workspace.dispatch({ type: "select", tab });
84
- navigation.dispatch((state) =>
85
- CommonActions.reset(androidWorkspaceNavigationState(state)),
86
- );
64
+ resetAndroidWorkspace(navigation);
65
}
88
- props.onSelect?.();
66
}}
90
- style={rail ? { flex: 1 } : { height: 80 * Math.max(1, scale) }}
67
+ style={{ height: 80 * Math.max(1, scale) }}
68
/>
69
</View>
70
);
apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.tsx
+1
-6
@@ -1,8 +1,3 @@
1
-export function AndroidWorkspaceNavigation(_props: {
2
- readonly rail?: boolean;
3
- readonly onSelect?: () => void;
4
-}) {
1
+export function AndroidWorkspaceNavigation() {
2
return null;
3
}
7
-
8
-export const ANDROID_WORKSPACE_RAIL_WIDTH = 80;
apps/mobile/src/features/workspace/AndroidWorkspaceSidebar.android.tsx
+1
-1
@@ -17,7 +17,7 @@ export function AndroidWorkspaceSidebar(props: {
17
) : (
18
<WorkspaceTabsContext value={context}>
19
<View className="flex-1 bg-header">
20
- <PullRequestToolbar onRequestVisibility={props.onRequestVisibility} />
20
+ <PullRequestToolbar sidebar onRequestVisibility={props.onRequestVisibility} />
21
<ScreenContent insetHorizontal>
22
<PullRequestsScreen sidebar selectedPullRequestKey={props.selectedPullRequestKey} />
23
</ScreenContent>
apps/mobile/src/features/workspace/android-workspace-navigation-colors.test.ts
+13
-20
@@ -34,19 +34,14 @@ function expectVisibleSelection(colors: ReturnType<typeof androidWorkspaceNaviga
34
}
35
36
describe("Android workspace navigation colors", () => {
37
- it.each(MOBILE_THEME_IDS)(
38
- "keeps %s selection visible in both navigation positions",
39
- (themeId) => {
40
- for (const appearance of ["light", "dark"] as const) {
41
- const variables = getMobileThemeRuntimeVariables(themeId, appearance, "android");
42
- const snapshot = { ...variables };
43
- for (const rail of [false, true]) {
44
- expectVisibleSelection(androidWorkspaceNavigationColors(variables, rail));
45
- }
46
- expect(variables).toEqual(snapshot);
47
- }
48
- },
49
- );
37
+ it.each(MOBILE_THEME_IDS)("keeps %s selection visible", (themeId) => {
38
+ for (const appearance of ["light", "dark"] as const) {
39
+ const variables = getMobileThemeRuntimeVariables(themeId, appearance, "android");
40
+ const snapshot = { ...variables };
41
+ expectVisibleSelection(androidWorkspaceNavigationColors(variables));
42
+ expect(variables).toEqual(snapshot);
43
+ }
44
+ });
45
46
it.each(["#6750a4", "#006a6a", "#9c4146"])(
47
"keeps Material You selection visible for system seed %s",
@@ -90,19 +85,17 @@ describe("Android workspace navigation colors", () => {
85
appearance,
86
getMobileThemeRuntimeVariables("material-you", appearance, "android"),
87
);
93
- for (const rail of [false, true]) {
94
- expectVisibleSelection(androidWorkspaceNavigationColors(variables, rail));
95
- }
88
+ expectVisibleSelection(androidWorkspaceNavigationColors(variables));
89
}
90
},
91
);
92
93
it("preserves an already visible tonal fill", () => {
94
const variables = getMobileThemeRuntimeVariables("t3-chat", "light", "android");
102
- const colors = androidWorkspaceNavigationColors(
103
- { ...variables, "--color-secondary": "#e091cf" },
104
- true,
105
- );
95
+ const colors = androidWorkspaceNavigationColors({
96
+ ...variables,
97
+ "--color-secondary": "#e091cf",
98
+ });
99
expect(colors.indicatorColor).toBe("#e091cf");
100
expectVisibleSelection(colors);
101
});
apps/mobile/src/features/workspace/android-workspace-navigation-colors.ts
+5
-4
@@ -5,11 +5,12 @@ import {
5
type MobileThemeVariables,
6
} from "../../lib/mobileTheme";
7
8
-export function androidWorkspaceNavigationColors(colors: MobileThemeVariables, rail: boolean) {
8
+export function androidWorkspaceNavigationColors(colors: MobileThemeVariables) {
9
const header = flattenThemeColor(colors["--color-header"], colors["--color-screen"]);
10
- const containerColor = rail
11
- ? header
12
- : flattenThemeColor(themeColorWithAlpha(colors["--color-header-foreground"], 0.05), header);
10
+ const containerColor = flattenThemeColor(
11
+ themeColorWithAlpha(colors["--color-header-foreground"], 0.05),
12
+ header,
13
+ );
14
const indicatorColor = themeColorWithContrast(
15
flattenThemeColor(colors["--color-secondary"], containerColor),
16
containerColor,
apps/mobile/src/features/workspace/useAndroidWorkspaceNavigation.ts
+3
-8
@@ -1,12 +1,7 @@
1
-import {
2
- CommonActions,
3
- StackActions,
4
- useFocusEffect,
5
- useNavigation,
6
-} from "@react-navigation/native";
1
+import { StackActions, useFocusEffect, useNavigation } from "@react-navigation/native";
2
import { useCallback } from "react";
3
import { BackHandler, Keyboard, Platform } from "react-native";
9
-import { androidWorkspaceNavigationState } from "../../lib/android-workspace-navigation";
4
+import { resetAndroidWorkspace } from "../../lib/android-workspace-navigation";
5
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
6
import type { WorkspaceTab } from "./workspace-tabs-state";
7
@@ -16,7 +11,7 @@ export function useWorkspaceListNavigation(tab: WorkspaceTab) {
11
return useCallback(() => {
12
if (Platform.OS === "android") {
13
dispatch?.({ type: "select", tab });
19
- navigation.dispatch((state) => CommonActions.reset(androidWorkspaceNavigationState(state)));
14
+ resetAndroidWorkspace(navigation);
15
} else if (navigation.canGoBack()) navigation.goBack();
16
else navigation.dispatch(StackActions.replace("Home"));
17
}, [navigation, dispatch, tab]);
apps/mobile/src/features/workspace/useAndroidWorkspaceSelection.ts
+3
-5
@@ -1,8 +1,8 @@
1
-import { CommonActions, useNavigation } from "@react-navigation/native";
1
+import { useNavigation } from "@react-navigation/native";
2
import { useCallback } from "react";
3
import { Keyboard } from "react-native";
4
import {
5
- androidWorkspaceNavigationState,
5
+ resetAndroidWorkspace,
6
type AndroidWorkspaceDestination,
7
} from "../../lib/android-workspace-navigation";
8
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
@@ -20,9 +20,7 @@ export function useAndroidWorkspaceSelection() {
20
type: "select",
21
tab: destination.name === "Thread" ? "threads" : "pullRequests",
22
});
23
- navigation.dispatch((state) =>
24
- CommonActions.reset(androidWorkspaceNavigationState(state, destination, reviewers)),
25
- );
23
+ resetAndroidWorkspace(navigation, destination, reviewers);
24
},
25
[navigation, dispatch],
26
);
apps/mobile/src/lib/android-workspace-navigation.test.ts
+45
@@ -2,7 +2,9 @@ import * as NodeModule from "node:module";
2
import { describe, expect, it } from "vite-plus/test";
3
import {
4
androidWorkspaceNavigationState,
5
+ resetAndroidWorkspace,
6
type AndroidWorkspaceDestination,
7
+ type AndroidWorkspaceResetAction,
8
} from "./android-workspace-navigation";
9
10
const require = NodeModule.createRequire(import.meta.url);
@@ -183,4 +185,47 @@ describe("Android workspace navigation", () => {
185
expect(state.routes[0]?.key).toBe(previous.routes[0]?.key);
186
expect(state.index).toBe(0);
187
});
188
+
189
+ it("resets the root stack when a nested Settings stack has focus", () => {
190
+ const root = apply(router.getInitialState(options), StackActions.push("SettingsSheet"));
191
+ const settings = router.getInitialState({
192
+ ...options,
193
+ routeNames: ["SettingsContent", "SettingsEnvironments"],
194
+ });
195
+ const actions: AndroidWorkspaceResetAction[] = [];
196
+ const rootNavigation = {
197
+ dispatch: () => undefined,
198
+ getParent: () => undefined,
199
+ getState: () => root,
200
+ };
201
+ resetAndroidWorkspace(
202
+ {
203
+ dispatch: (action) => actions.push(action),
204
+ getParent: () => rootNavigation,
205
+ getState: () => settings,
206
+ },
207
+ thread,
208
+ );
209
+ const [action] = actions;
210
+ expect(action?.target).toBe(root.key);
211
+ expect(names(apply(root, action!))).toEqual(["Home", "Thread"]);
212
+ });
213
+
214
+ it("resets from the navigation container before any navigation action", () => {
215
+ const root = router.getInitialState(options);
216
+ const actions: AndroidWorkspaceResetAction[] = [];
217
+ // The container only learns the root state after the first action.
218
+ resetAndroidWorkspace(
219
+ {
220
+ dispatch: (action) => actions.push(action),
221
+ getParent: () => undefined,
222
+ getState: () => undefined,
223
+ getRootState: () => root,
224
+ },
225
+ thread,
226
+ );
227
+ const [action] = actions;
228
+ expect(action?.target).toBe(root.key);
229
+ expect(names(apply(root, action!))).toEqual(["Home", "Thread"]);
230
+ });
231
});
apps/mobile/src/lib/android-workspace-navigation.ts
+44
-1
@@ -1,9 +1,21 @@
1
-import type { NavigationState } from "@react-navigation/native";
1
+import type { CommonActions, NavigationState } from "@react-navigation/native";
2
3
export type AndroidWorkspaceDestination =
4
| { readonly name: "Thread"; readonly params: ReactNavigation.RootParamList["Thread"] }
5
| { readonly name: "PullRequest"; readonly params: ReactNavigation.RootParamList["PullRequest"] };
6
7
+export type AndroidWorkspaceResetAction = ReturnType<typeof CommonActions.reset> & {
8
+ readonly target: string;
9
+};
10
+
11
+interface WorkspaceNavigation {
12
+ readonly dispatch: (action: AndroidWorkspaceResetAction) => void;
13
+ readonly getParent: () => WorkspaceNavigation | undefined;
14
+ readonly getState: () => NavigationState | undefined;
15
+ /** Only on the navigation container, whose `getState` stays empty until the first action. */
16
+ readonly getRootState?: () => NavigationState | undefined;
17
+}
18
+
19
export function androidWorkspaceNavigationState(
20
state: NavigationState,
21
destination?: AndroidWorkspaceDestination,
@@ -31,3 +43,34 @@ export function androidWorkspaceNavigationState(
43
],
44
};
45
}
46
+
47
+/**
48
+ * Resets the root stack to a workspace list or detail. Always reads and targets the root
49
+ * navigator: the sidebar and rail render in the root layout, where `useNavigation()` is the
50
+ * container, and a container dispatch runs on the deepest focused navigator. With Settings
51
+ * or New task open, that is their nested stack, which rejects the reset.
52
+ */
53
+export function resetAndroidWorkspace(
54
+ navigation: WorkspaceNavigation,
55
+ destination?: AndroidWorkspaceDestination,
56
+ reviewers?: ReactNavigation.RootParamList["PullRequestReviewers"],
57
+) {
58
+ let root = navigation;
59
+ for (let parent = root.getParent(); parent; parent = root.getParent()) root = parent;
60
+ const state = root.getRootState?.() ?? root.getState();
61
+ if (!state) return;
62
+ // Same shape as `CommonActions.reset`, which would pull React Native into node tests.
63
+ navigation.dispatch({
64
+ type: "RESET",
65
+ payload: androidWorkspaceNavigationState(state, destination, reviewers),
66
+ target: state.key,
67
+ });
68
+}
69
+
70
+// In the split view these destinations swap the detail pane beside the sidebar instead of
71
+// stacking over Home, so the default slide-in would show a layer that is not there.
72
+export function androidWorkspaceDestinationAnimation(routeName: string, usesSplitView: boolean) {
73
+ return usesSplitView && (routeName === "Thread" || routeName === "PullRequest")
74
+ ? ("none" as const)
75
+ : undefined;
76
+}
apps/mobile/src/lib/layout.test.ts
+5
-20
@@ -420,30 +420,15 @@ describe("deriveWorkspacePaneLayout", () => {
420
describe("alignListPaneToHinge", () => {
421
const layout = deriveLayout({ width: 852, height: 880 });
422
423
- it("ends the list pane at a book-posture hinge after the rail", () => {
423
+ it("ends the list pane at a book-posture hinge", () => {
424
expect(
425
- alignListPaneToHinge({
426
- layout,
427
- hinge: { x: 426, width: 0 },
428
- viewportWidth: 852,
429
- leadingWidth: 96,
430
- }),
431
- ).toMatchObject({ listPaneWidth: 330, listPaneGap: 0 });
425
+ alignListPaneToHinge({ layout, hinge: { x: 426, width: 0 }, viewportWidth: 852 }),
426
+ ).toMatchObject({ listPaneWidth: 426, listPaneGap: 0 });
427
});
428
429
it("keeps the default split when either side of the hinge would be too narrow", () => {
435
- const narrowList = {
436
- layout,
437
- hinge: { x: 300, width: 0 },
438
- viewportWidth: 852,
439
- leadingWidth: 96,
440
- };
441
- const narrowDetail = {
442
- layout,
443
- hinge: { x: 600, width: 0 },
444
- viewportWidth: 852,
445
- leadingWidth: 0,
446
- };
430
+ const narrowList = { layout, hinge: { x: 250, width: 0 }, viewportWidth: 852 };
431
+ const narrowDetail = { layout, hinge: { x: 600, width: 0 }, viewportWidth: 852 };
432
expect(alignListPaneToHinge(narrowList)).toBe(layout);
433
expect(alignListPaneToHinge(narrowDetail)).toBe(layout);
434
});
apps/mobile/src/lib/layout.ts
+6
-11
@@ -14,6 +14,9 @@ const SPLIT_SIDEBAR_DEFAULT_MAX_WIDTH = 380;
14
15
export const AUXILIARY_PANE_MIN_CONTENT_WIDTH = 960;
16
export const CHAT_CONTENT_MAX_WIDTH = 960;
17
+// Android reading width for the thread feed, composer, and full-width thread list.
18
+// Phones are narrower; foldables in portrait and the keyboard-open split view are not.
19
+export const ANDROID_READING_MAX_WIDTH = 640;
20
// min-h-8 uses the 14px rem configured in metro.config.js.
21
export const THREAD_WORK_ROW_MIN_HEIGHT = 28;
22
@@ -136,26 +139,18 @@ export interface VerticalHinge {
139
readonly width: number;
140
}
141
139
-/**
140
- * Moves the list/detail split onto a book-posture hinge so neither pane straddles the crease.
141
- * `leadingWidth` is chrome left of the list pane, such as the Android navigation rail.
142
- */
142
+/** Moves the list/detail split onto a book-posture hinge so neither pane straddles the crease. */
143
export function alignListPaneToHinge(input: {
144
readonly layout: Layout;
145
readonly hinge: VerticalHinge | null;
146
readonly viewportWidth: number;
147
- readonly leadingWidth: number;
147
}): Layout {
148
const { layout, hinge } = input;
149
if (!hinge || !layout.usesSplitView) return layout;
151
- const listPaneWidth = hinge.x - input.leadingWidth;
152
- if (
153
- listPaneWidth < SPLIT_SIDEBAR_MIN_WIDTH ||
154
- input.viewportWidth - hinge.x - hinge.width < 320
155
- ) {
150
+ if (hinge.x < SPLIT_SIDEBAR_MIN_WIDTH || input.viewportWidth - hinge.x - hinge.width < 320) {
151
return layout;
152
}
158
- return { ...layout, listPaneWidth, listPaneGap: hinge.width };
153
+ return { ...layout, listPaneWidth: hinge.x, listPaneGap: hinge.width };
154
}
155
156
/**
apps/mobile/src/native/useOpenPullRequest.ts
+2
-7
@@ -2,8 +2,7 @@ import { useNavigation, useRoute, StackActions } from "@react-navigation/native"
2
import { nativePullRequestDestination } from "../lib/pullRequestNavigation";
3
import { useCallback } from "react";
4
import { Platform } from "react-native";
5
-import { CommonActions } from "@react-navigation/native";
6
-import { androidWorkspaceNavigationState } from "../lib/android-workspace-navigation";
5
+import { resetAndroidWorkspace } from "../lib/android-workspace-navigation";
6
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
7
import { useThreadShell } from "../state/entities";
8
import { tryOpenExternalUrl } from "../lib/openExternalUrl";
@@ -45,11 +44,7 @@ export function useOpenPullRequest(options?: {
44
);
45
if (!params) return tryOpenExternalUrl(url, "pull-request");
46
if (Platform.OS === "android")
48
- navigation.dispatch((state) =>
49
- CommonActions.reset(
50
- androidWorkspaceNavigationState(state, { name: "PullRequest", params }),
51
- ),
52
- );
47
+ resetAndroidWorkspace(navigation, { name: "PullRequest", params });
48
else if (replace) navigation.dispatch(StackActions.replace("PullRequest", params));
49
else navigation.navigate("PullRequest", params);
50
return true;