Files
orca/mobile/src/layout/use-fold-split.web.ts
T
Neil 19043a3d76 refactor(mobile): organize pairing, session, RPC and host owners (#39846)
* refactor(mobile): give relay and encryption concrete owners

* refactor(mobile): organize session and review feature owners

* refactor(mobile): organize RPC and host ownership

* test(mobile): point render fixtures at concrete owners

* refactor(mobile): use explicit type-only owner imports
2026-11-08 07:19:05 -08:00

19 lines
724 B
TypeScript

import { useSyncExternalStore } from 'react'
import { useWindowDimensions } from 'react-native'
import { usePageBridgeClient } from '../transport/connection/client-context.web'
import type { FoldSplit } from './fold-division'
/** The fold the shell measured over this page, in the page's px; null when none splits it. */
export function useFoldSplit(): FoldSplit | null {
const client = usePageBridgeClient()
const division = useSyncExternalStore(
client.onFoldDivisionUpdate,
() => client.getShellSession()?.foldDivision ?? null
)
const { width, height } = useWindowDimensions()
if (division === null) {
return null
}
return { ...division, size: division.axis === 'vertical' ? width : height }
}