28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import Animated from "react-native-reanimated"
|
|
import { SafeAreaView } from "react-native-safe-area-context"
|
|
import { Platform } from "react-native"
|
|
import type { ReactNode } from "react"
|
|
|
|
import { useAndroidTabBackgroundStyle } from "@/contexts/android-tab-theme"
|
|
import { TabletPlayerLayoutSync } from "@/contexts/tablet-player-layout"
|
|
import { TabletSidebar } from "@/components/tablet-sidebar"
|
|
|
|
/** Apply sidebar insets natively, before Yoga measures the content pane. */
|
|
export function TabScreenContent({ children }: { children: ReactNode }) {
|
|
const backgroundStyle = useAndroidTabBackgroundStyle()
|
|
if (Platform.OS !== "ios" || !Platform.isPad) return <>{children}</>
|
|
return (
|
|
<Animated.View style={[{ flex: 1 }, backgroundStyle]}>
|
|
<SafeAreaView edges={["left", "right"]} style={{ flex: 1 }}>
|
|
{children}
|
|
</SafeAreaView>
|
|
<TabletSidebar />
|
|
<TabletPlayerLayoutSync />
|
|
</Animated.View>
|
|
)
|
|
}
|
|
|
|
export function renderTabScreenContent({ children }: { children: ReactNode }) {
|
|
return <TabScreenContent>{children}</TabScreenContent>
|
|
}
|