Files
paseo/packages/app/src/window-layout/context.ts
T
Mohamed BoudraandElsa Granger 843ce6ebff fix(app): dodge the Duo status region like window controls
The status region beside the iPhone Duo's top band is the window's top-right
obstruction, the same one Windows and Linux window controls publish. Every row
in the band (workspace header in both widths, left sidebar's first row,
explorer tab rail) starts at the band's top, sits in the top bar's height, and
the row owning the top-right corner pads past the status region. Nothing
starts below it. The docked explorer takes the corner from the center column.

Removes the per-row clearance (useTopBandRow) and its start-below fallback.

Co-authored-by: Elsa Granger <zeyugao@outlook.com>
2026-11-08 02:46:56 +01:00

24 lines
879 B
TypeScript

import { createContext, useContext } from "react";
import { useWindowDimensions } from "react-native";
import type { TopBand, WindowLayout } from "./model";
export const WindowLayoutContext = createContext<WindowLayout | null>(null);
/** Published by `WindowLayoutProvider` beside the safe-area insets it derives from it. */
export const TopBandContext = createContext<TopBand | null>(null);
export function useWindowLayout(): WindowLayout | null {
const layout = useContext(WindowLayoutContext);
const { width, height } = useWindowDimensions();
return layout &&
Math.abs(layout.bounds.width - width) <= 0.5 &&
Math.abs(layout.bounds.height - height) <= 0.5
? layout
: null;
}
/** The top band beside the system's status region, or null where the window has none. */
export function useTopBand(): TopBand | null {
return useContext(TopBandContext);
}