Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

CustomDrawer.jsx 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import React, { useContext } from "react";
  2. import {
  3. View,
  4. Text,
  5. ImageBackground,
  6. Image,
  7. TouchableOpacity,
  8. StyleSheet,
  9. Linking,
  10. } from "react-native";
  11. import {
  12. DrawerContentScrollView,
  13. DrawerItemList,
  14. } from "@react-navigation/drawer";
  15. import { AuthContext } from "../../context/AuthContext";
  16. import Loader from "../Loader";
  17. import { MaterialIcons } from "@expo/vector-icons";
  18. import { Ionicons } from "@expo/vector-icons";
  19. const CustomDrawer = (props) => {
  20. const { logout, isLoading } = useContext(AuthContext);
  21. return (
  22. <View style={styles.container}>
  23. <Loader visible={isLoading} />
  24. <DrawerContentScrollView {...props} contentContainerStyle={styles.drawer}>
  25. <ImageBackground
  26. source={require("../../assets/images/menu-bg.jpeg")}
  27. style={styles.backgroundImage}
  28. >
  29. <Image
  30. source={require("../../assets/images/diligent-purple.png")}
  31. style={styles.profileImage}
  32. />
  33. <Text style={styles.userName}>Diligent Software</Text>
  34. </ImageBackground>
  35. <View style={styles.drawerItems}>
  36. <DrawerItemList {...props} />
  37. </View>
  38. </DrawerContentScrollView>
  39. <View style={styles.footer}>
  40. <TouchableOpacity
  41. onPress={() => Linking.openURL("mailto:office@dilig.net")}
  42. style={styles.footerButton}
  43. >
  44. <View style={styles.buttonContent}>
  45. <Ionicons name="mail-outline" size={24} color="#333" />
  46. <Text style={styles.footerButtonText}>Contact Us</Text>
  47. </View>
  48. </TouchableOpacity>
  49. <TouchableOpacity onPress={logout} style={styles.footerButton}>
  50. <View style={styles.buttonContent}>
  51. <MaterialIcons name="logout" size={22} color="#333" />
  52. <Text style={styles.footerButtonText}>Sign Out</Text>
  53. </View>
  54. </TouchableOpacity>
  55. </View>
  56. </View>
  57. );
  58. };
  59. const styles = StyleSheet.create({
  60. container: {
  61. flex: 1,
  62. },
  63. drawer: {
  64. backgroundColor: "#8200d6",
  65. },
  66. backgroundImage: {
  67. padding: 20,
  68. },
  69. profileImage: {
  70. height: 80,
  71. width: 80,
  72. borderRadius: 40,
  73. marginBottom: 10,
  74. },
  75. userName: {
  76. color: "#fff",
  77. fontSize: 18,
  78. marginBottom: 5,
  79. fontFamily: "poppins-regular",
  80. },
  81. drawerItems: {
  82. flex: 1,
  83. backgroundColor: "#fff",
  84. paddingTop: 10,
  85. },
  86. footer: {
  87. padding: 20,
  88. borderTopWidth: 1,
  89. borderTopColor: "#ccc",
  90. },
  91. footerButton: {
  92. paddingVertical: 15,
  93. },
  94. buttonContent: {
  95. flexDirection: "row",
  96. alignItems: "center",
  97. },
  98. footerButtonText: {
  99. fontSize: 15,
  100. marginLeft: 5,
  101. fontFamily: "poppins-regular",
  102. },
  103. });
  104. export default CustomDrawer;