react-native-resource-calendar 1.1.13 → 1.1.15
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 +51 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1027,7 +1027,10 @@ var EventBlock = React19__default.memo(({
|
|
|
1027
1027
|
zIndex: frame.zIndex,
|
|
1028
1028
|
opacity: anyEventSelected || disabled ? 0.5 : 1,
|
|
1029
1029
|
borderWidth: selected ? 2 : 1,
|
|
1030
|
-
borderColor: selected ? "#4d959c" : "rgba(0,0,0,0.12)"
|
|
1030
|
+
borderColor: selected ? "#4d959c" : "rgba(0,0,0,0.12)",
|
|
1031
|
+
// When disabled, let touches fall through to the grid blocks beneath
|
|
1032
|
+
// (e.g. "select a time" mode) instead of swallowing them.
|
|
1033
|
+
pointerEvents: disabled ? "none" : "auto"
|
|
1031
1034
|
};
|
|
1032
1035
|
const resolved = typeof styleOverrides === "function" ? styleOverrides(event) ?? {} : styleOverrides ?? {};
|
|
1033
1036
|
const handlePress = useCallback(() => onPress?.(event), [onPress, event]);
|
|
@@ -1384,10 +1387,6 @@ var CalendarInner = (props) => {
|
|
|
1384
1387
|
const internalOnLongPress = useRef(null);
|
|
1385
1388
|
const onDisabledBlockPressRef = React19__default.useRef(onDisabledBlockPress);
|
|
1386
1389
|
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
1390
|
const effectiveRenderer = useMemo(() => {
|
|
1392
1391
|
return (p) => /* @__PURE__ */ React19__default.createElement(
|
|
1393
1392
|
EventBlock_default,
|
|
@@ -1399,16 +1398,13 @@ var CalendarInner = (props) => {
|
|
|
1399
1398
|
);
|
|
1400
1399
|
}, [eventSlots, eventStyleOverrides]);
|
|
1401
1400
|
const isEventSelectedStable = useCallback(
|
|
1402
|
-
(ev) =>
|
|
1403
|
-
[]
|
|
1401
|
+
(ev) => props.isEventSelected?.(ev) ?? false,
|
|
1402
|
+
[props.isEventSelected]
|
|
1404
1403
|
);
|
|
1405
1404
|
const isEventDisabledStable = useCallback(
|
|
1406
|
-
(ev) =>
|
|
1407
|
-
[]
|
|
1405
|
+
(ev) => props.isEventDisabled?.(ev) ?? false,
|
|
1406
|
+
[props.isEventDisabled]
|
|
1408
1407
|
);
|
|
1409
|
-
const rendererRef = useRef(effectiveRenderer);
|
|
1410
|
-
rendererRef.current = effectiveRenderer;
|
|
1411
|
-
const stableRenderer = useCallback((p) => rendererRef.current(p), []);
|
|
1412
1408
|
const stableOnPress = React19__default.useCallback((e) => onPressRef.current?.(e), []);
|
|
1413
1409
|
const stableOnDisabledBlockPress = React19__default.useCallback((b) => onDisabledBlockPressRef.current?.(b), []);
|
|
1414
1410
|
const { useGetSelectedEvent: useGetSelectedEvent2, useSetSelectedEvent: useSetSelectedEvent2, useSetDraggedEventDraft: useSetDraggedEventDraft2, useGetDraggedEventDraft: useGetDraggedEventDraft2 } = useCalendarBinding();
|
|
@@ -1476,6 +1472,8 @@ var CalendarInner = (props) => {
|
|
|
1476
1472
|
},
|
|
1477
1473
|
[enableHapticFeedback]
|
|
1478
1474
|
);
|
|
1475
|
+
const triggerHapticRef = useRef(triggerHaptic);
|
|
1476
|
+
triggerHapticRef.current = triggerHaptic;
|
|
1479
1477
|
const resourceIds = useMemo(() => {
|
|
1480
1478
|
const ids = resources?.map((item) => item?.id) || [];
|
|
1481
1479
|
if (JSON.stringify(prevResourceIdsRef.current) !== JSON.stringify(ids)) {
|
|
@@ -1709,7 +1707,7 @@ var CalendarInner = (props) => {
|
|
|
1709
1707
|
date: event.date
|
|
1710
1708
|
});
|
|
1711
1709
|
requestAnimationFrame(() => setDragReady(true));
|
|
1712
|
-
|
|
1710
|
+
triggerHapticRef.current("Medium");
|
|
1713
1711
|
};
|
|
1714
1712
|
}, []);
|
|
1715
1713
|
const internalStableOnLongPress = useCallback((e) => {
|
|
@@ -1744,6 +1742,18 @@ var CalendarInner = (props) => {
|
|
|
1744
1742
|
if (onBlockTap)
|
|
1745
1743
|
onBlockTap(resource, new Date(time));
|
|
1746
1744
|
}, [resources, onBlockTap]);
|
|
1745
|
+
const handleBlockPressRef = useRef(handleBlockPress);
|
|
1746
|
+
handleBlockPressRef.current = handleBlockPress;
|
|
1747
|
+
const stableHandleBlockPress = useCallback(
|
|
1748
|
+
(resourceId, time) => handleBlockPressRef.current(resourceId, time),
|
|
1749
|
+
[]
|
|
1750
|
+
);
|
|
1751
|
+
const handleBlockLongPressRef = useRef(handleBlockLongPress);
|
|
1752
|
+
handleBlockLongPressRef.current = handleBlockLongPress;
|
|
1753
|
+
const stableHandleBlockLongPress = useCallback(
|
|
1754
|
+
(resourceId, time) => handleBlockLongPressRef.current(resourceId, time),
|
|
1755
|
+
[]
|
|
1756
|
+
);
|
|
1747
1757
|
useEffect(() => {
|
|
1748
1758
|
const handleOrientationChange = () => {
|
|
1749
1759
|
if (selectedEvent) {
|
|
@@ -1764,8 +1774,8 @@ var CalendarInner = (props) => {
|
|
|
1764
1774
|
{
|
|
1765
1775
|
hourHeight,
|
|
1766
1776
|
APPOINTMENT_BLOCK_WIDTH,
|
|
1767
|
-
handleBlockPress: (time) =>
|
|
1768
|
-
handleBlockLongPress: (time) =>
|
|
1777
|
+
handleBlockPress: (time) => stableHandleBlockPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time)),
|
|
1778
|
+
handleBlockLongPress: (time) => stableHandleBlockLongPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time))
|
|
1769
1779
|
}
|
|
1770
1780
|
), /* @__PURE__ */ React19__default.createElement(
|
|
1771
1781
|
DisabledIntervals_default,
|
|
@@ -1795,7 +1805,7 @@ var CalendarInner = (props) => {
|
|
|
1795
1805
|
onLongPress: internalStableOnLongPress,
|
|
1796
1806
|
isEventSelected: isEventSelectedStable,
|
|
1797
1807
|
isEventDisabled: isEventDisabledStable,
|
|
1798
|
-
eventRenderer:
|
|
1808
|
+
eventRenderer: effectiveRenderer,
|
|
1799
1809
|
mode: overLappingLayoutMode
|
|
1800
1810
|
}
|
|
1801
1811
|
)));
|
|
@@ -1805,14 +1815,36 @@ var CalendarInner = (props) => {
|
|
|
1805
1815
|
resourceIds,
|
|
1806
1816
|
APPOINTMENT_BLOCK_WIDTH,
|
|
1807
1817
|
hourHeight,
|
|
1808
|
-
|
|
1818
|
+
effectiveRenderer,
|
|
1809
1819
|
isEventSelectedStable,
|
|
1810
1820
|
isEventDisabledStable,
|
|
1811
1821
|
overLappingLayoutMode,
|
|
1812
1822
|
stableOnPress,
|
|
1813
1823
|
internalStableOnLongPress,
|
|
1814
|
-
stableOnDisabledBlockPress
|
|
1824
|
+
stableOnDisabledBlockPress,
|
|
1825
|
+
stableHandleBlockPress,
|
|
1826
|
+
stableHandleBlockLongPress
|
|
1815
1827
|
]);
|
|
1828
|
+
const listExtraData = useMemo(
|
|
1829
|
+
() => ({
|
|
1830
|
+
numberOfColumns,
|
|
1831
|
+
width,
|
|
1832
|
+
hourHeight,
|
|
1833
|
+
stacked: overLappingLayoutMode === "stacked",
|
|
1834
|
+
isEventSelectedStable,
|
|
1835
|
+
isEventDisabledStable,
|
|
1836
|
+
effectiveRenderer
|
|
1837
|
+
}),
|
|
1838
|
+
[
|
|
1839
|
+
numberOfColumns,
|
|
1840
|
+
width,
|
|
1841
|
+
hourHeight,
|
|
1842
|
+
overLappingLayoutMode,
|
|
1843
|
+
isEventSelectedStable,
|
|
1844
|
+
isEventDisabledStable,
|
|
1845
|
+
effectiveRenderer
|
|
1846
|
+
]
|
|
1847
|
+
);
|
|
1816
1848
|
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
1849
|
Animated2.ScrollView,
|
|
1818
1850
|
{
|
|
@@ -1896,7 +1928,7 @@ var CalendarInner = (props) => {
|
|
|
1896
1928
|
/* @__PURE__ */ React19__default.createElement(
|
|
1897
1929
|
AnimatedFlashList,
|
|
1898
1930
|
{
|
|
1899
|
-
extraData:
|
|
1931
|
+
extraData: listExtraData,
|
|
1900
1932
|
scrollEnabled: !selectedEvent,
|
|
1901
1933
|
ref: flashListRef,
|
|
1902
1934
|
onScroll: flashListScrollHandler,
|