react-native-resource-calendar 1.0.24 → 1.1.0
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 +18 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -11
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React19 = require('react');
|
|
4
4
|
var reactNativeGestureHandler = require('react-native-gesture-handler');
|
|
5
|
+
var reactNativeWorklets = require('react-native-worklets');
|
|
5
6
|
var Animated2 = require('react-native-reanimated');
|
|
6
7
|
var reactNative = require('react-native');
|
|
7
8
|
var flashList = require('@shopify/flash-list');
|
|
@@ -805,29 +806,29 @@ var EventGridBlocksSkia = ({
|
|
|
805
806
|
}, []);
|
|
806
807
|
const longPressGesture = reactNativeGestureHandler.Gesture.LongPress().onBegin((e) => {
|
|
807
808
|
"worklet";
|
|
808
|
-
|
|
809
|
+
reactNativeWorklets.scheduleOnRN(onPressBegin, Math.floor(e.y / rowHeight));
|
|
809
810
|
}).onTouchesUp(() => {
|
|
810
811
|
"worklet";
|
|
811
|
-
|
|
812
|
+
reactNativeWorklets.scheduleOnRN(onTouchesUp);
|
|
812
813
|
}).onEnd((e) => {
|
|
813
814
|
"worklet";
|
|
814
|
-
|
|
815
|
+
reactNativeWorklets.scheduleOnRN(onSlotLongPress, Math.floor(e.y / rowHeight));
|
|
815
816
|
}).onFinalize(() => {
|
|
816
817
|
"worklet";
|
|
817
|
-
|
|
818
|
+
reactNativeWorklets.scheduleOnRN(onTouchesUp);
|
|
818
819
|
});
|
|
819
820
|
const tapGesture = reactNativeGestureHandler.Gesture.Tap().onBegin((e) => {
|
|
820
821
|
"worklet";
|
|
821
|
-
|
|
822
|
+
reactNativeWorklets.scheduleOnRN(onPressBegin, Math.floor(e.y / rowHeight));
|
|
822
823
|
}).onEnd((e) => {
|
|
823
824
|
"worklet";
|
|
824
|
-
|
|
825
|
+
reactNativeWorklets.scheduleOnRN(onSlotPress, Math.floor(e.y / rowHeight));
|
|
825
826
|
}).onTouchesUp(() => {
|
|
826
827
|
"worklet";
|
|
827
|
-
|
|
828
|
+
reactNativeWorklets.scheduleOnRN(onTouchesUp);
|
|
828
829
|
}).onFinalize(() => {
|
|
829
830
|
"worklet";
|
|
830
|
-
|
|
831
|
+
reactNativeWorklets.scheduleOnRN(onTouchesUp);
|
|
831
832
|
});
|
|
832
833
|
const composedGesture = reactNativeGestureHandler.Gesture.Race(longPressGesture, tapGesture);
|
|
833
834
|
return /* @__PURE__ */ React19__namespace.createElement(reactNativeGestureHandler.GestureDetector, { gesture: composedGesture }, /* @__PURE__ */ React19__namespace.createElement(reactNative.View, null, /* @__PURE__ */ React19__namespace.createElement(reactNativeSkia.Canvas, { style: { width: APPOINTMENT_BLOCK_WIDTH, height: segmentHeight } }, firstRects.map(({ x, y, width: w, height: h, row }, idx) => /* @__PURE__ */ React19__namespace.createElement(React19__namespace.Fragment, { key: idx }, /* @__PURE__ */ React19__namespace.createElement(
|
|
@@ -1567,7 +1568,7 @@ var CalendarInner = (props) => {
|
|
|
1567
1568
|
if (finalHeight !== eventHeight.value) {
|
|
1568
1569
|
eventHeight.value = finalHeight;
|
|
1569
1570
|
panYAbs.value = onScreenTop + finalHeight / 2;
|
|
1570
|
-
|
|
1571
|
+
reactNativeWorklets.scheduleOnRN(triggerHaptic);
|
|
1571
1572
|
}
|
|
1572
1573
|
if (layout) {
|
|
1573
1574
|
const AUTO_SCROLL_BUFFER = 30;
|
|
@@ -1593,7 +1594,7 @@ var CalendarInner = (props) => {
|
|
|
1593
1594
|
snappedAbsoluteTop = Math.min(snappedAbsoluteTop, maxAbsoluteTop);
|
|
1594
1595
|
}
|
|
1595
1596
|
if (snappedAbsoluteTop !== eventStartedTop.value) {
|
|
1596
|
-
|
|
1597
|
+
reactNativeWorklets.scheduleOnRN(triggerHaptic);
|
|
1597
1598
|
eventStartedTop.value = snappedAbsoluteTop;
|
|
1598
1599
|
}
|
|
1599
1600
|
panYAbs.value = snappedAbsoluteTop - scrollY.value + eventHeight.value / 2;
|
|
@@ -1652,7 +1653,7 @@ var CalendarInner = (props) => {
|
|
|
1652
1653
|
startedX.value = finalPanXValue;
|
|
1653
1654
|
isPulling.value = false;
|
|
1654
1655
|
isDragging.value = false;
|
|
1655
|
-
|
|
1656
|
+
reactNativeWorklets.scheduleOnRN(finalizeDrag, colIndex, adjustedFinalEventTop, eventHeight.value);
|
|
1656
1657
|
});
|
|
1657
1658
|
const scrollListTo = (x) => {
|
|
1658
1659
|
flashListRef.current?.scrollToOffset({ offset: x, animated: false });
|
|
@@ -1667,8 +1668,8 @@ var CalendarInner = (props) => {
|
|
|
1667
1668
|
lastXScrollTime.value = now;
|
|
1668
1669
|
const increment = APPOINTMENT_BLOCK_WIDTH * Math.sign(autoScrollXSpeed.value);
|
|
1669
1670
|
const newScrollX = scrollX.value + increment;
|
|
1670
|
-
|
|
1671
|
-
|
|
1671
|
+
reactNativeWorklets.scheduleOnRN(scrollListTo, newScrollX);
|
|
1672
|
+
reactNativeWorklets.scheduleOnRN(triggerHaptic, "Medium");
|
|
1672
1673
|
}
|
|
1673
1674
|
});
|
|
1674
1675
|
Animated2.useFrameCallback(() => {
|
|
@@ -1702,7 +1703,7 @@ var CalendarInner = (props) => {
|
|
|
1702
1703
|
const scrollDiff = Math.abs(newScrollY - lastHapticScrollY.value);
|
|
1703
1704
|
if (scrollDiff >= snapInterval) {
|
|
1704
1705
|
lastHapticScrollY.value = newScrollY;
|
|
1705
|
-
|
|
1706
|
+
reactNativeWorklets.scheduleOnRN(triggerHaptic, "Medium");
|
|
1706
1707
|
}
|
|
1707
1708
|
});
|
|
1708
1709
|
React19.useEffect(() => {
|
|
@@ -1736,7 +1737,7 @@ var CalendarInner = (props) => {
|
|
|
1736
1737
|
eventHeight.value = initialHeight;
|
|
1737
1738
|
setSelectedEvent(event);
|
|
1738
1739
|
requestAnimationFrame(() => setDragReady(true));
|
|
1739
|
-
|
|
1740
|
+
triggerHaptic("Medium");
|
|
1740
1741
|
};
|
|
1741
1742
|
}, []);
|
|
1742
1743
|
const internalStableOnLongPress = React19.useCallback((e) => {
|
|
@@ -1760,13 +1761,13 @@ var CalendarInner = (props) => {
|
|
|
1760
1761
|
}
|
|
1761
1762
|
});
|
|
1762
1763
|
const handleBlockLongPress = React19.useCallback((resourceId, time) => {
|
|
1763
|
-
|
|
1764
|
+
triggerHaptic("Medium");
|
|
1764
1765
|
const resource = resources.find((r) => r.id === resourceId);
|
|
1765
1766
|
if (onBlockLongPress)
|
|
1766
1767
|
onBlockLongPress(resource, new Date(time));
|
|
1767
1768
|
}, [resources, onBlockLongPress]);
|
|
1768
1769
|
const handleBlockPress = React19.useCallback((resourceId, time) => {
|
|
1769
|
-
|
|
1770
|
+
triggerHaptic("Medium");
|
|
1770
1771
|
const resource = resources.find((r) => r.id === resourceId);
|
|
1771
1772
|
if (onBlockTap)
|
|
1772
1773
|
onBlockTap(resource, new Date(time));
|
|
@@ -1930,7 +1931,6 @@ var CalendarInner = (props) => {
|
|
|
1930
1931
|
scrollEnabled: !selectedEvent,
|
|
1931
1932
|
ref: flashListRef,
|
|
1932
1933
|
onScroll: flashListScrollHandler,
|
|
1933
|
-
estimatedItemSize: APPOINTMENT_BLOCK_WIDTH,
|
|
1934
1934
|
removeClippedSubviews: true,
|
|
1935
1935
|
data: !isMultiDay ? resourceIds : columns,
|
|
1936
1936
|
horizontal: true,
|