Advertisement
RupeshAcharya60

calendar react native

Jun 30th, 2024
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. <Calendar
  2. dayComponent={({ date, state, marking }) => {
  3. const timeSheet = data.timesheets.find(
  4. (timesheet: any) => timesheet.duty_start_time == date.dateString
  5. );
  6. let backgroundColor = "";
  7.  
  8. if (timeSheet) {
  9. switch (timeSheet.is_absent) {
  10. case true:
  11. backgroundColor = "$red5Light";
  12. break;
  13. case false:
  14. backgroundColor = "$green5Light";
  15. break;
  16. default:
  17. backgroundColor = "$green5Light";
  18. }
  19. }
  20.  
  21. return (
  22. <View>
  23. {/* <Circle
  24. size={45}
  25. backgroundColor={backgroundColor}
  26. elevation="$4"
  27. > */}
  28. <YStack
  29. alignContent="center"
  30. justifyContent="center"
  31. alignItems="center"
  32. >
  33. <Text>{date.day}</Text>
  34. <Text fontSize={11}>{timeSheet ? timeSheet.client : ""}</Text>
  35. </YStack>
  36. {/* </Circle> */}
  37. </View>
  38. );
  39. }}
  40. style={{
  41. borderWidth: 1,
  42. borderColor: "gray",
  43. // height: 300,
  44. width: 350,
  45. }}
  46. markedDates={{
  47. "2024-06-16": {
  48. selected: true,
  49. marked: true,
  50. selectedColor: "blue",
  51. textColor: "green",
  52. },
  53. "2024-06-17": { marked: true },
  54. "2024-06-18": {
  55. selected: true,
  56. marked: true,
  57. dotColor: "white",
  58. activeOpacity: 0,
  59. selectedColor: "red",
  60. },
  61. "2024-06-19": { disableTouchEvent: true },
  62. }}
  63. />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement