Skip to content

Commit 5882ccd

Browse files
voida6claude
andauthored
fix(mobile): Android floating tab bar fills the row when compose is hidden (pingdotgg#26939)
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
1 parent 640c614 commit 5882ccd

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

‎apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ export function AndroidWorkspaceNavigation(props: {
8686
const rail = Boolean(props.rail);
8787
const floating = !rail && Boolean(props.floating);
8888
const tabs = [...visibleNavigationTabs(order, hidden, rail ? 5 : 4), "settings"];
89-
const metrics = floatingTabsMetrics(
90-
tabs.length,
91-
scale,
92-
fabSize,
93-
props.paneWidth ?? window.width,
94-
props.fillWidth,
95-
);
9689
const { containerColor, indicatorColor, selectedColor, unselectedColor } =
9790
androidWorkspaceNavigationColors(colors, rail, floating);
9891
const selectedTab = selectedNavigationTab(
@@ -102,6 +95,24 @@ export function AndroidWorkspaceNavigation(props: {
10295
hidden,
10396
rail ? 5 : 4,
10497
);
98+
// FloatingWorkspaceTabs starts the bar at the left inset, so a cutout narrows the room.
99+
const barWidth =
100+
props.paneWidth ??
101+
window.width - (Math.max(insets.left, FLOATING_TABS.edge) - FLOATING_TABS.edge);
102+
// A phone draws compose on the Chats list only; the split sidebar draws it on every tab
103+
// except the Settings and Usage pages.
104+
const composeBesideBar =
105+
props.paneWidth === undefined
106+
? selectedTab === "threads"
107+
: selectedTab !== "settings" && selectedTab !== "usage";
108+
const metrics = floatingTabsMetrics(
109+
tabs.length,
110+
scale,
111+
fabSize,
112+
barWidth,
113+
props.fillWidth,
114+
composeBesideBar && connectionState.hasConnections,
115+
);
105116
if (!rail && keyboardVisible) return null;
106117

107118
return (

‎apps/mobile/src/features/workspace/floating-workspace-tabs.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export function floatingTabsMetrics(
77
fabSize: number,
88
paneWidth?: number,
99
fillWidth = false,
10+
composeVisible = true,
1011
) {
1112
const unit = Math.max(1, scale);
1213
const height = fabSize;
@@ -16,11 +17,10 @@ export function floatingTabsMetrics(
1617
const room =
1718
paneWidth === undefined
1819
? count * 60 * unit
19-
: sharesRow
20+
: sharesRow && composeVisible
2021
? paneWidth - beside
2122
: paneWidth - 2 * FLOATING_TABS.edge;
2223
return {
23-
// Reserve the compose slot even while its button is hidden.
2424
pill: Math.max(0, fillWidth ? room : Math.min(count * 72 * unit, room)),
2525
height,
2626
row,

0 commit comments

Comments
 (0)