Files
otunes/apps/mobile/lib/navigation.ts

44 lines
1.3 KiB
TypeScript

import { useColorScheme } from "react-native"
import { colors } from "@/lib/theme"
import type { ScreenProps as BaseScreenProps } from "expo-router/build/useScreens"
import type {
NativeStackNavigationEventMap,
NativeStackNavigationOptions,
} from "expo-router/build/react-navigation/native-stack"
import type { ParamListBase, StackNavigationState } from "expo-router/build/react-navigation/native"
type StackBaseScreenProps = BaseScreenProps<
NativeStackNavigationOptions,
StackNavigationState<ParamListBase>,
NativeStackNavigationEventMap
>
type StackScreenOptions = StackBaseScreenProps["options"]
export const tabStackScreenTitles: Record<string, string> = {
"browse/albums": "Albums",
"browse/artists": "Artists",
"browse/songs": "Songs",
"browse/playlists": "Playlists",
"recently-played": "Recently Played",
"recently-added": "Recently Added",
settings: "Settings",
}
export function useStackScreenOptions(
overrides?: StackScreenOptions
): StackScreenOptions {
const scheme = useColorScheme()
const theme = scheme === "dark" ? colors.dark : colors.light
return {
headerLargeTitle: true,
headerTransparent: true,
headerTintColor: theme.foreground,
headerLargeTitleStyle: { color: theme.foreground },
headerBackButtonDisplayMode: "minimal",
...overrides,
}
}