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.

HomeScreen.jsx 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import React, { useState } from 'react';
  2. import { View, StyleSheet, TextInput, Text } from 'react-native';
  3. import { Appbar, Menu, Avatar, useTheme } from 'react-native-paper';
  4. import Icon from 'react-native-vector-icons/MaterialIcons';
  5. import dpuser from "@/assets/images/userdp.png";
  6. const HomeScreen = () => {
  7. const { colors, fonts } = useTheme();
  8. const [menuVisible, setMenuVisible] = useState(false);
  9. const [searchInput, setSearchInput] = useState("")
  10. return (
  11. <View style={[styles.container, { backgroundColor: colors.background }]}>
  12. <Appbar.Header>
  13. <Avatar.Image size={50} source={dpuser}></Avatar.Image>
  14. <View style={styles.titleContainer}>
  15. <Appbar.Content title="General" titleStyle={[fonts.titleLarge, styles.title]} />
  16. </View>
  17. {/* Menu Component */}
  18. <Menu
  19. visible={menuVisible}
  20. onDismiss={() => setMenuVisible(false)}
  21. anchor={
  22. <Appbar.Action icon="dots-vertical" onPress={() => setMenuVisible(true)} />
  23. }
  24. >
  25. <Menu.Item onPress={() => console.log('Profile Clicked')} title="Profile" />
  26. <Menu.Item onPress={() => console.log('Settings Clicked')} title="Settings" />
  27. <Menu.Item onPress={() => console.log('Logout Clicked')} title="Logout" />
  28. </Menu>
  29. </Appbar.Header>
  30. <View style={styles.tabContainer}>
  31. <Text style={[styles.tabButton, fonts.titleMedium, { fontWeight: "bold" }, { borderBottomWidth: 2, borderBottomColor: colors.secondary, color: colors.secondary }]}>General </Text>
  32. <Text style={[styles.tabButton, { fontWeight: "bold" }, fonts.titleMedium]}>Request <Text style={styles.badge}>1</Text></Text>
  33. </View>
  34. <View style={styles.searchSection}>
  35. <TextInput
  36. style={styles.input}
  37. placeholder="Search"
  38. onChangeText={setSearchInput}
  39. value={searchInput}
  40. underlineColorAndroid="transparent"
  41. placeholderTextColor="#D9D9D9"
  42. />
  43. <Icon name="search" size={20} color="#888" style={styles.icon} />
  44. </View>
  45. </View>
  46. );
  47. };
  48. const styles = StyleSheet.create({
  49. container: {
  50. flex: 1,
  51. padding: 20,
  52. width: '100%',
  53. },
  54. badge: {
  55. backgroundColor: "#BB5C3F",
  56. color: "#FFF",
  57. borderRadius: 100,
  58. paddingVertical: 4,
  59. paddingHorizontal: 6,
  60. fontSize: 10,
  61. fontWeight: "400",
  62. verticalAlign:"middle",
  63. marginStart:5
  64. },
  65. tabContainer: {
  66. flexDirection: "row",
  67. marginBottom: 20
  68. },
  69. tabButton: {
  70. fontWeight: "bold",
  71. paddingVertical: 15,
  72. width: "50%",
  73. textAlign: "center",
  74. active: {
  75. borderBottomWidth: 2,
  76. }
  77. },
  78. titleContainer: {
  79. flex: 1,
  80. alignItems: 'center',
  81. },
  82. title: {
  83. fontWeight: 'bold',
  84. },
  85. searchSection: {
  86. flexDirection: 'row',
  87. justifyContent: 'center',
  88. alignItems: 'center'
  89. },
  90. icon: {
  91. padding: 10,
  92. position: "absolute",
  93. right: 10,
  94. color: "#D9D9D9"
  95. },
  96. input: {
  97. height: 40,
  98. flex: 1,
  99. borderWidth: 1,
  100. paddingVertical: 10,
  101. paddingHorizontal: 20,
  102. borderRadius: 100,
  103. borderColor: "#C0CFD0"
  104. }
  105. });
  106. export default HomeScreen;