react-native-resource-calendar 1.1.12 → 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 +52 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1409,10 +1409,6 @@ var CalendarInner = (props) => {
|
|
|
1409
1409
|
const internalOnLongPress = React19.useRef(null);
|
|
1410
1410
|
const onDisabledBlockPressRef = React19__namespace.default.useRef(onDisabledBlockPress);
|
|
1411
1411
|
onDisabledBlockPressRef.current = onDisabledBlockPress;
|
|
1412
|
-
const selectedRef = React19.useRef(props.isEventSelected);
|
|
1413
|
-
selectedRef.current = props.isEventSelected;
|
|
1414
|
-
const disabledRef = React19.useRef(props.isEventDisabled);
|
|
1415
|
-
disabledRef.current = props.isEventDisabled;
|
|
1416
1412
|
const effectiveRenderer = React19.useMemo(() => {
|
|
1417
1413
|
return (p) => /* @__PURE__ */ React19__namespace.default.createElement(
|
|
1418
1414
|
EventBlock_default,
|
|
@@ -1424,16 +1420,13 @@ var CalendarInner = (props) => {
|
|
|
1424
1420
|
);
|
|
1425
1421
|
}, [eventSlots, eventStyleOverrides]);
|
|
1426
1422
|
const isEventSelectedStable = React19.useCallback(
|
|
1427
|
-
(ev) =>
|
|
1428
|
-
[]
|
|
1423
|
+
(ev) => props.isEventSelected?.(ev) ?? false,
|
|
1424
|
+
[props.isEventSelected]
|
|
1429
1425
|
);
|
|
1430
1426
|
const isEventDisabledStable = React19.useCallback(
|
|
1431
|
-
(ev) =>
|
|
1432
|
-
[]
|
|
1427
|
+
(ev) => props.isEventDisabled?.(ev) ?? false,
|
|
1428
|
+
[props.isEventDisabled]
|
|
1433
1429
|
);
|
|
1434
|
-
const rendererRef = React19.useRef(effectiveRenderer);
|
|
1435
|
-
rendererRef.current = effectiveRenderer;
|
|
1436
|
-
const stableRenderer = React19.useCallback((p) => rendererRef.current(p), []);
|
|
1437
1430
|
const stableOnPress = React19__namespace.default.useCallback((e) => onPressRef.current?.(e), []);
|
|
1438
1431
|
const stableOnDisabledBlockPress = React19__namespace.default.useCallback((b) => onDisabledBlockPressRef.current?.(b), []);
|
|
1439
1432
|
const { useGetSelectedEvent: useGetSelectedEvent2, useSetSelectedEvent: useSetSelectedEvent2, useSetDraggedEventDraft: useSetDraggedEventDraft2, useGetDraggedEventDraft: useGetDraggedEventDraft2 } = useCalendarBinding();
|
|
@@ -1501,6 +1494,8 @@ var CalendarInner = (props) => {
|
|
|
1501
1494
|
},
|
|
1502
1495
|
[enableHapticFeedback]
|
|
1503
1496
|
);
|
|
1497
|
+
const triggerHapticRef = React19.useRef(triggerHaptic);
|
|
1498
|
+
triggerHapticRef.current = triggerHaptic;
|
|
1504
1499
|
const resourceIds = React19.useMemo(() => {
|
|
1505
1500
|
const ids = resources?.map((item) => item?.id) || [];
|
|
1506
1501
|
if (JSON.stringify(prevResourceIdsRef.current) !== JSON.stringify(ids)) {
|
|
@@ -1734,7 +1729,7 @@ var CalendarInner = (props) => {
|
|
|
1734
1729
|
date: event.date
|
|
1735
1730
|
});
|
|
1736
1731
|
requestAnimationFrame(() => setDragReady(true));
|
|
1737
|
-
|
|
1732
|
+
triggerHapticRef.current("Medium");
|
|
1738
1733
|
};
|
|
1739
1734
|
}, []);
|
|
1740
1735
|
const internalStableOnLongPress = React19.useCallback((e) => {
|
|
@@ -1769,17 +1764,30 @@ var CalendarInner = (props) => {
|
|
|
1769
1764
|
if (onBlockTap)
|
|
1770
1765
|
onBlockTap(resource, new Date(time));
|
|
1771
1766
|
}, [resources, onBlockTap]);
|
|
1767
|
+
const handleBlockPressRef = React19.useRef(handleBlockPress);
|
|
1768
|
+
handleBlockPressRef.current = handleBlockPress;
|
|
1769
|
+
const stableHandleBlockPress = React19.useCallback(
|
|
1770
|
+
(resourceId, time) => handleBlockPressRef.current(resourceId, time),
|
|
1771
|
+
[]
|
|
1772
|
+
);
|
|
1773
|
+
const handleBlockLongPressRef = React19.useRef(handleBlockLongPress);
|
|
1774
|
+
handleBlockLongPressRef.current = handleBlockLongPress;
|
|
1775
|
+
const stableHandleBlockLongPress = React19.useCallback(
|
|
1776
|
+
(resourceId, time) => handleBlockLongPressRef.current(resourceId, time),
|
|
1777
|
+
[]
|
|
1778
|
+
);
|
|
1772
1779
|
React19.useEffect(() => {
|
|
1773
1780
|
const handleOrientationChange = () => {
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1781
|
+
if (selectedEvent) {
|
|
1782
|
+
setSelectedEvent(null);
|
|
1783
|
+
setDragReady(false);
|
|
1784
|
+
}
|
|
1777
1785
|
};
|
|
1778
1786
|
const subscription = reactNative.Dimensions.addEventListener("change", handleOrientationChange);
|
|
1779
1787
|
return () => {
|
|
1780
1788
|
subscription.remove();
|
|
1781
1789
|
};
|
|
1782
|
-
}, [setSelectedEvent, setDragReady]);
|
|
1790
|
+
}, [setSelectedEvent, selectedEvent, setDragReady]);
|
|
1783
1791
|
const renderItem = React19.useCallback(({ item, index }) => {
|
|
1784
1792
|
const rid = !isMultiDay ? item : activeResourceId ?? resourceIds[0];
|
|
1785
1793
|
const dayDate = !isMultiDay ? void 0 : item.dayDate;
|
|
@@ -1788,8 +1796,8 @@ var CalendarInner = (props) => {
|
|
|
1788
1796
|
{
|
|
1789
1797
|
hourHeight,
|
|
1790
1798
|
APPOINTMENT_BLOCK_WIDTH,
|
|
1791
|
-
handleBlockPress: (time) =>
|
|
1792
|
-
handleBlockLongPress: (time) =>
|
|
1799
|
+
handleBlockPress: (time) => stableHandleBlockPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time)),
|
|
1800
|
+
handleBlockLongPress: (time) => stableHandleBlockLongPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time))
|
|
1793
1801
|
}
|
|
1794
1802
|
), /* @__PURE__ */ React19__namespace.default.createElement(
|
|
1795
1803
|
DisabledIntervals_default,
|
|
@@ -1819,7 +1827,7 @@ var CalendarInner = (props) => {
|
|
|
1819
1827
|
onLongPress: internalStableOnLongPress,
|
|
1820
1828
|
isEventSelected: isEventSelectedStable,
|
|
1821
1829
|
isEventDisabled: isEventDisabledStable,
|
|
1822
|
-
eventRenderer:
|
|
1830
|
+
eventRenderer: effectiveRenderer,
|
|
1823
1831
|
mode: overLappingLayoutMode
|
|
1824
1832
|
}
|
|
1825
1833
|
)));
|
|
@@ -1829,14 +1837,36 @@ var CalendarInner = (props) => {
|
|
|
1829
1837
|
resourceIds,
|
|
1830
1838
|
APPOINTMENT_BLOCK_WIDTH,
|
|
1831
1839
|
hourHeight,
|
|
1832
|
-
|
|
1840
|
+
effectiveRenderer,
|
|
1833
1841
|
isEventSelectedStable,
|
|
1834
1842
|
isEventDisabledStable,
|
|
1835
1843
|
overLappingLayoutMode,
|
|
1836
1844
|
stableOnPress,
|
|
1837
1845
|
internalStableOnLongPress,
|
|
1838
|
-
stableOnDisabledBlockPress
|
|
1846
|
+
stableOnDisabledBlockPress,
|
|
1847
|
+
stableHandleBlockPress,
|
|
1848
|
+
stableHandleBlockLongPress
|
|
1839
1849
|
]);
|
|
1850
|
+
const listExtraData = React19.useMemo(
|
|
1851
|
+
() => ({
|
|
1852
|
+
numberOfColumns,
|
|
1853
|
+
width,
|
|
1854
|
+
hourHeight,
|
|
1855
|
+
stacked: overLappingLayoutMode === "stacked",
|
|
1856
|
+
isEventSelectedStable,
|
|
1857
|
+
isEventDisabledStable,
|
|
1858
|
+
effectiveRenderer
|
|
1859
|
+
}),
|
|
1860
|
+
[
|
|
1861
|
+
numberOfColumns,
|
|
1862
|
+
width,
|
|
1863
|
+
hourHeight,
|
|
1864
|
+
overLappingLayoutMode,
|
|
1865
|
+
isEventSelectedStable,
|
|
1866
|
+
isEventDisabledStable,
|
|
1867
|
+
effectiveRenderer
|
|
1868
|
+
]
|
|
1869
|
+
);
|
|
1840
1870
|
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(
|
|
1841
1871
|
Animated2__default.default.ScrollView,
|
|
1842
1872
|
{
|
|
@@ -1920,7 +1950,7 @@ var CalendarInner = (props) => {
|
|
|
1920
1950
|
/* @__PURE__ */ React19__namespace.default.createElement(
|
|
1921
1951
|
AnimatedFlashList,
|
|
1922
1952
|
{
|
|
1923
|
-
extraData:
|
|
1953
|
+
extraData: listExtraData,
|
|
1924
1954
|
scrollEnabled: !selectedEvent,
|
|
1925
1955
|
ref: flashListRef,
|
|
1926
1956
|
onScroll: flashListScrollHandler,
|