Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

NativeSheetContent.tsx

19 lines788 Bytes

1import type { ReactNode } from "react";
2import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
3​
4import { useNativeWorkspaceColumnsSupported } from "./NativeWorkspaceColumns";
5​
6/** Reserve the sheet's own side bars without moving its native navigation chrome. */
7export 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 );