| 1 | import type { ReactNode } from "react"; |
| 2 | import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context"; |
| 3 | |
| 4 | import { useNativeWorkspaceColumnsSupported } from "./NativeWorkspaceColumns"; |
| 5 | |
| 6 | /** Reserve the sheet's own side bars without moving its native navigation chrome. */ |
| 7 | export function NativeSheetContent(props: { readonly children: ReactNode }) { |
| 8 | const usesNativeWorkspaceColumns = useNativeWorkspaceColumnsSupported(); |
| 9 | if (!usesNativeWorkspaceColumns) return <>{props.children}</>; |
| 10 | |
| 11 | // A floating sheet can have different insets from the workspace underneath it. |
| 12 | return ( |
| 13 | <SafeAreaProvider style={{ flex: 1 }}> |
| 14 | <SafeAreaView edges={["left", "right"]} style={{ flex: 1 }}> |
| 15 | {props.children} |
| 16 | </SafeAreaView> |
| 17 | </SafeAreaProvider> |
| 18 | ); |
| 19 | } |