Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

Request.jsx 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. import React, { useState } from 'react';
  2. import { View, StyleSheet, TextInput, Text, ScrollView } from 'react-native';
  3. import { Appbar, Menu, Avatar, useTheme, Button } from 'react-native-paper';
  4. import Icon from 'react-native-vector-icons/MaterialIcons';
  5. import dpuser from "@/assets/images/userdp.png";
  6. const Request = () => {
  7. const { colors, fonts } = useTheme();
  8. const [menuVisible, setMenuVisible] = useState(false);
  9. const [searchInput, setSearchInput] = useState("")
  10. const renderNotificationAction = () => {
  11. return (
  12. <View style={{marginBottom:30, borderBottomWidth:1, paddingBottom:15, borderBottomColor:"rgba(57, 104, 104, 0.3)"}}>
  13. <View style={{ flexDirection: "row", marginBottom: 10 }}>
  14. <Avatar.Image size={60} source={dpuser}></Avatar.Image>
  15. <View style={{ flex: 1, justifyContent: "center", paddingStart: 15, position:"relative", justifyContent:"space-evenly" }}>
  16. <Text style={{ fontWeight: "700", position:"absolute", top:5, right:0, color:"rgba(0,0,0,0.3)" }}>7:55AM</Text>
  17. <Text style={{ fontWeight: "700" }}>Invest Pahang</Text>
  18. <Text style={{ fontWeight: "700" }}>ID No : Ariffudin@PSK</Text>
  19. </View>
  20. </View>
  21. <Text style={{ fontWeight: "700", marginBottom:10 }}>Muhammad Ariffudin is working from home today</Text>
  22. <View style={{flexDirection:"row", justifyContent:"space-evenly", gap:10}}>
  23. <Button mode='outlined' style={{paddingHorizontal:35, borderColor:colors.primary }} onPress={()=>{console.log("click")}}>Reject</Button>
  24. <Button mode='contained' style={{paddingHorizontal:35}} onPress={()=>{console.log("click")}}>Accept</Button>
  25. </View>
  26. </View>
  27. )
  28. }
  29. const renderNotificationResult = (result) => {
  30. return (
  31. <View style={{marginBottom:30, borderBottomWidth:1, paddingBottom:15, borderBottomColor:"rgba(57, 104, 104, 0.3)"}}>
  32. <View style={{ flexDirection: "row", marginBottom: 10 }}>
  33. <Avatar.Image size={60} source={dpuser}></Avatar.Image>
  34. <View style={{ flex: 1, justifyContent: "center", paddingStart: 15, position:"relative", justifyContent:"space-evenly" }}>
  35. <Text style={{ fontWeight: "700", position:"absolute", top:5, right:0, color:"rgba(0,0,0,0.3)" }}>7:55AM</Text>
  36. <Text style={{ fontWeight: "700" }}>Invest Pahang</Text>
  37. <Text style={{ fontWeight: "700" }}>ID No : Ariffudin@PSK</Text>
  38. </View>
  39. </View>
  40. <Text style={{ fontWeight: "700", marginBottom:10 }}>Muhammad Ariffudin is working from home today</Text>
  41. <View style={{flexDirection:"row"}}>
  42. {(result) ?
  43. <Text style={[fonts.titleSmall, {color:colors.primary}]}><Icon name="done" size={20} style={{verticalAlign:"middle", marginEnd:10}} />Request Accepted</Text> :
  44. <Text style={[fonts.titleSmall, {color:colors.error}]}><Icon name="close" size={20} style={{verticalAlign:"middle", marginEnd:10}} />Request Decline</Text>
  45. }
  46. </View>
  47. </View>
  48. )
  49. }
  50. return (
  51. <View style={[styles.container, { backgroundColor: colors.background }]}>
  52. <Appbar.Header>
  53. <Avatar.Image size={50} source={dpuser}></Avatar.Image>
  54. <View style={styles.titleContainer}>
  55. <Appbar.Content title="Request" titleStyle={[fonts.titleLarge, styles.title]} />
  56. </View>
  57. {/* Menu Component */}
  58. <Menu
  59. visible={menuVisible}
  60. onDismiss={() => setMenuVisible(false)}
  61. anchor={
  62. <Appbar.Action icon="dots-vertical" onPress={() => setMenuVisible(true)} />
  63. }
  64. >
  65. <Menu.Item onPress={() => console.log('Profile Clicked')} title="Profile" />
  66. <Menu.Item onPress={() => console.log('Settings Clicked')} title="Settings" />
  67. <Menu.Item onPress={() => console.log('Logout Clicked')} title="Logout" />
  68. </Menu>
  69. </Appbar.Header>
  70. <View style={styles.tabContainer}>
  71. <Text style={[styles.tabButton, fonts.titleMedium, { fontWeight: "bold" }]}>General </Text>
  72. <Text style={[styles.tabButton, fonts.titleMedium, { fontWeight: "bold" }, { borderBottomWidth: 2, borderBottomColor: colors.secondary, color: colors.secondary }]}>Request <Text style={styles.badge}>1</Text></Text>
  73. </View>
  74. <View style={styles.searchSection}>
  75. <TextInput
  76. style={styles.input}
  77. placeholder="Search"
  78. onChangeText={setSearchInput}
  79. value={searchInput}
  80. underlineColorAndroid="transparent"
  81. placeholderTextColor="#D9D9D9"
  82. />
  83. <Icon name="search" size={20} color="#888" style={styles.icon} />
  84. </View>
  85. <View style={{flex:1}}>
  86. <ScrollView>
  87. {[1,2].map(() => renderNotificationAction())}
  88. {[1].map(() => renderNotificationResult(true))}
  89. {[1].map(() => renderNotificationResult(false))}
  90. </ScrollView>
  91. </View>
  92. </View>
  93. );
  94. };
  95. const styles = StyleSheet.create({
  96. container: {
  97. flex: 1,
  98. padding: 20,
  99. width: '100%',
  100. },
  101. badge: {
  102. backgroundColor: "#BB5C3F",
  103. color: "#FFF",
  104. borderRadius: 100,
  105. paddingVertical: 4,
  106. paddingHorizontal: 6,
  107. fontSize: 10,
  108. fontWeight: "400",
  109. verticalAlign: "middle",
  110. marginStart: 5
  111. },
  112. tabContainer: {
  113. flexDirection: "row",
  114. marginBottom: 20
  115. },
  116. tabButton: {
  117. fontWeight: "bold",
  118. paddingVertical: 15,
  119. width: "50%",
  120. textAlign: "center",
  121. active: {
  122. borderBottomWidth: 2,
  123. }
  124. },
  125. titleContainer: {
  126. flex: 1,
  127. alignItems: 'center',
  128. },
  129. title: {
  130. fontWeight: 'bold',
  131. },
  132. searchSection: {
  133. flexDirection: 'row',
  134. justifyContent: 'center',
  135. alignItems: 'center',
  136. marginBottom: 20
  137. },
  138. icon: {
  139. padding: 10,
  140. position: "absolute",
  141. right: 10,
  142. color: "#D9D9D9"
  143. },
  144. input: {
  145. height: 40,
  146. flex: 1,
  147. borderWidth: 1,
  148. paddingVertical: 10,
  149. paddingHorizontal: 20,
  150. borderRadius: 100,
  151. borderColor: "#C0CFD0"
  152. }
  153. });
  154. export default Request;