react-native-resource-calendar 1.0.21 → 1.0.23
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/dist/index.js +19 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -362,7 +362,6 @@ var TimeLabels = React19__namespace.forwardRef(({
|
|
|
362
362
|
const isToday = dateFns.isSameDay(/* @__PURE__ */ new Date(), date);
|
|
363
363
|
const [currentTimeYPosition, setCurrentTimeYPosition] = React19.useState(timeToYPosition(getCurrentTimeInMinutes(timezone), hourHeight));
|
|
364
364
|
const [currentTime, setCurrentTime] = React19.useState(dateFns.format(dateFnsTz.toZonedTime(/* @__PURE__ */ new Date(), timezone), "h:mm"));
|
|
365
|
-
const APPOINTMENT_BLOCK_HEIGHT = hourHeight / 4;
|
|
366
365
|
const updateCurrentTimeYPosition = () => {
|
|
367
366
|
setCurrentTimeYPosition(timeToYPosition(getCurrentTimeInMinutes(timezone), hourHeight));
|
|
368
367
|
};
|
|
@@ -379,22 +378,6 @@ var TimeLabels = React19__namespace.forwardRef(({
|
|
|
379
378
|
const intervalId = setInterval(update, 300);
|
|
380
379
|
return () => clearInterval(intervalId);
|
|
381
380
|
}, [timezone]);
|
|
382
|
-
const lastScrolledDateRef = React19.useRef(null);
|
|
383
|
-
React19.useEffect(() => {
|
|
384
|
-
if (!layout) return;
|
|
385
|
-
const dateKey = date.getTime();
|
|
386
|
-
if (lastScrolledDateRef.current === dateKey) return;
|
|
387
|
-
reactNative.InteractionManager.runAfterInteractions(() => {
|
|
388
|
-
let pos = isToday ? currentTimeYPosition - 240 : timeToYPosition(startMinutes, hourHeight);
|
|
389
|
-
if (ref.current) {
|
|
390
|
-
ref.current.scrollTo({
|
|
391
|
-
y: Math.round(pos / APPOINTMENT_BLOCK_HEIGHT) * APPOINTMENT_BLOCK_HEIGHT,
|
|
392
|
-
animated: true
|
|
393
|
-
});
|
|
394
|
-
lastScrolledDateRef.current = dateKey;
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
}, [layout, date, isToday, APPOINTMENT_BLOCK_HEIGHT, startMinutes, hourHeight, currentTimeYPosition]);
|
|
398
381
|
return /* @__PURE__ */ React19__namespace.createElement(React19__namespace.Fragment, null, /* @__PURE__ */ React19__namespace.createElement(Col_default, null, Array.from({ length: 24 }).map((_, index) => /* @__PURE__ */ React19__namespace.createElement(reactNative.View, { key: index, style: [styles.timeLabel, { height: hourHeight }] }, /* @__PURE__ */ React19__namespace.createElement(
|
|
399
382
|
reactNative.Text,
|
|
400
383
|
{
|
|
@@ -1367,7 +1350,7 @@ var CalendarInner = (props) => {
|
|
|
1367
1350
|
const {
|
|
1368
1351
|
date,
|
|
1369
1352
|
numberOfColumns: numberOfColumnsProp = 3,
|
|
1370
|
-
startMinutes,
|
|
1353
|
+
startMinutes = 0,
|
|
1371
1354
|
hourHeight = 120,
|
|
1372
1355
|
snapIntervalInMinutes = 5,
|
|
1373
1356
|
timezone = Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone,
|
|
@@ -1472,7 +1455,7 @@ var CalendarInner = (props) => {
|
|
|
1472
1455
|
}, [selectedEvent, setSelectedEvent, setDraggedEventDraft]);
|
|
1473
1456
|
React19.useEffect(() => {
|
|
1474
1457
|
scrollX.value = 0;
|
|
1475
|
-
}, [mode]);
|
|
1458
|
+
}, [mode, numberOfColumns]);
|
|
1476
1459
|
const verticalScrollViewRef = Animated2.useAnimatedRef();
|
|
1477
1460
|
const headerScrollViewRef = Animated2.useAnimatedRef();
|
|
1478
1461
|
const flashListRef = React19.useRef(null);
|
|
@@ -1786,6 +1769,22 @@ var CalendarInner = (props) => {
|
|
|
1786
1769
|
React19.useEffect(() => {
|
|
1787
1770
|
dateRef.current = date;
|
|
1788
1771
|
}, [date]);
|
|
1772
|
+
const lastScrolledDateRef = React19.useRef(null);
|
|
1773
|
+
React19.useEffect(() => {
|
|
1774
|
+
if (!layout) return;
|
|
1775
|
+
const isToday = dateFns.isSameDay(/* @__PURE__ */ new Date(), date);
|
|
1776
|
+
const APPOINTMENT_BLOCK_HEIGHT = hourHeight / 4;
|
|
1777
|
+
const dateKey = date.getTime();
|
|
1778
|
+
const currentTimeYPosition = timeToYPosition(getCurrentTimeInMinutes(timezone), hourHeight);
|
|
1779
|
+
if (lastScrolledDateRef.current === dateKey) return;
|
|
1780
|
+
let pos = isToday ? currentTimeYPosition - 240 : timeToYPosition(startMinutes, hourHeight);
|
|
1781
|
+
const y = Math.round(pos / APPOINTMENT_BLOCK_HEIGHT) * APPOINTMENT_BLOCK_HEIGHT;
|
|
1782
|
+
Animated2.runOnUI((yVal) => {
|
|
1783
|
+
"worklet";
|
|
1784
|
+
Animated2.scrollTo(verticalScrollViewRef, 0, yVal, true);
|
|
1785
|
+
})(y);
|
|
1786
|
+
lastScrolledDateRef.current = dateKey;
|
|
1787
|
+
}, [layout, date, startMinutes, hourHeight]);
|
|
1789
1788
|
const renderItem = React19.useCallback(({ item, index }) => {
|
|
1790
1789
|
const rid = !isMultiDay ? item : activeResourceId ?? resourceIds[0];
|
|
1791
1790
|
const dayDate = !isMultiDay ? void 0 : item.dayDate;
|
|
@@ -1844,7 +1843,7 @@ var CalendarInner = (props) => {
|
|
|
1844
1843
|
stableOnDisabledBlockPress,
|
|
1845
1844
|
dateRef
|
|
1846
1845
|
]);
|
|
1847
|
-
return /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, null, /* @__PURE__ */ React19__namespace.default.createElement(StoreFeeder, { resources, store: binding, baseDate: date }), /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: { flex: 1 } }, !isMultiDay ? /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View,
|
|
1846
|
+
return /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, null, /* @__PURE__ */ React19__namespace.default.createElement(StoreFeeder, { resources, store: binding, baseDate: date }), /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: { flex: 1 } }, !isMultiDay ? /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { key: `header-${numberOfColumns}-${width}` }, /* @__PURE__ */ React19__namespace.default.createElement(
|
|
1848
1847
|
Animated2__default.default.ScrollView,
|
|
1849
1848
|
{
|
|
1850
1849
|
style: { backgroundColor: "white" },
|