cmvr-wms/mobile-app/src/core/arrival-layout.ts

13 lines
563 B
TypeScript
Raw Normal View History

// Native text keeps system font scaling. Adapt space around it, never double-scale
// font sizes or force all users back to the default system font size.
export function arrivalLayout(width: number, fontScale = 1) {
const screen = Number.isFinite(width) && width > 0 ? Math.min(width, 480) : 360;
const scale = Number.isFinite(fontScale) && fontScale >= 1 ? fontScale : 1;
const readableWidth = (screen - 60) / scale;
return {
stackedHeader: readableWidth < 280,
stackedDetails: readableWidth < 240,
labelWidth: Math.ceil(58 * scale),
};
}