:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import type { ViewStyle } from 'react-native'
import { useOverlayPane } from './useOverlayPane'
import { useScreenInsets } from './useScreenInsets'
export function useFloatingMenuStyle(top: number, preferredWidth: number): ViewStyle {
const pane = useOverlayPane()
const insets = useScreenInsets()
const gutter = 14
const width = Math.max(0, Math.min(preferredWidth, pane.width - gutter * 2))
const fittedTop = Math.max(pane.y + gutter, Math.min(top, pane.y + pane.height - 120))
return {
left: pane.x + pane.width - width - gutter,
right: undefined,
top: fittedTop,
width,
maxHeight: Math.max(0, pane.y + pane.height - insets.bottom - gutter - fittedTop),
}
}