mirror of
https://github.com/stablyai/orca.git
synced 2026-11-18 20:06:10 +00:00
* 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
19 lines
724 B
TypeScript
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 }
|
|
}
|