Files
iNaturalistReactNative/src/components/CustomDrawerContent.js
Amanda Bullington 295eaee88a Navigation fixes / remove stack navigator (#554)
Remove stack navigator; move everything into tab nav and hide footer when needed
2023-03-29 16:19:31 -07:00

61 lines
1.5 KiB
JavaScript

// @flow
import {
DrawerContentScrollView,
DrawerItem
} from "@react-navigation/drawer";
import type { Node } from "react";
import React from "react";
import useCurrentUser from "sharedHooks/useCurrentUser";
type Props = {
state: any,
navigation: any,
descriptors: any
}
const CustomDrawerContent = ( { ...props }: Props ): Node => {
// $FlowFixMe
const { state, navigation, descriptors } = props;
const currentUser = useCurrentUser( );
return (
<DrawerContentScrollView state={state} navigation={navigation} descriptors={descriptors}>
<DrawerItem
label="search"
onPress={( ) => navigation.navigate( "search" )}
/>
<DrawerItem
label="identify"
onPress={( ) => navigation.navigate( "Identify" )}
/>
<DrawerItem
label="projects"
onPress={( ) => navigation.navigate( "Projects" )}
/>
<DrawerItem
label="about"
onPress={( ) => navigation.navigate( "about" )}
/>
<DrawerItem
label="settings"
onPress={( ) => navigation.navigate( "settings" )}
/>
<DrawerItem
label="network/logging"
onPress={( ) => navigation.navigate( "network" )}
/>
<DrawerItem
label="UI library"
onPress={( ) => navigation.navigate( "UI Library" )}
/>
<DrawerItem
label={currentUser ? "logout" : "login"}
onPress={( ) => navigation.navigate( "Login" )}
/>
</DrawerContentScrollView>
);
};
export default CustomDrawerContent;