You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CustomDrawer.jsx 2.7KB

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