Skip to content
TypeScript

fix(mobile): Android floating tab bar fills the row when compose is hidden (#26939)

voida65882ccd7f7dd
diff --git a/apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx b/apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
index 52f92ffc9fe..f9f2e57bc3e 100644
--- a/apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
+++ b/apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
@@ -86,13 +86,6 @@ export function AndroidWorkspaceNavigation(props: {
const rail = Boolean(props.rail);
const floating = !rail && Boolean(props.floating);
const tabs = [...visibleNavigationTabs(order, hidden, rail ? 5 : 4), "settings"];
- const metrics = floatingTabsMetrics(
- tabs.length,
- scale,
- fabSize,
- props.paneWidth ?? window.width,
- props.fillWidth,
- );
const { containerColor, indicatorColor, selectedColor, unselectedColor } =
androidWorkspaceNavigationColors(colors, rail, floating);
const selectedTab = selectedNavigationTab(
@@ -102,6 +95,24 @@ export function AndroidWorkspaceNavigation(props: {
hidden,
rail ? 5 : 4,
);
+ // FloatingWorkspaceTabs starts the bar at the left inset, so a cutout narrows the room.
+ const barWidth =
+ props.paneWidth ??
+ window.width - (Math.max(insets.left, FLOATING_TABS.edge) - FLOATING_TABS.edge);
+ // A phone draws compose on the Chats list only; the split sidebar draws it on every tab
+ // except the Settings and Usage pages.
+ const composeBesideBar =
+ props.paneWidth === undefined
+ ? selectedTab === "threads"
+ : selectedTab !== "settings" && selectedTab !== "usage";
+ const metrics = floatingTabsMetrics(
+ tabs.length,
+ scale,
+ fabSize,
+ barWidth,
+ props.fillWidth,
+ composeBesideBar && connectionState.hasConnections,
+ );
if (!rail && keyboardVisible) return null;
return (
diff --git a/apps/mobile/src/features/workspace/floating-workspace-tabs.ts b/apps/mobile/src/features/workspace/floating-workspace-tabs.ts
index bb24d3478fd..d28524e656b 100644
--- a/apps/mobile/src/features/workspace/floating-workspace-tabs.ts
+++ b/apps/mobile/src/features/workspace/floating-workspace-tabs.ts
@@ -7,6 +7,7 @@ export function floatingTabsMetrics(
fabSize: number,
paneWidth?: number,
fillWidth = false,
+ composeVisible = true,
) {
const unit = Math.max(1, scale);
const height = fabSize;
@@ -16,11 +17,10 @@ export function floatingTabsMetrics(
const room =
paneWidth === undefined
? count * 60 * unit
- : sharesRow
+ : sharesRow && composeVisible
? paneWidth - beside
: paneWidth - 2 * FLOATING_TABS.edge;
return {
- // Reserve the compose slot even while its button is hidden.
pill: Math.max(0, fillWidth ? room : Math.min(count * 72 * unit, room)),
height,
row,