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.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,6 +1764,18 @@ 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
1781
|
if (selectedEvent) {
|
|
@@ -1789,8 +1796,8 @@ var CalendarInner = (props) => {
|
|
|
1789
1796
|
{
|
|
1790
1797
|
hourHeight,
|
|
1791
1798
|
APPOINTMENT_BLOCK_WIDTH,
|
|
1792
|
-
handleBlockPress: (time) =>
|
|
1793
|
-
handleBlockLongPress: (time) =>
|
|
1799
|
+
handleBlockPress: (time) => stableHandleBlockPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time)),
|
|
1800
|
+
handleBlockLongPress: (time) => stableHandleBlockLongPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time))
|
|
1794
1801
|
}
|
|
1795
1802
|
), /* @__PURE__ */ React19__namespace.default.createElement(
|
|
1796
1803
|
DisabledIntervals_default,
|
|
@@ -1820,7 +1827,7 @@ var CalendarInner = (props) => {
|
|
|
1820
1827
|
onLongPress: internalStableOnLongPress,
|
|
1821
1828
|
isEventSelected: isEventSelectedStable,
|
|
1822
1829
|
isEventDisabled: isEventDisabledStable,
|
|
1823
|
-
eventRenderer:
|
|
1830
|
+
eventRenderer: effectiveRenderer,
|
|
1824
1831
|
mode: overLappingLayoutMode
|
|
1825
1832
|
}
|
|
1826
1833
|
)));
|
|
@@ -1830,14 +1837,36 @@ var CalendarInner = (props) => {
|
|
|
1830
1837
|
resourceIds,
|
|
1831
1838
|
APPOINTMENT_BLOCK_WIDTH,
|
|
1832
1839
|
hourHeight,
|
|
1833
|
-
|
|
1840
|
+
effectiveRenderer,
|
|
1834
1841
|
isEventSelectedStable,
|
|
1835
1842
|
isEventDisabledStable,
|
|
1836
1843
|
overLappingLayoutMode,
|
|
1837
1844
|
stableOnPress,
|
|
1838
1845
|
internalStableOnLongPress,
|
|
1839
|
-
stableOnDisabledBlockPress
|
|
1846
|
+
stableOnDisabledBlockPress,
|
|
1847
|
+
stableHandleBlockPress,
|
|
1848
|
+
stableHandleBlockLongPress
|
|
1840
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
|
+
);
|
|
1841
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(
|
|
1842
1871
|
Animated2__default.default.ScrollView,
|
|
1843
1872
|
{
|
|
@@ -1921,7 +1950,7 @@ var CalendarInner = (props) => {
|
|
|
1921
1950
|
/* @__PURE__ */ React19__namespace.default.createElement(
|
|
1922
1951
|
AnimatedFlashList,
|
|
1923
1952
|
{
|
|
1924
|
-
extraData:
|
|
1953
|
+
extraData: listExtraData,
|
|
1925
1954
|
scrollEnabled: !selectedEvent,
|
|
1926
1955
|
ref: flashListRef,
|
|
1927
1956
|
onScroll: flashListScrollHandler,
|