mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-08 17:34:51 +00:00
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>
24 lines
879 B
TypeScript
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);
|
|
}
|