react-native-resource-calendar 1.1.13 → 1.1.14
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 +47 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1384,10 +1384,6 @@ var CalendarInner = (props) => {
|
|
|
1384
1384
|
const internalOnLongPress = useRef(null);
|
|
1385
1385
|
const onDisabledBlockPressRef = React19__default.useRef(onDisabledBlockPress);
|
|
1386
1386
|
onDisabledBlockPressRef.current = onDisabledBlockPress;
|
|
1387
|
-
const selectedRef = useRef(props.isEventSelected);
|
|
1388
|
-
selectedRef.current = props.isEventSelected;
|
|
1389
|
-
const disabledRef = useRef(props.isEventDisabled);
|
|
1390
|
-
disabledRef.current = props.isEventDisabled;
|
|
1391
1387
|
const effectiveRenderer = useMemo(() => {
|
|
1392
1388
|
return (p) => /* @__PURE__ */ React19__default.createElement(
|
|
1393
1389
|
EventBlock_default,
|
|
@@ -1399,16 +1395,13 @@ var CalendarInner = (props) => {
|
|
|
1399
1395
|
);
|
|
1400
1396
|
}, [eventSlots, eventStyleOverrides]);
|
|
1401
1397
|
const isEventSelectedStable = useCallback(
|
|
1402
|
-
(ev) =>
|
|
1403
|
-
[]
|
|
1398
|
+
(ev) => props.isEventSelected?.(ev) ?? false,
|
|
1399
|
+
[props.isEventSelected]
|
|
1404
1400
|
);
|
|
1405
1401
|
const isEventDisabledStable = useCallback(
|
|
1406
|
-
(ev) =>
|
|
1407
|
-
[]
|
|
1402
|
+
(ev) => props.isEventDisabled?.(ev) ?? false,
|
|
1403
|
+
[props.isEventDisabled]
|
|
1408
1404
|
);
|
|
1409
|
-
const rendererRef = useRef(effectiveRenderer);
|
|
1410
|
-
rendererRef.current = effectiveRenderer;
|
|
1411
|
-
const stableRenderer = useCallback((p) => rendererRef.current(p), []);
|
|
1412
1405
|
const stableOnPress = React19__default.useCallback((e) => onPressRef.current?.(e), []);
|
|
1413
1406
|
const stableOnDisabledBlockPress = React19__default.useCallback((b) => onDisabledBlockPressRef.current?.(b), []);
|
|
1414
1407
|
const { useGetSelectedEvent: useGetSelectedEvent2, useSetSelectedEvent: useSetSelectedEvent2, useSetDraggedEventDraft: useSetDraggedEventDraft2, useGetDraggedEventDraft: useGetDraggedEventDraft2 } = useCalendarBinding();
|
|
@@ -1476,6 +1469,8 @@ var CalendarInner = (props) => {
|
|
|
1476
1469
|
},
|
|
1477
1470
|
[enableHapticFeedback]
|
|
1478
1471
|
);
|
|
1472
|
+
const triggerHapticRef = useRef(triggerHaptic);
|
|
1473
|
+
triggerHapticRef.current = triggerHaptic;
|
|
1479
1474
|
const resourceIds = useMemo(() => {
|
|
1480
1475
|
const ids = resources?.map((item) => item?.id) || [];
|
|
1481
1476
|
if (JSON.stringify(prevResourceIdsRef.current) !== JSON.stringify(ids)) {
|
|
@@ -1709,7 +1704,7 @@ var CalendarInner = (props) => {
|
|
|
1709
1704
|
date: event.date
|
|
1710
1705
|
});
|
|
1711
1706
|
requestAnimationFrame(() => setDragReady(true));
|
|
1712
|
-
|
|
1707
|
+
triggerHapticRef.current("Medium");
|
|
1713
1708
|
};
|
|
1714
1709
|
}, []);
|
|
1715
1710
|
const internalStableOnLongPress = useCallback((e) => {
|
|
@@ -1744,6 +1739,18 @@ var CalendarInner = (props) => {
|
|
|
1744
1739
|
if (onBlockTap)
|
|
1745
1740
|
onBlockTap(resource, new Date(time));
|
|
1746
1741
|
}, [resources, onBlockTap]);
|
|
1742
|
+
const handleBlockPressRef = useRef(handleBlockPress);
|
|
1743
|
+
handleBlockPressRef.current = handleBlockPress;
|
|
1744
|
+
const stableHandleBlockPress = useCallback(
|
|
1745
|
+
(resourceId, time) => handleBlockPressRef.current(resourceId, time),
|
|
1746
|
+
[]
|
|
1747
|
+
);
|
|
1748
|
+
const handleBlockLongPressRef = useRef(handleBlockLongPress);
|
|
1749
|
+
handleBlockLongPressRef.current = handleBlockLongPress;
|
|
1750
|
+
const stableHandleBlockLongPress = useCallback(
|
|
1751
|
+
(resourceId, time) => handleBlockLongPressRef.current(resourceId, time),
|
|
1752
|
+
[]
|
|
1753
|
+
);
|
|
1747
1754
|
useEffect(() => {
|
|
1748
1755
|
const handleOrientationChange = () => {
|
|
1749
1756
|
if (selectedEvent) {
|
|
@@ -1764,8 +1771,8 @@ var CalendarInner = (props) => {
|
|
|
1764
1771
|
{
|
|
1765
1772
|
hourHeight,
|
|
1766
1773
|
APPOINTMENT_BLOCK_WIDTH,
|
|
1767
|
-
handleBlockPress: (time) =>
|
|
1768
|
-
handleBlockLongPress: (time) =>
|
|
1774
|
+
handleBlockPress: (time) => stableHandleBlockPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time)),
|
|
1775
|
+
handleBlockLongPress: (time) => stableHandleBlockLongPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time))
|
|
1769
1776
|
}
|
|
1770
1777
|
), /* @__PURE__ */ React19__default.createElement(
|
|
1771
1778
|
DisabledIntervals_default,
|
|
@@ -1795,7 +1802,7 @@ var CalendarInner = (props) => {
|
|
|
1795
1802
|
onLongPress: internalStableOnLongPress,
|
|
1796
1803
|
isEventSelected: isEventSelectedStable,
|
|
1797
1804
|
isEventDisabled: isEventDisabledStable,
|
|
1798
|
-
eventRenderer:
|
|
1805
|
+
eventRenderer: effectiveRenderer,
|
|
1799
1806
|
mode: overLappingLayoutMode
|
|
1800
1807
|
}
|
|
1801
1808
|
)));
|
|
@@ -1805,14 +1812,36 @@ var CalendarInner = (props) => {
|
|
|
1805
1812
|
resourceIds,
|
|
1806
1813
|
APPOINTMENT_BLOCK_WIDTH,
|
|
1807
1814
|
hourHeight,
|
|
1808
|
-
|
|
1815
|
+
effectiveRenderer,
|
|
1809
1816
|
isEventSelectedStable,
|
|
1810
1817
|
isEventDisabledStable,
|
|
1811
1818
|
overLappingLayoutMode,
|
|
1812
1819
|
stableOnPress,
|
|
1813
1820
|
internalStableOnLongPress,
|
|
1814
|
-
stableOnDisabledBlockPress
|
|
1821
|
+
stableOnDisabledBlockPress,
|
|
1822
|
+
stableHandleBlockPress,
|
|
1823
|
+
stableHandleBlockLongPress
|
|
1815
1824
|
]);
|
|
1825
|
+
const listExtraData = useMemo(
|
|
1826
|
+
() => ({
|
|
1827
|
+
numberOfColumns,
|
|
1828
|
+
width,
|
|
1829
|
+
hourHeight,
|
|
1830
|
+
stacked: overLappingLayoutMode === "stacked",
|
|
1831
|
+
isEventSelectedStable,
|
|
1832
|
+
isEventDisabledStable,
|
|
1833
|
+
effectiveRenderer
|
|
1834
|
+
}),
|
|
1835
|
+
[
|
|
1836
|
+
numberOfColumns,
|
|
1837
|
+
width,
|
|
1838
|
+
hourHeight,
|
|
1839
|
+
overLappingLayoutMode,
|
|
1840
|
+
isEventSelectedStable,
|
|
1841
|
+
isEventDisabledStable,
|
|
1842
|
+
effectiveRenderer
|
|
1843
|
+
]
|
|
1844
|
+
);
|
|
1816
1845
|
return /* @__PURE__ */ React19__default.createElement(React19__default.Fragment, null, /* @__PURE__ */ React19__default.createElement(StoreFeeder, { resources, store: binding, baseDate: date }), /* @__PURE__ */ React19__default.createElement(View, { style: { flex: 1 } }, !isMultiDay ? /* @__PURE__ */ React19__default.createElement(View, { key: `header-${numberOfColumns}-${width}` }, /* @__PURE__ */ React19__default.createElement(
|
|
1817
1846
|
Animated2.ScrollView,
|
|
1818
1847
|
{
|
|
@@ -1896,7 +1925,7 @@ var CalendarInner = (props) => {
|
|
|
1896
1925
|
/* @__PURE__ */ React19__default.createElement(
|
|
1897
1926
|
AnimatedFlashList,
|
|
1898
1927
|
{
|
|
1899
|
-
extraData:
|
|
1928
|
+
extraData: listExtraData,
|
|
1900
1929
|
scrollEnabled: !selectedEvent,
|
|
1901
1930
|
ref: flashListRef,
|
|
1902
1931
|
onScroll: flashListScrollHandler,
|