import React from "react";
import {
DrawerContentComponentProps,
DrawerContentScrollView,
DrawerNavigationOptions as NavProps,
} from "@react-navigation/drawer";
import { Button, View } from "tamagui";
import {
CommonActions,
DrawerActions,
useLinkBuilder,
} from "@react-navigation/native";
import { Link } from "expo-router";
import ThemeSwitcher from "./theme-switcher";
import UserMenuButton from "./user-menu-button";
export type DrawerNavigationOptions = NavProps & {
hidden?: boolean | null;
};
const Drawer = (props: DrawerContentComponentProps) => {
return (
<>
>
);
};
const DrawerItemList = ({
state,
navigation,
descriptors,
}: DrawerContentComponentProps) => {
const { buildHref } = useLinkBuilder();
return state.routes.map((route, i) => {
const focused = i === state.index;
const onPress = () => {
const event = navigation.emit({
type: "drawerItemPress",
target: route.key,
canPreventDefault: true,
});
if (!event.defaultPrevented) {
navigation.dispatch({
...(focused
? DrawerActions.closeDrawer()
: CommonActions.navigate(route)),
target: state.key,
});
}
};
const { title, drawerLabel, drawerIcon, hidden } = descriptors[route.key]
.options as DrawerNavigationOptions;
if (hidden) {
return null;
}
return (
);
}) as React.ReactNode as React.ReactElement;
};
export default Drawer;