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.

Notification.jsx 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 Notification = () => {
  7. const { colors, fonts } = useTheme();
  8. const [menuVisible, setMenuVisible] = useState(false);
  9. const [inputContent, setInputContent] = useState("");
  10. const preTextClick = (pretext) => {
  11. setInputContent(pretext)
  12. }
  13. return (
  14. <View style={[styles.container, { backgroundColor: colors.background }]}>
  15. <Appbar.Header>
  16. <Avatar.Image size={50} source={dpuser}></Avatar.Image>
  17. <View style={styles.titleContainer}>
  18. <Appbar.Content title="Send Notification" titleStyle={[fonts.titleLarge, styles.title]} />
  19. </View>
  20. {/* Menu Component */}
  21. <Menu
  22. visible={menuVisible}
  23. onDismiss={() => setMenuVisible(false)}
  24. anchor={
  25. <Appbar.Action icon="dots-vertical" onPress={() => setMenuVisible(true)} />
  26. }
  27. >
  28. <Menu.Item onPress={() => console.log('Profile Clicked')} title="Profile" />
  29. <Menu.Item onPress={() => console.log('Settings Clicked')} title="Settings" />
  30. <Menu.Item onPress={() => console.log('Logout Clicked')} title="Logout" />
  31. </Menu>
  32. </Appbar.Header>
  33. <View style={{ flex: 1, marginTop: 20 }}>
  34. <View style={{ flexDirection: "row", gap: 20, marginBottom: 20 }}>
  35. <Text style={[fonts.titleLarge, { fontWeight: "bold" }]}>To :</Text>
  36. <TextInput value='asd' style={{ flex: 1, paddingHorizontal: 20, borderBottomColor: "rgba(0,0,0,0.2)", borderBottomWidth: 1, marginEnd: 20 }}></TextInput>
  37. </View>
  38. <TextInput
  39. style={styles.textArea}
  40. value={inputContent}
  41. onChangeText={setInputContent}
  42. multiline={true} // Enables multi-line input
  43. numberOfLines={8} // Sets an initial number of visible lines
  44. />
  45. <Text style={[fonts.titleLarge, { fontWeight: "bold", marginBottom:20 }]}>Select Pretext</Text>
  46. <View style={{flex:1}}>
  47. {[
  48. "Request to Work From Home",
  49. "Request for late Check In",
  50. "Request for early Check Out",
  51. "Notify for Annual Leave",
  52. "Notify for Emergency Leave"
  53. ].map(text => <Text onPress={()=>{preTextClick(text)}} style={[fonts.titleMedium, {marginBottom:20, fontWeight:"bold", color:colors.secondary}]} >{text}</Text> )}
  54. </View>
  55. </View>
  56. </View>
  57. );
  58. };
  59. const styles = StyleSheet.create({
  60. container: {
  61. flex: 1,
  62. padding: 20,
  63. width: '100%',
  64. },
  65. textArea: {
  66. height: 220,
  67. borderColor: "#ccc",
  68. borderWidth: 1,
  69. padding: 10,
  70. borderRadius: 8,
  71. textAlignVertical: "top", // Makes text start from the top-left
  72. backgroundColor: "#fff",
  73. marginBottom:20
  74. },
  75. badge: {
  76. backgroundColor: "#BB5C3F",
  77. color: "#FFF",
  78. borderRadius: 100,
  79. paddingVertical: 4,
  80. paddingHorizontal: 6,
  81. fontSize: 10,
  82. fontWeight: "400",
  83. verticalAlign: "middle",
  84. marginStart: 5
  85. },
  86. titleContainer: {
  87. flex: 1,
  88. alignItems: 'center',
  89. },
  90. title: {
  91. fontWeight: 'bold',
  92. },
  93. icon: {
  94. padding: 10,
  95. position: "absolute",
  96. right: 10,
  97. color: "#D9D9D9"
  98. }
  99. });
  100. export default Notification;