You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
725 B
TypeScript
29 lines
725 B
TypeScript
import {DrawerNavigationProp} from '@react-navigation/drawer'
|
|
import {useNavigation} from '@react-navigation/native'
|
|
import {Appbar, IconButton} from 'react-native-paper'
|
|
import {DrawerParamList} from './drawer-param-list'
|
|
import useDark from './use-dark'
|
|
|
|
export default function DrawerHeader({
|
|
name,
|
|
children,
|
|
}: {
|
|
name: string
|
|
children?: JSX.Element | JSX.Element[]
|
|
}) {
|
|
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>()
|
|
const dark = useDark()
|
|
|
|
return (
|
|
<Appbar.Header>
|
|
<IconButton
|
|
color={dark ? 'white' : 'white'}
|
|
icon="menu"
|
|
onPress={navigation.openDrawer}
|
|
/>
|
|
<Appbar.Content title={name} />
|
|
{children}
|
|
</Appbar.Header>
|
|
)
|
|
}
|