| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- import React from "react";
- import {
- View,
- Text,
- ImageBackground,
- Image,
- TouchableOpacity,
- StyleSheet,
- Linking,
- } from "react-native";
- import {
- DrawerContentScrollView,
- DrawerItemList,
- } from "@react-navigation/drawer";
- import { MaterialIcons } from "@expo/vector-icons";
- import { Ionicons } from "@expo/vector-icons";
- import { useDispatch } from "react-redux";
- import { logoutUser } from "../../store/actions/login/loginActions";
- import useAuthHook from "../../hooks/useAuthHook";
-
- const CustomDrawer = (props) => {
-
- const {logoutAuthProvider} = useAuthHook()
-
- const dispatch = useDispatch();
-
- const handleLogout = async () => {
- logoutAuthProvider()
- dispatch(logoutUser());
- }
-
- return (
- <View style={styles.container}>
- <DrawerContentScrollView {...props} contentContainerStyle={styles.drawer}>
- <ImageBackground
- source={require("../../assets/images/menu-bg.jpeg")}
- style={styles.backgroundImage}
- >
- <Image
- source={require("../../assets/images/diligent-purple.png")}
- style={styles.profileImage}
- />
- <Text style={styles.userName}>Diligent Software</Text>
- </ImageBackground>
- <View style={styles.drawerItems}>
- <DrawerItemList {...props} />
- </View>
- </DrawerContentScrollView>
- <View style={styles.footer}>
- <TouchableOpacity
- onPress={() => Linking.openURL("mailto:office@dilig.net")}
- style={styles.footerButton}
- >
- <View style={styles.buttonContent}>
- <Ionicons name="mail-outline" size={24} color="#333" />
- <Text style={styles.footerButtonText}>Contact Us</Text>
- </View>
- </TouchableOpacity>
- <TouchableOpacity onPress={handleLogout} style={styles.footerButton}>
- <View style={styles.buttonContent}>
- <MaterialIcons name="logout" size={22} color="#333" />
- <Text style={styles.footerButtonText}>Sign Out</Text>
- </View>
- </TouchableOpacity>
- </View>
- </View>
- );
- };
-
- const styles = StyleSheet.create({
- container: {
- flex: 1,
- },
- drawer: {
- backgroundColor: "#8200d6",
- },
- backgroundImage: {
- padding: 20,
- },
- profileImage: {
- height: 80,
- width: 80,
- borderRadius: 40,
- marginBottom: 10,
- },
- userName: {
- color: "#fff",
- fontSize: 18,
- marginBottom: 5,
- fontFamily: "poppins-regular",
- },
- drawerItems: {
- flex: 1,
- backgroundColor: "#fff",
- paddingTop: 10,
- },
- footer: {
- padding: 20,
- borderTopWidth: 1,
- borderTopColor: "#ccc",
- },
- footerButton: {
- paddingVertical: 15,
- },
- buttonContent: {
- flexDirection: "row",
- alignItems: "center",
- },
- footerButtonText: {
- fontSize: 15,
- marginLeft: 5,
- fontFamily: "poppins-regular",
- },
- });
-
- export default CustomDrawer;
|