react-native-calendar-resource 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -6
- package/dist/components/calendar/CalendarHeader.d.ts.map +1 -1
- package/dist/components/calendar/CalendarHeader.js +2 -3
- package/dist/components/calendar/GridBody.d.ts.map +1 -1
- package/dist/components/calendar/GridBody.js +2 -3
- package/package.json +7 -3
- package/dist/components/calendar/dateUtils.d.ts +0 -37
- package/dist/components/calendar/dateUtils.d.ts.map +0 -1
- package/dist/components/calendar/dateUtils.js +0 -128
package/README.md
CHANGED
|
@@ -295,12 +295,6 @@ interface BookingData {
|
|
|
295
295
|
|
|
296
296
|
MIT
|
|
297
297
|
|
|
298
|
-
- The tab bar remains visible while navigating deeper into Explore-related screens
|
|
299
|
-
- Navigation context is preserved
|
|
300
|
-
- Platform-native gestures and transitions are maintained
|
|
301
|
-
|
|
302
|
-
Headers are disabled at the stack level and selectively enabled per screen to match the Figma design and avoid default iOS -Liquid Glass- system back button styling.
|
|
303
|
-
|
|
304
298
|
---
|
|
305
299
|
|
|
306
300
|
**Author:** Abdelrahman Sobhy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarHeader.d.ts","sourceRoot":"","sources":["../../../components/calendar/CalendarHeader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CalendarHeader.d.ts","sourceRoot":"","sources":["../../../components/calendar/CalendarHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,kBAAkB,CAAC;IAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,kBAAyB,EACzB,UAA+B,EAC/B,OAAO,EACP,OAAO,EACP,cAAqB,GACtB,EAAE,mBAAmB,+BAoIrB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MaterialIcons } from "@expo/vector-icons";
|
|
2
1
|
import { addDays, format, subDays } from "date-fns";
|
|
3
2
|
import { Pressable, Text, View } from "react-native";
|
|
4
3
|
export function CalendarHeader({ date, timeConfig, onDateChange, showDateNavigation = true, dateFormat = "EEE, MMM d, yyyy", minDate, maxDate, allowPastDates = true, }) {
|
|
@@ -90,7 +89,7 @@ export function CalendarHeader({ date, timeConfig, onDateChange, showDateNavigat
|
|
|
90
89
|
justifyContent: "center",
|
|
91
90
|
backgroundColor: "rgba(38, 38, 38, 0.75)",
|
|
92
91
|
}}>
|
|
93
|
-
<
|
|
92
|
+
<Text style={{ color: prevDisabled ? "#626262" : "#fefefe", fontSize: 24, fontWeight: "bold" }}>‹</Text>
|
|
94
93
|
</Pressable>
|
|
95
94
|
<Text style={{ color: "#fefefe", fontSize: 16, fontWeight: "600" }}>
|
|
96
95
|
{format(date, dateFormat)}
|
|
@@ -103,7 +102,7 @@ export function CalendarHeader({ date, timeConfig, onDateChange, showDateNavigat
|
|
|
103
102
|
alignItems: "center",
|
|
104
103
|
justifyContent: "center",
|
|
105
104
|
}}>
|
|
106
|
-
<
|
|
105
|
+
<Text style={{ color: nextDisabled ? "#626262" : "#fefefe", fontSize: 24, fontWeight: "bold" }}>›</Text>
|
|
107
106
|
</Pressable>
|
|
108
107
|
</>) : (<Text style={{ color: '#fefefe', fontSize: 16, fontWeight: '600' }}>
|
|
109
108
|
{format(date, dateFormat)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridBody.d.ts","sourceRoot":"","sources":["../../../components/calendar/GridBody.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GridBody.d.ts","sourceRoot":"","sources":["../../../components/calendar/GridBody.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,KAAK,aAAa,CAAC,MAAM,GAAG,GAAG,EAAE,SAAS,GAAG,GAAG,EAAE,YAAY,GAAG,GAAG,IAAI;IACtE,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;IACjC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;IAChC,gBAAgB,EAAE,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;IAClD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACrE,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE,SAAS,GAAG,GAAG,EAAE,YAAY,GAAG,GAAG,EAAE,EAC1E,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,GACP,EAAE,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,+BAgGhD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { MaterialIcons } from "@expo/vector-icons";
|
|
2
1
|
import { useMemo } from "react";
|
|
3
|
-
import { Pressable, View } from "react-native";
|
|
2
|
+
import { Pressable, Text, View } from "react-native";
|
|
4
3
|
export function GridBody({ resources, events, unavailableSlots, onSlotPress, date, timeConfig, dimensions, styles, }) {
|
|
5
4
|
const hoursArray = useMemo(() => {
|
|
6
5
|
const result = [];
|
|
@@ -62,7 +61,7 @@ export function GridBody({ resources, events, unavailableSlots, onSlotPress, dat
|
|
|
62
61
|
justifyContent: "center",
|
|
63
62
|
alignItems: "center",
|
|
64
63
|
}}>
|
|
65
|
-
<
|
|
64
|
+
<Text style={{ color: "#474747", fontSize: 20, fontWeight: "300" }}>+</Text>
|
|
66
65
|
</Pressable>);
|
|
67
66
|
})}
|
|
68
67
|
</View>))}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-calendar-resource",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A fully customizable, type-safe resource-based calendar component for React Native",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
8
|
+
"build": "tsc -p tsconfig.package.json",
|
|
9
9
|
"prepublishOnly": "npm run build",
|
|
10
10
|
"test": "echo \"No tests yet\" && exit 0"
|
|
11
11
|
},
|
|
@@ -34,5 +34,9 @@
|
|
|
34
34
|
"@types/react-native": "^0.73.0",
|
|
35
35
|
"typescript": "^5.9.2"
|
|
36
36
|
},
|
|
37
|
-
"files": [
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
]
|
|
38
42
|
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Native date utility functions to replace date-fns
|
|
3
|
-
* Zero external dependencies
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Add days to a date
|
|
7
|
-
*/
|
|
8
|
-
export declare function addDays(date: Date, days: number): Date;
|
|
9
|
-
/**
|
|
10
|
-
* Subtract days from a date
|
|
11
|
-
*/
|
|
12
|
-
export declare function subDays(date: Date, days: number): Date;
|
|
13
|
-
/**
|
|
14
|
-
* Format a date according to a format string
|
|
15
|
-
* Supports common tokens:
|
|
16
|
-
* - EEE: Short weekday name (Mon, Tue, etc.)
|
|
17
|
-
* - EEEE: Full weekday name (Monday, Tuesday, etc.)
|
|
18
|
-
* - MMM: Short month name (Jan, Feb, etc.)
|
|
19
|
-
* - MMMM: Full month name (January, February, etc.)
|
|
20
|
-
* - MM: Month as 2 digits (01-12)
|
|
21
|
-
* - M: Month as 1-2 digits (1-12)
|
|
22
|
-
* - dd: Day as 2 digits (01-31)
|
|
23
|
-
* - d: Day as 1-2 digits (1-31)
|
|
24
|
-
* - yyyy: Full year (2026)
|
|
25
|
-
* - yy: 2-digit year (26)
|
|
26
|
-
* - HH: Hour in 24h format with leading zero (00-23)
|
|
27
|
-
* - H: Hour in 24h format (0-23)
|
|
28
|
-
* - hh: Hour in 12h format with leading zero (01-12)
|
|
29
|
-
* - h: Hour in 12h format (1-12)
|
|
30
|
-
* - mm: Minutes with leading zero (00-59)
|
|
31
|
-
* - m: Minutes (0-59)
|
|
32
|
-
* - ss: Seconds with leading zero (00-59)
|
|
33
|
-
* - s: Seconds (0-59)
|
|
34
|
-
* - a: AM/PM
|
|
35
|
-
*/
|
|
36
|
-
export declare function formatDate(date: Date, formatString: string): string;
|
|
37
|
-
//# sourceMappingURL=dateUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../../components/calendar/dateUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAItD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAItD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CA+FnE"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Native date utility functions to replace date-fns
|
|
3
|
-
* Zero external dependencies
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Add days to a date
|
|
7
|
-
*/
|
|
8
|
-
export function addDays(date, days) {
|
|
9
|
-
const result = new Date(date);
|
|
10
|
-
result.setDate(result.getDate() + days);
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Subtract days from a date
|
|
15
|
-
*/
|
|
16
|
-
export function subDays(date, days) {
|
|
17
|
-
const result = new Date(date);
|
|
18
|
-
result.setDate(result.getDate() - days);
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Format a date according to a format string
|
|
23
|
-
* Supports common tokens:
|
|
24
|
-
* - EEE: Short weekday name (Mon, Tue, etc.)
|
|
25
|
-
* - EEEE: Full weekday name (Monday, Tuesday, etc.)
|
|
26
|
-
* - MMM: Short month name (Jan, Feb, etc.)
|
|
27
|
-
* - MMMM: Full month name (January, February, etc.)
|
|
28
|
-
* - MM: Month as 2 digits (01-12)
|
|
29
|
-
* - M: Month as 1-2 digits (1-12)
|
|
30
|
-
* - dd: Day as 2 digits (01-31)
|
|
31
|
-
* - d: Day as 1-2 digits (1-31)
|
|
32
|
-
* - yyyy: Full year (2026)
|
|
33
|
-
* - yy: 2-digit year (26)
|
|
34
|
-
* - HH: Hour in 24h format with leading zero (00-23)
|
|
35
|
-
* - H: Hour in 24h format (0-23)
|
|
36
|
-
* - hh: Hour in 12h format with leading zero (01-12)
|
|
37
|
-
* - h: Hour in 12h format (1-12)
|
|
38
|
-
* - mm: Minutes with leading zero (00-59)
|
|
39
|
-
* - m: Minutes (0-59)
|
|
40
|
-
* - ss: Seconds with leading zero (00-59)
|
|
41
|
-
* - s: Seconds (0-59)
|
|
42
|
-
* - a: AM/PM
|
|
43
|
-
*/
|
|
44
|
-
export function formatDate(date, formatString) {
|
|
45
|
-
const weekdaysShort = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
46
|
-
const weekdaysFull = [
|
|
47
|
-
"Sunday",
|
|
48
|
-
"Monday",
|
|
49
|
-
"Tuesday",
|
|
50
|
-
"Wednesday",
|
|
51
|
-
"Thursday",
|
|
52
|
-
"Friday",
|
|
53
|
-
"Saturday",
|
|
54
|
-
];
|
|
55
|
-
const monthsShort = [
|
|
56
|
-
"Jan",
|
|
57
|
-
"Feb",
|
|
58
|
-
"Mar",
|
|
59
|
-
"Apr",
|
|
60
|
-
"May",
|
|
61
|
-
"Jun",
|
|
62
|
-
"Jul",
|
|
63
|
-
"Aug",
|
|
64
|
-
"Sep",
|
|
65
|
-
"Oct",
|
|
66
|
-
"Nov",
|
|
67
|
-
"Dec",
|
|
68
|
-
];
|
|
69
|
-
const monthsFull = [
|
|
70
|
-
"January",
|
|
71
|
-
"February",
|
|
72
|
-
"March",
|
|
73
|
-
"April",
|
|
74
|
-
"May",
|
|
75
|
-
"June",
|
|
76
|
-
"July",
|
|
77
|
-
"August",
|
|
78
|
-
"September",
|
|
79
|
-
"October",
|
|
80
|
-
"November",
|
|
81
|
-
"December",
|
|
82
|
-
];
|
|
83
|
-
const day = date.getDate();
|
|
84
|
-
const month = date.getMonth();
|
|
85
|
-
const year = date.getFullYear();
|
|
86
|
-
const weekday = date.getDay();
|
|
87
|
-
const hours = date.getHours();
|
|
88
|
-
const minutes = date.getMinutes();
|
|
89
|
-
const seconds = date.getSeconds();
|
|
90
|
-
const pad = (num, size = 2) => {
|
|
91
|
-
return num.toString().padStart(size, "0");
|
|
92
|
-
};
|
|
93
|
-
const tokens = {
|
|
94
|
-
EEEE: weekdaysFull[weekday],
|
|
95
|
-
EEE: weekdaysShort[weekday],
|
|
96
|
-
MMMM: monthsFull[month],
|
|
97
|
-
MMM: monthsShort[month],
|
|
98
|
-
MM: pad(month + 1),
|
|
99
|
-
M: (month + 1).toString(),
|
|
100
|
-
dd: pad(day),
|
|
101
|
-
d: day.toString(),
|
|
102
|
-
yyyy: year.toString(),
|
|
103
|
-
yy: year.toString().slice(-2),
|
|
104
|
-
HH: pad(hours),
|
|
105
|
-
H: hours.toString(),
|
|
106
|
-
hh: pad(hours % 12 || 12),
|
|
107
|
-
h: (hours % 12 || 12).toString(),
|
|
108
|
-
mm: pad(minutes),
|
|
109
|
-
m: minutes.toString(),
|
|
110
|
-
ss: pad(seconds),
|
|
111
|
-
s: seconds.toString(),
|
|
112
|
-
a: hours >= 12 ? "PM" : "AM",
|
|
113
|
-
};
|
|
114
|
-
let result = formatString;
|
|
115
|
-
// Sort by length descending to replace longer tokens first (e.g., MMMM before MMM)
|
|
116
|
-
const sortedTokens = Object.keys(tokens).sort((a, b) => b.length - a.length);
|
|
117
|
-
for (const token of sortedTokens) {
|
|
118
|
-
// Use a unique placeholder to avoid re-replacement issues
|
|
119
|
-
const placeholder = `\x00${token}\x00`;
|
|
120
|
-
result = result.replace(new RegExp(token, "g"), placeholder);
|
|
121
|
-
}
|
|
122
|
-
// Replace placeholders with actual values
|
|
123
|
-
for (const token of sortedTokens) {
|
|
124
|
-
const placeholder = `\x00${token}\x00`;
|
|
125
|
-
result = result.replace(new RegExp(placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), tokens[token]);
|
|
126
|
-
}
|
|
127
|
-
return result;
|
|
128
|
-
}
|