react-native-resource-calendar 1.0.3 → 1.0.5
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 +37 -3
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -17,6 +17,11 @@ Expo compatibility.
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
+
## 🎬 Demo
|
|
21
|
+
https://github.com/user-attachments/assets/48841509-c801-4d77-948b-f108ff57ad34
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
20
25
|
## 📦 Installation
|
|
21
26
|
|
|
22
27
|
```bash
|
|
@@ -25,12 +30,39 @@ npm install react-native-resource-calendar
|
|
|
25
30
|
yarn add react-native-resource-calendar
|
|
26
31
|
```
|
|
27
32
|
|
|
28
|
-
##
|
|
33
|
+
## ⚙️ Peer Dependencies
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
This library relies on several React Native ecosystem packages that must be installed in your app.
|
|
36
|
+
If you’re using Expo, run the following to ensure compatible versions:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx expo install \
|
|
40
|
+
react-native-gesture-handler \
|
|
41
|
+
react-native-reanimated \
|
|
42
|
+
react-native-svg \
|
|
43
|
+
@shopify/flash-list \
|
|
44
|
+
@shopify/react-native-skia \
|
|
45
|
+
expo-haptics
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If you’re using bare React Native (not Expo), install them manually:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install \
|
|
52
|
+
react-native-gesture-handler \
|
|
53
|
+
react-native-reanimated \
|
|
54
|
+
react-native-svg \
|
|
55
|
+
@shopify/flash-list \
|
|
56
|
+
@shopify/react-native-skia \
|
|
57
|
+
expo-haptics
|
|
58
|
+
```
|
|
31
59
|
|
|
32
60
|
---
|
|
33
61
|
|
|
62
|
+
## 🚀 Quick Start
|
|
63
|
+
|
|
64
|
+
Follow these steps to get started quickly with **React Native Resource Calendar**.
|
|
65
|
+
|
|
34
66
|
### 1️⃣ Wrap your app with CalendarBindingProvider
|
|
35
67
|
|
|
36
68
|
### 2️⃣ Feed the Calendar component with resources and events
|
|
@@ -262,6 +294,8 @@ export default function App() {
|
|
|
262
294
|
}
|
|
263
295
|
```
|
|
264
296
|
|
|
297
|
+
---
|
|
298
|
+
|
|
265
299
|
## ⚙️ Calendar Props
|
|
266
300
|
|
|
267
301
|
The `Calendar` component accepts a flexible set of props for customizing layout, theme, and interactivity.
|
|
@@ -338,4 +372,4 @@ type CalendarTheme = {
|
|
|
338
372
|
fontFamily?: string;
|
|
339
373
|
};
|
|
340
374
|
};
|
|
341
|
-
```
|
|
375
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -694,7 +694,7 @@ function StaffAvatar({
|
|
|
694
694
|
width: circleSize,
|
|
695
695
|
backgroundColor: avatarColor || "#C9E5E8",
|
|
696
696
|
overflow: "hidden"
|
|
697
|
-
} }, image ? /* @__PURE__ */ React18__namespace.createElement(
|
|
697
|
+
} }, !image ? /* @__PURE__ */ React18__namespace.createElement(
|
|
698
698
|
reactNative.Image,
|
|
699
699
|
{
|
|
700
700
|
resizeMode: "cover",
|
|
@@ -712,10 +712,11 @@ function StaffAvatar({
|
|
|
712
712
|
style: {
|
|
713
713
|
fontFamily: titleFace,
|
|
714
714
|
fontSize,
|
|
715
|
-
color: textColor || "#4d959c"
|
|
715
|
+
color: textColor || "#4d959c",
|
|
716
|
+
lineHeight: circleSize
|
|
716
717
|
}
|
|
717
718
|
},
|
|
718
|
-
name ? name.split(" ").map((n) => n[0]).join("") : ""
|
|
719
|
+
name ? name.split(" ").map((n) => n[0]).join("").slice(0, 2) : ""
|
|
719
720
|
))))
|
|
720
721
|
);
|
|
721
722
|
}
|
|
@@ -770,7 +771,16 @@ var EventGridBlocksSkia = ({
|
|
|
770
771
|
const onTouchesUp = React18__namespace.useCallback(() => {
|
|
771
772
|
setPressedRow(null);
|
|
772
773
|
}, []);
|
|
773
|
-
const longPressGesture = reactNativeGestureHandler.Gesture.LongPress().onBegin((e) =>
|
|
774
|
+
const longPressGesture = reactNativeGestureHandler.Gesture.LongPress().onBegin((e) => {
|
|
775
|
+
"worklet";
|
|
776
|
+
Animated2.runOnJS(onPressBegin)(Math.floor(e.y / rowHeight));
|
|
777
|
+
}).onEnd((e) => {
|
|
778
|
+
"worklet";
|
|
779
|
+
Animated2.runOnJS(onSlotPress)(Math.floor(e.y / rowHeight));
|
|
780
|
+
}).onFinalize(() => {
|
|
781
|
+
"worklet";
|
|
782
|
+
Animated2.runOnJS(onTouchesUp)();
|
|
783
|
+
});
|
|
774
784
|
return /* @__PURE__ */ React18__namespace.createElement(reactNativeGestureHandler.GestureDetector, { gesture: longPressGesture }, /* @__PURE__ */ React18__namespace.createElement(reactNative.View, null, /* @__PURE__ */ React18__namespace.createElement(reactNativeSkia.Canvas, { style: { width: APPOINTMENT_BLOCK_WIDTH, height: segmentHeight } }, firstRects.map(({ x, y, width: w, height: h, row }, idx) => /* @__PURE__ */ React18__namespace.createElement(React18__namespace.Fragment, { key: idx }, /* @__PURE__ */ React18__namespace.createElement(
|
|
775
785
|
reactNativeSkia.Rect,
|
|
776
786
|
{
|
|
@@ -1335,11 +1345,13 @@ var CalendarInner = (props) => {
|
|
|
1335
1345
|
Haptics__namespace.impactAsync(Haptics__namespace.ImpactFeedbackStyle.Light);
|
|
1336
1346
|
}, []);
|
|
1337
1347
|
const panGesture = reactNativeGestureHandler.Gesture.Pan().manualActivation(!isIOS).enabled(layout !== null).shouldCancelWhenOutside(false).onTouchesMove((_evt, stateManager) => {
|
|
1348
|
+
"worklet";
|
|
1338
1349
|
if (isIOS) return;
|
|
1339
1350
|
if (selectedEvent)
|
|
1340
1351
|
stateManager.activate();
|
|
1341
1352
|
else stateManager.end();
|
|
1342
1353
|
}).onUpdate((evt) => {
|
|
1354
|
+
"worklet";
|
|
1343
1355
|
if (!evt || evt.y == null || evt.x == null) return;
|
|
1344
1356
|
let draggable = false;
|
|
1345
1357
|
let pullable = false;
|
|
@@ -1428,6 +1440,7 @@ var CalendarInner = (props) => {
|
|
|
1428
1440
|
}
|
|
1429
1441
|
}
|
|
1430
1442
|
}).onEnd(() => {
|
|
1443
|
+
"worklet";
|
|
1431
1444
|
autoScrollSpeed.value = 0;
|
|
1432
1445
|
autoScrollXSpeed.value = 0;
|
|
1433
1446
|
lastXScrollTime.value = 0;
|