application-amicale/components/Sidebar/SidebarItem.js

35 lines
965 B
JavaScript
Raw Normal View History

import * as React from 'react';
import {withTheme} from 'react-native-paper';
import {DrawerItem} from "@react-navigation/drawer";
import {MaterialCommunityIcons} from "@expo/vector-icons";
2020-03-29 14:46:44 +02:00
/**
* Component used to render a drawer menu item
*
* @param props Props to pass to the component
* @return {*}
*/
function SidebarItem(props) {
const {colors} = props.theme;
return (
<DrawerItem
label={props.title}
focused={false}
onPress={props.onPress}
icon={({color, size}) =>
2020-04-04 13:52:16 +02:00
<MaterialCommunityIcons color={props.shouldEmphasis ? colors.primary : color} size={size} name={props.icon}/>}
style={{
marginLeft: 0,
marginRight: 0,
padding: 0,
borderRadius: 0,
}}
labelStyle={{
color: colors.text,
}}
/>
);
}
export default withTheme(SidebarItem);