@super-calendar/native 2.14.0 → 2.14.2
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 +76 -14
- package/dist/index.mjs +77 -15
- package/package.json +2 -2
- package/src/components/MonthList.tsx +11 -2
- package/src/components/MonthPager.tsx +11 -2
- package/src/components/MonthView.tsx +11 -2
- package/src/components/MultiDayMovePreview.tsx +5 -5
- package/src/components/ResourceTimeline.tsx +44 -14
- package/src/components/TimeGrid.tsx +66 -10
- package/src/components/YearView.tsx +2 -2
package/dist/index.js
CHANGED
|
@@ -778,9 +778,11 @@ function PreviewDay({ move, cellHeight, dayWidth, minHour, mode, renderEvent: Re
|
|
|
778
778
|
const start = (0, _super_calendar_core.shiftMinutes)(new Date(startTimestamp), dayOffsets[target] + minuteDelta).getTime();
|
|
779
779
|
const end = start + duration;
|
|
780
780
|
const visible = !lifted.value && start < dayEnd && end > dayStart;
|
|
781
|
+
const segStart = new Date(Math.max(start, dayStart));
|
|
782
|
+
const segEnd = new Date(Math.min(end, dayEnd));
|
|
781
783
|
return {
|
|
782
|
-
top: (
|
|
783
|
-
hours: visible ? Math.max((
|
|
784
|
+
top: (0, _super_calendar_core.wallClockHours)(segStart, new Date(dayStart), new Date(dayEnd)),
|
|
785
|
+
hours: visible ? Math.max((0, _super_calendar_core.clockHoursBetween)(segStart, segEnd), .25) : 0,
|
|
784
786
|
continuesBefore: start < dayStart,
|
|
785
787
|
continuesAfter: end > dayEnd
|
|
786
788
|
};
|
|
@@ -843,6 +845,10 @@ const isWeb$1 = react_native.Platform.OS === "web";
|
|
|
843
845
|
const MINUTES_PER_HOUR$1 = 60;
|
|
844
846
|
const HOURS_PER_DAY = 24;
|
|
845
847
|
const MINUTES_PER_DAY = 1440;
|
|
848
|
+
const NO_MOVE_EXTRA$1 = {
|
|
849
|
+
top: 0,
|
|
850
|
+
hours: 0
|
|
851
|
+
};
|
|
846
852
|
const PAGE_WINDOW = 180;
|
|
847
853
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
848
854
|
const PAGER_IDLE_MS = 150;
|
|
@@ -980,9 +986,34 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
980
986
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
981
987
|
ownsStart
|
|
982
988
|
}), [startHours, ownsStart]);
|
|
983
|
-
const
|
|
989
|
+
const eventStartMs = positioned.event.start.getTime();
|
|
990
|
+
const eventEndMs = positioned.event.end.getTime();
|
|
991
|
+
const moveExtra = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
992
|
+
if (multiDay || lifted.value || cellHeight.value <= 0) return NO_MOVE_EXTRA$1;
|
|
993
|
+
if (moveOffset.value === 0 && moveOffsetX.value === 0) return NO_MOVE_EXTRA$1;
|
|
994
|
+
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
995
|
+
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayCount - 1);
|
|
996
|
+
const minutes = Math.round(moveOffset.value / cellHeight.value * MINUTES_PER_HOUR$1) + (dayOrdinals[target] - dayOrdinals[dayIndex]) * MINUTES_PER_DAY;
|
|
997
|
+
const from = new Date(eventStartMs);
|
|
998
|
+
const to = new Date(eventEndMs);
|
|
999
|
+
const moved = (0, _super_calendar_core.movedClockSpan)(from, to, minutes);
|
|
1000
|
+
return {
|
|
1001
|
+
top: moved.startHours - minutes / MINUTES_PER_HOUR$1,
|
|
1002
|
+
hours: moved.hours - durationHours
|
|
1003
|
+
};
|
|
1004
|
+
}, [
|
|
1005
|
+
multiDay,
|
|
1006
|
+
dayWidth,
|
|
1007
|
+
dayIndex,
|
|
1008
|
+
dayCount,
|
|
1009
|
+
dayOrdinals,
|
|
1010
|
+
eventStartMs,
|
|
1011
|
+
eventEndMs,
|
|
1012
|
+
durationHours
|
|
1013
|
+
]);
|
|
1014
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max((durationHours + moveExtra.value.hours) * cellHeight.value + resizeDelta.value - resizeStartDelta.value, minEventHeight), [durationHours, minEventHeight]);
|
|
984
1015
|
const visibleBoxHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
985
|
-
const top = (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
1016
|
+
const top = (startHours + moveExtra.value.top - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
986
1017
|
const dayEnd = (HOURS_PER_DAY - minHour) * cellHeight.value;
|
|
987
1018
|
return Math.max(Math.min(boxHeight.value, dayEnd - top), minEventHeight);
|
|
988
1019
|
}, [
|
|
@@ -992,7 +1023,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
992
1023
|
]);
|
|
993
1024
|
const boxStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
994
1025
|
return {
|
|
995
|
-
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
1026
|
+
top: (startHours + moveExtra.value.top - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
996
1027
|
height: visibleBoxHeight.value,
|
|
997
1028
|
transform: [{ translateX: moveOffsetX.value }],
|
|
998
1029
|
zIndex: dragZ.value,
|
|
@@ -1005,7 +1036,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1005
1036
|
]);
|
|
1006
1037
|
const spillHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
1007
1038
|
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
1008
|
-
const
|
|
1039
|
+
const extra = moveExtra.value;
|
|
1040
|
+
const overflowHours = startHours + extra.top + moveOffset.value / cellHeight.value + durationHours + extra.hours - HOURS_PER_DAY;
|
|
1009
1041
|
if (overflowHours <= 0) return 0;
|
|
1010
1042
|
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
1011
1043
|
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayCount - 1);
|
|
@@ -2118,7 +2150,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2118
2150
|
animated: false
|
|
2119
2151
|
});
|
|
2120
2152
|
const dom = node.getScrollableNode();
|
|
2121
|
-
if (dom && dom.scrollHeight > dom.clientHeight) webSeededRef.current = true;
|
|
2153
|
+
if (dom != null && typeof dom === "object" && "scrollHeight" in dom && typeof dom.scrollHeight === "number" && "clientHeight" in dom && typeof dom.clientHeight === "number" && dom.scrollHeight > dom.clientHeight) webSeededRef.current = true;
|
|
2122
2154
|
}, [scrollRef, seedDefaultY]);
|
|
2123
2155
|
const laneHeights = (0, react_native_reanimated.useSharedValue)({});
|
|
2124
2156
|
const laneHeightsRef = (0, react.useRef)({});
|
|
@@ -3300,6 +3332,10 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3300
3332
|
const MOVE_ACTIVATE_MS = 250;
|
|
3301
3333
|
const DRAG_ACTIVATE_PX = 8;
|
|
3302
3334
|
const MINUTES_PER_HOUR = 60;
|
|
3335
|
+
const NO_MOVE_EXTRA = {
|
|
3336
|
+
top: 0,
|
|
3337
|
+
hours: 0
|
|
3338
|
+
};
|
|
3303
3339
|
const isWeb = react_native.Platform.OS === "web";
|
|
3304
3340
|
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
3305
3341
|
const GUTTER_WIDTH = 56;
|
|
@@ -3432,16 +3468,42 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
|
|
|
3432
3468
|
case "move-previous-lane": commit(0, 0, -1);
|
|
3433
3469
|
}
|
|
3434
3470
|
} : void 0;
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3471
|
+
const eventStartMs = pe.event.start.getTime();
|
|
3472
|
+
const eventEndMs = pe.event.end.getTime();
|
|
3473
|
+
const clipped = pe.continuesBefore || pe.continuesAfter;
|
|
3474
|
+
const barHours = pe.durationHours;
|
|
3475
|
+
const moveExtra = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
3476
|
+
if (clipped || moveX.value === 0 || hourSize <= 0) return NO_MOVE_EXTRA;
|
|
3477
|
+
const minutes = Math.round(moveX.value / hourSize * MINUTES_PER_HOUR);
|
|
3478
|
+
const from = new Date(eventStartMs);
|
|
3479
|
+
const to = new Date(eventEndMs);
|
|
3480
|
+
const moved = (0, _super_calendar_core.movedClockSpan)(from, to, minutes);
|
|
3481
|
+
return {
|
|
3482
|
+
top: moved.startHours - minutes / MINUTES_PER_HOUR,
|
|
3483
|
+
hours: moved.hours - barHours
|
|
3484
|
+
};
|
|
3485
|
+
}, [
|
|
3486
|
+
clipped,
|
|
3487
|
+
hourSize,
|
|
3488
|
+
eventStartMs,
|
|
3489
|
+
eventEndMs,
|
|
3490
|
+
barHours
|
|
3491
|
+
]);
|
|
3492
|
+
const barStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
3493
|
+
const shift = moveX.value + moveExtra.value.top * hourSize;
|
|
3494
|
+
const grow = resizeW.value + moveExtra.value.hours * hourSize;
|
|
3495
|
+
return vertical ? {
|
|
3496
|
+
transform: [{ translateY: shift }, { translateX: moveCross.value }],
|
|
3497
|
+
height: Math.max(height + grow, 2)
|
|
3498
|
+
} : {
|
|
3499
|
+
transform: [{ translateX: shift }, { translateY: moveCross.value }],
|
|
3500
|
+
width: Math.max(width + grow, 2)
|
|
3501
|
+
};
|
|
3441
3502
|
}, [
|
|
3442
3503
|
vertical,
|
|
3443
3504
|
width,
|
|
3444
|
-
height
|
|
3505
|
+
height,
|
|
3506
|
+
hourSize
|
|
3445
3507
|
]);
|
|
3446
3508
|
const laneId = resources[laneIndex]?.id ?? "";
|
|
3447
3509
|
const moveGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(draggable).activateAfterLongPress(MOVE_ACTIVATE_MS).onStart(() => {
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { a as withEventAccessibilityLabel, c as createSlots, d as useCalendarLab
|
|
|
2
2
|
import { addDays, addMonths, addWeeks, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getHours, getISOWeek, getMinutes, isSameDay, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
3
3
|
import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
4
4
|
import Animated, { runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, minutesIntoDay, monthCreateRange, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
5
|
+
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, minutesIntoDay, monthCreateRange, movedClockSpan, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, wallClockHours, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
6
6
|
import { PixelRatio, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
7
7
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -754,9 +754,11 @@ function PreviewDay({ move, cellHeight, dayWidth, minHour, mode, renderEvent: Re
|
|
|
754
754
|
const start = shiftMinutes(new Date(startTimestamp), dayOffsets[target] + minuteDelta).getTime();
|
|
755
755
|
const end = start + duration;
|
|
756
756
|
const visible = !lifted.value && start < dayEnd && end > dayStart;
|
|
757
|
+
const segStart = new Date(Math.max(start, dayStart));
|
|
758
|
+
const segEnd = new Date(Math.min(end, dayEnd));
|
|
757
759
|
return {
|
|
758
|
-
top: (
|
|
759
|
-
hours: visible ? Math.max((
|
|
760
|
+
top: wallClockHours(segStart, new Date(dayStart), new Date(dayEnd)),
|
|
761
|
+
hours: visible ? Math.max(clockHoursBetween(segStart, segEnd), .25) : 0,
|
|
760
762
|
continuesBefore: start < dayStart,
|
|
761
763
|
continuesAfter: end > dayEnd
|
|
762
764
|
};
|
|
@@ -819,6 +821,10 @@ const isWeb$1 = Platform.OS === "web";
|
|
|
819
821
|
const MINUTES_PER_HOUR$1 = 60;
|
|
820
822
|
const HOURS_PER_DAY = 24;
|
|
821
823
|
const MINUTES_PER_DAY = 1440;
|
|
824
|
+
const NO_MOVE_EXTRA$1 = {
|
|
825
|
+
top: 0,
|
|
826
|
+
hours: 0
|
|
827
|
+
};
|
|
822
828
|
const PAGE_WINDOW = 180;
|
|
823
829
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
824
830
|
const PAGER_IDLE_MS = 150;
|
|
@@ -956,9 +962,34 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
956
962
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
957
963
|
ownsStart
|
|
958
964
|
}), [startHours, ownsStart]);
|
|
959
|
-
const
|
|
965
|
+
const eventStartMs = positioned.event.start.getTime();
|
|
966
|
+
const eventEndMs = positioned.event.end.getTime();
|
|
967
|
+
const moveExtra = useDerivedValue(() => {
|
|
968
|
+
if (multiDay || lifted.value || cellHeight.value <= 0) return NO_MOVE_EXTRA$1;
|
|
969
|
+
if (moveOffset.value === 0 && moveOffsetX.value === 0) return NO_MOVE_EXTRA$1;
|
|
970
|
+
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
971
|
+
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayCount - 1);
|
|
972
|
+
const minutes = Math.round(moveOffset.value / cellHeight.value * MINUTES_PER_HOUR$1) + (dayOrdinals[target] - dayOrdinals[dayIndex]) * MINUTES_PER_DAY;
|
|
973
|
+
const from = new Date(eventStartMs);
|
|
974
|
+
const to = new Date(eventEndMs);
|
|
975
|
+
const moved = movedClockSpan(from, to, minutes);
|
|
976
|
+
return {
|
|
977
|
+
top: moved.startHours - minutes / MINUTES_PER_HOUR$1,
|
|
978
|
+
hours: moved.hours - durationHours
|
|
979
|
+
};
|
|
980
|
+
}, [
|
|
981
|
+
multiDay,
|
|
982
|
+
dayWidth,
|
|
983
|
+
dayIndex,
|
|
984
|
+
dayCount,
|
|
985
|
+
dayOrdinals,
|
|
986
|
+
eventStartMs,
|
|
987
|
+
eventEndMs,
|
|
988
|
+
durationHours
|
|
989
|
+
]);
|
|
990
|
+
const boxHeight = useDerivedValue(() => Math.max((durationHours + moveExtra.value.hours) * cellHeight.value + resizeDelta.value - resizeStartDelta.value, minEventHeight), [durationHours, minEventHeight]);
|
|
960
991
|
const visibleBoxHeight = useDerivedValue(() => {
|
|
961
|
-
const top = (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
992
|
+
const top = (startHours + moveExtra.value.top - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
962
993
|
const dayEnd = (HOURS_PER_DAY - minHour) * cellHeight.value;
|
|
963
994
|
return Math.max(Math.min(boxHeight.value, dayEnd - top), minEventHeight);
|
|
964
995
|
}, [
|
|
@@ -968,7 +999,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
968
999
|
]);
|
|
969
1000
|
const boxStyle = useAnimatedStyle(() => {
|
|
970
1001
|
return {
|
|
971
|
-
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
1002
|
+
top: (startHours + moveExtra.value.top - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
972
1003
|
height: visibleBoxHeight.value,
|
|
973
1004
|
transform: [{ translateX: moveOffsetX.value }],
|
|
974
1005
|
zIndex: dragZ.value,
|
|
@@ -981,7 +1012,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
981
1012
|
]);
|
|
982
1013
|
const spillHeight = useDerivedValue(() => {
|
|
983
1014
|
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
984
|
-
const
|
|
1015
|
+
const extra = moveExtra.value;
|
|
1016
|
+
const overflowHours = startHours + extra.top + moveOffset.value / cellHeight.value + durationHours + extra.hours - HOURS_PER_DAY;
|
|
985
1017
|
if (overflowHours <= 0) return 0;
|
|
986
1018
|
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
987
1019
|
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayCount - 1);
|
|
@@ -2094,7 +2126,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2094
2126
|
animated: false
|
|
2095
2127
|
});
|
|
2096
2128
|
const dom = node.getScrollableNode();
|
|
2097
|
-
if (dom && dom.scrollHeight > dom.clientHeight) webSeededRef.current = true;
|
|
2129
|
+
if (dom != null && typeof dom === "object" && "scrollHeight" in dom && typeof dom.scrollHeight === "number" && "clientHeight" in dom && typeof dom.clientHeight === "number" && dom.scrollHeight > dom.clientHeight) webSeededRef.current = true;
|
|
2098
2130
|
}, [scrollRef, seedDefaultY]);
|
|
2099
2131
|
const laneHeights = useSharedValue({});
|
|
2100
2132
|
const laneHeightsRef = useRef({});
|
|
@@ -3276,6 +3308,10 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3276
3308
|
const MOVE_ACTIVATE_MS = 250;
|
|
3277
3309
|
const DRAG_ACTIVATE_PX = 8;
|
|
3278
3310
|
const MINUTES_PER_HOUR = 60;
|
|
3311
|
+
const NO_MOVE_EXTRA = {
|
|
3312
|
+
top: 0,
|
|
3313
|
+
hours: 0
|
|
3314
|
+
};
|
|
3279
3315
|
const isWeb = Platform.OS === "web";
|
|
3280
3316
|
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
3281
3317
|
const GUTTER_WIDTH = 56;
|
|
@@ -3408,16 +3444,42 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
|
|
|
3408
3444
|
case "move-previous-lane": commit(0, 0, -1);
|
|
3409
3445
|
}
|
|
3410
3446
|
} : void 0;
|
|
3411
|
-
const
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3447
|
+
const eventStartMs = pe.event.start.getTime();
|
|
3448
|
+
const eventEndMs = pe.event.end.getTime();
|
|
3449
|
+
const clipped = pe.continuesBefore || pe.continuesAfter;
|
|
3450
|
+
const barHours = pe.durationHours;
|
|
3451
|
+
const moveExtra = useDerivedValue(() => {
|
|
3452
|
+
if (clipped || moveX.value === 0 || hourSize <= 0) return NO_MOVE_EXTRA;
|
|
3453
|
+
const minutes = Math.round(moveX.value / hourSize * MINUTES_PER_HOUR);
|
|
3454
|
+
const from = new Date(eventStartMs);
|
|
3455
|
+
const to = new Date(eventEndMs);
|
|
3456
|
+
const moved = movedClockSpan(from, to, minutes);
|
|
3457
|
+
return {
|
|
3458
|
+
top: moved.startHours - minutes / MINUTES_PER_HOUR,
|
|
3459
|
+
hours: moved.hours - barHours
|
|
3460
|
+
};
|
|
3461
|
+
}, [
|
|
3462
|
+
clipped,
|
|
3463
|
+
hourSize,
|
|
3464
|
+
eventStartMs,
|
|
3465
|
+
eventEndMs,
|
|
3466
|
+
barHours
|
|
3467
|
+
]);
|
|
3468
|
+
const barStyle = useAnimatedStyle(() => {
|
|
3469
|
+
const shift = moveX.value + moveExtra.value.top * hourSize;
|
|
3470
|
+
const grow = resizeW.value + moveExtra.value.hours * hourSize;
|
|
3471
|
+
return vertical ? {
|
|
3472
|
+
transform: [{ translateY: shift }, { translateX: moveCross.value }],
|
|
3473
|
+
height: Math.max(height + grow, 2)
|
|
3474
|
+
} : {
|
|
3475
|
+
transform: [{ translateX: shift }, { translateY: moveCross.value }],
|
|
3476
|
+
width: Math.max(width + grow, 2)
|
|
3477
|
+
};
|
|
3417
3478
|
}, [
|
|
3418
3479
|
vertical,
|
|
3419
3480
|
width,
|
|
3420
|
-
height
|
|
3481
|
+
height,
|
|
3482
|
+
hourSize
|
|
3421
3483
|
]);
|
|
3422
3484
|
const laneId = resources[laneIndex]?.id ?? "";
|
|
3423
3485
|
const moveGesture = useMemo(() => Gesture.Pan().enabled(draggable).activateAfterLongPress(MOVE_ACTIVATE_MS).onStart(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/native",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.2",
|
|
4
4
|
"description": "Gesture-driven, virtualized month / week / day calendar and date picker for React Native (and web via react-native-web).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agenda",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@super-calendar/core": "2.14.
|
|
67
|
+
"@super-calendar/core": "2.14.2"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@legendapp/list": ">=3",
|
|
@@ -12,7 +12,16 @@ import {
|
|
|
12
12
|
type Locale,
|
|
13
13
|
startOfMonth,
|
|
14
14
|
} from "date-fns";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
type ComponentRef,
|
|
17
|
+
memo,
|
|
18
|
+
type ReactElement,
|
|
19
|
+
useCallback,
|
|
20
|
+
useEffect,
|
|
21
|
+
useMemo,
|
|
22
|
+
useRef,
|
|
23
|
+
useState,
|
|
24
|
+
} from "react";
|
|
16
25
|
import {
|
|
17
26
|
type LayoutChangeEvent,
|
|
18
27
|
type NativeScrollEvent,
|
|
@@ -613,7 +622,7 @@ function MonthBlock({
|
|
|
613
622
|
inert: boolean;
|
|
614
623
|
children: React.ReactNode;
|
|
615
624
|
}) {
|
|
616
|
-
const ref = useRef<View
|
|
625
|
+
const ref = useRef<ComponentRef<typeof View>>(null);
|
|
617
626
|
useEffect(() => {
|
|
618
627
|
if (!isWeb) return;
|
|
619
628
|
const node = ref.current as unknown as { inert?: boolean } | null;
|
|
@@ -5,7 +5,16 @@ import {
|
|
|
5
5
|
type OnViewableItemsChangedInfo,
|
|
6
6
|
} from "@legendapp/list/react-native";
|
|
7
7
|
import { addMonths, differenceInCalendarMonths, format, type Locale, startOfMonth } from "date-fns";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
type ComponentRef,
|
|
10
|
+
memo,
|
|
11
|
+
type ReactElement,
|
|
12
|
+
useCallback,
|
|
13
|
+
useEffect,
|
|
14
|
+
useMemo,
|
|
15
|
+
useRef,
|
|
16
|
+
useState,
|
|
17
|
+
} from "react";
|
|
9
18
|
import {
|
|
10
19
|
Platform,
|
|
11
20
|
StyleSheet,
|
|
@@ -178,7 +187,7 @@ function MonthPagerInner<T>({
|
|
|
178
187
|
);
|
|
179
188
|
const { width, height } = useWindowDimensions();
|
|
180
189
|
const listRef = useRef<LegendListRef>(null);
|
|
181
|
-
const containerRef = useRef<View
|
|
190
|
+
const containerRef = useRef<ComponentRef<typeof View>>(null);
|
|
182
191
|
|
|
183
192
|
// Web: LegendList's horizontal scroll container is `overflow-x: auto`, so a
|
|
184
193
|
// trackpad swipe or horizontal wheel would page between months. Paging should be
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { format, type Locale, isSameMonth, startOfDay } from "date-fns";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type ComponentRef,
|
|
4
|
+
memo,
|
|
5
|
+
type ReactElement,
|
|
6
|
+
useCallback,
|
|
7
|
+
useEffect,
|
|
8
|
+
useMemo,
|
|
9
|
+
useRef,
|
|
10
|
+
useState,
|
|
11
|
+
} from "react";
|
|
3
12
|
import {
|
|
4
13
|
type DimensionValue,
|
|
5
14
|
type LayoutChangeEvent,
|
|
@@ -420,7 +429,7 @@ function MonthViewInner<T>({
|
|
|
420
429
|
|
|
421
430
|
// ---- drag to create a day span / reschedule an event ----------------------
|
|
422
431
|
const dragEnabled = onCreateEvent != null || onSelectDrag != null || onDragEvent != null;
|
|
423
|
-
const gridRef = useRef<View
|
|
432
|
+
const gridRef = useRef<ComponentRef<typeof View>>(null);
|
|
424
433
|
// The live drag drives the preview; the ref is what the gesture and the web
|
|
425
434
|
// pointer listeners read, so neither has to be rebuilt as the hover day moves
|
|
426
435
|
// (rebuilding the gesture mid-drag would cancel it).
|
|
@@ -7,7 +7,7 @@ import Animated, {
|
|
|
7
7
|
useAnimatedStyle,
|
|
8
8
|
useDerivedValue,
|
|
9
9
|
} from "react-native-reanimated";
|
|
10
|
-
import { shiftMinutes } from "@super-calendar/core";
|
|
10
|
+
import { clockHoursBetween, shiftMinutes, wallClockHours } from "@super-calendar/core";
|
|
11
11
|
import type { CalendarEvent, CalendarMode, RenderEvent } from "../types";
|
|
12
12
|
import { useCalendarTheme } from "../theme";
|
|
13
13
|
import { useSlots } from "../utils/slots";
|
|
@@ -91,11 +91,11 @@ function PreviewDay<T>({
|
|
|
91
91
|
).getTime();
|
|
92
92
|
const end = start + duration;
|
|
93
93
|
const visible = !lifted.value && start < dayEnd && end > dayStart;
|
|
94
|
+
const segStart = new Date(Math.max(start, dayStart));
|
|
95
|
+
const segEnd = new Date(Math.min(end, dayEnd));
|
|
94
96
|
return {
|
|
95
|
-
top: (
|
|
96
|
-
hours: visible
|
|
97
|
-
? Math.max((Math.min(end, dayEnd) - Math.max(start, dayStart)) / 3_600_000, 0.25)
|
|
98
|
-
: 0,
|
|
97
|
+
top: wallClockHours(segStart, new Date(dayStart), new Date(dayEnd)),
|
|
98
|
+
hours: visible ? Math.max(clockHoursBetween(segStart, segEnd), 0.25) : 0,
|
|
99
99
|
continuesBefore: start < dayStart,
|
|
100
100
|
continuesAfter: end > dayEnd,
|
|
101
101
|
};
|
|
@@ -11,7 +11,12 @@ import {
|
|
|
11
11
|
View,
|
|
12
12
|
} from "react-native";
|
|
13
13
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
14
|
-
import Animated, {
|
|
14
|
+
import Animated, {
|
|
15
|
+
runOnJS,
|
|
16
|
+
useAnimatedStyle,
|
|
17
|
+
useDerivedValue,
|
|
18
|
+
useSharedValue,
|
|
19
|
+
} from "react-native-reanimated";
|
|
15
20
|
import {
|
|
16
21
|
backgroundBandsForDay,
|
|
17
22
|
type CalendarEvent,
|
|
@@ -24,6 +29,7 @@ import {
|
|
|
24
29
|
eventTimeLabel,
|
|
25
30
|
formatHour,
|
|
26
31
|
layoutDayEvents,
|
|
32
|
+
movedClockSpan,
|
|
27
33
|
type PositionedEvent,
|
|
28
34
|
resolveDraggedBounds,
|
|
29
35
|
snapDeltaMinutes,
|
|
@@ -38,6 +44,8 @@ const MOVE_ACTIVATE_MS = 250;
|
|
|
38
44
|
// a plain mouse drag creates (mirrors the time grid).
|
|
39
45
|
const DRAG_ACTIVATE_PX = 8;
|
|
40
46
|
const MINUTES_PER_HOUR = 60;
|
|
47
|
+
// `moveExtra` for a bar that isn't moving; shared so the hot path allocates nothing.
|
|
48
|
+
const NO_MOVE_EXTRA = { top: 0, hours: 0 };
|
|
41
49
|
const isWeb = Platform.OS === "web";
|
|
42
50
|
|
|
43
51
|
/** A schedulable lane (room, person, machine) events are grouped under. */
|
|
@@ -376,19 +384,41 @@ function ResourceBar<T>({
|
|
|
376
384
|
}
|
|
377
385
|
: undefined;
|
|
378
386
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
// Where a move in progress lands beyond its plain offset, in hours: a start in
|
|
388
|
+
// the hour a spring-forward change skips moves on past it (`top`), and the kept
|
|
389
|
+
// elapsed duration covers a different number of hours on the axis once a DST
|
|
390
|
+
// change falls inside it or stops falling inside it (`hours`). Timestamps, not
|
|
391
|
+
// `Date`s, so the worklet can capture them; a bar clipped to the day keeps its
|
|
392
|
+
// plain offset.
|
|
393
|
+
const eventStartMs = pe.event.start.getTime();
|
|
394
|
+
const eventEndMs = pe.event.end.getTime();
|
|
395
|
+
const clipped = pe.continuesBefore || pe.continuesAfter;
|
|
396
|
+
const barHours = pe.durationHours;
|
|
397
|
+
const moveExtra = useDerivedValue(() => {
|
|
398
|
+
if (clipped || moveX.value === 0 || hourSize <= 0) return NO_MOVE_EXTRA;
|
|
399
|
+
const minutes = Math.round((moveX.value / hourSize) * MINUTES_PER_HOUR);
|
|
400
|
+
const from = new Date(eventStartMs);
|
|
401
|
+
const to = new Date(eventEndMs);
|
|
402
|
+
const moved = movedClockSpan(from, to, minutes);
|
|
403
|
+
return {
|
|
404
|
+
top: moved.startHours - minutes / MINUTES_PER_HOUR,
|
|
405
|
+
hours: moved.hours - barHours,
|
|
406
|
+
};
|
|
407
|
+
}, [clipped, hourSize, eventStartMs, eventEndMs, barHours]);
|
|
408
|
+
|
|
409
|
+
const barStyle = useAnimatedStyle(() => {
|
|
410
|
+
const shift = moveX.value + moveExtra.value.top * hourSize;
|
|
411
|
+
const grow = resizeW.value + moveExtra.value.hours * hourSize;
|
|
412
|
+
return vertical
|
|
413
|
+
? {
|
|
414
|
+
transform: [{ translateY: shift }, { translateX: moveCross.value }],
|
|
415
|
+
height: Math.max(height + grow, 2),
|
|
416
|
+
}
|
|
417
|
+
: {
|
|
418
|
+
transform: [{ translateX: shift }, { translateY: moveCross.value }],
|
|
419
|
+
width: Math.max((width as number) + grow, 2),
|
|
420
|
+
};
|
|
421
|
+
}, [vertical, width, height, hourSize]);
|
|
392
422
|
|
|
393
423
|
const laneId = resources[laneIndex]?.id ?? "";
|
|
394
424
|
const moveGesture = useMemo(
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
startOfWeek,
|
|
17
17
|
} from "date-fns";
|
|
18
18
|
import {
|
|
19
|
+
type ComponentRef,
|
|
19
20
|
createContext,
|
|
20
21
|
type Dispatch,
|
|
21
22
|
type ForwardedRef,
|
|
@@ -91,6 +92,7 @@ import {
|
|
|
91
92
|
overlapsOtherEvents,
|
|
92
93
|
pageStepDays,
|
|
93
94
|
resolveDraggedBounds,
|
|
95
|
+
movedClockSpan,
|
|
94
96
|
snapDeltaMinutes,
|
|
95
97
|
} from "@super-calendar/core";
|
|
96
98
|
import { formatHour, layoutDayEvents, type PositionedEvent } from "@super-calendar/core";
|
|
@@ -129,6 +131,8 @@ type WebKeyTarget = {
|
|
|
129
131
|
const MINUTES_PER_HOUR = 60;
|
|
130
132
|
const HOURS_PER_DAY = 24;
|
|
131
133
|
const MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
|
|
134
|
+
// `moveExtra` for a box that isn't moving; shared so the hot path allocates nothing.
|
|
135
|
+
const NO_MOVE_EXTRA = { top: 0, hours: 0 };
|
|
132
136
|
// Steps rendered either side of the current page. LegendList virtualises, so
|
|
133
137
|
// only a few mount at once; a wide window means the user effectively never runs
|
|
134
138
|
// out of pages to swipe. Items are keyed by date and never recycled.
|
|
@@ -514,6 +518,40 @@ function AnimatedEventBoxInner<T>({
|
|
|
514
518
|
[startHours, ownsStart],
|
|
515
519
|
);
|
|
516
520
|
|
|
521
|
+
// Where a move in progress lands beyond its plain row offset, in hours: a start
|
|
522
|
+
// in the hour a spring-forward change skips moves on past it (`top`), and the
|
|
523
|
+
// kept elapsed duration covers a different number of rows once a DST change
|
|
524
|
+
// falls inside it or stops falling inside it (`hours`). Timestamps, not the
|
|
525
|
+
// event's `Date`s, so the worklet can capture them; a multi-day segment
|
|
526
|
+
// previews through `MultiDayMovePreview` instead.
|
|
527
|
+
const eventStartMs = positioned.event.start.getTime();
|
|
528
|
+
const eventEndMs = positioned.event.end.getTime();
|
|
529
|
+
const moveExtra = useDerivedValue(() => {
|
|
530
|
+
if (multiDay || lifted.value || cellHeight.value <= 0) return NO_MOVE_EXTRA;
|
|
531
|
+
if (moveOffset.value === 0 && moveOffsetX.value === 0) return NO_MOVE_EXTRA;
|
|
532
|
+
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
533
|
+
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayCount - 1);
|
|
534
|
+
const minutes =
|
|
535
|
+
Math.round((moveOffset.value / cellHeight.value) * MINUTES_PER_HOUR) +
|
|
536
|
+
(dayOrdinals[target] - dayOrdinals[dayIndex]) * MINUTES_PER_DAY;
|
|
537
|
+
const from = new Date(eventStartMs);
|
|
538
|
+
const to = new Date(eventEndMs);
|
|
539
|
+
const moved = movedClockSpan(from, to, minutes);
|
|
540
|
+
return {
|
|
541
|
+
top: moved.startHours - minutes / MINUTES_PER_HOUR,
|
|
542
|
+
hours: moved.hours - durationHours,
|
|
543
|
+
};
|
|
544
|
+
}, [
|
|
545
|
+
multiDay,
|
|
546
|
+
dayWidth,
|
|
547
|
+
dayIndex,
|
|
548
|
+
dayCount,
|
|
549
|
+
dayOrdinals,
|
|
550
|
+
eventStartMs,
|
|
551
|
+
eventEndMs,
|
|
552
|
+
durationHours,
|
|
553
|
+
]);
|
|
554
|
+
|
|
517
555
|
// Live pixel height of the box, driven on the UI thread by the shared
|
|
518
556
|
// cellHeight (plus any in-progress resize). Handed to renderEvent so custom
|
|
519
557
|
// renderers can reveal detail progressively as the grid zooms, without
|
|
@@ -521,7 +559,9 @@ function AnimatedEventBoxInner<T>({
|
|
|
521
559
|
const boxHeight = useDerivedValue(
|
|
522
560
|
() =>
|
|
523
561
|
Math.max(
|
|
524
|
-
durationHours
|
|
562
|
+
(durationHours + moveExtra.value.hours) * cellHeight.value +
|
|
563
|
+
resizeDelta.value -
|
|
564
|
+
resizeStartDelta.value,
|
|
525
565
|
minEventHeight,
|
|
526
566
|
),
|
|
527
567
|
[durationHours, minEventHeight],
|
|
@@ -533,7 +573,9 @@ function AnimatedEventBoxInner<T>({
|
|
|
533
573
|
// math and the floating cross-page ghost.
|
|
534
574
|
const visibleBoxHeight = useDerivedValue(() => {
|
|
535
575
|
const top =
|
|
536
|
-
(startHours - minHour) * cellHeight.value +
|
|
576
|
+
(startHours + moveExtra.value.top - minHour) * cellHeight.value +
|
|
577
|
+
moveOffset.value +
|
|
578
|
+
resizeStartDelta.value;
|
|
537
579
|
const dayEnd = (HOURS_PER_DAY - minHour) * cellHeight.value;
|
|
538
580
|
return Math.max(Math.min(boxHeight.value, dayEnd - top), minEventHeight);
|
|
539
581
|
}, [startHours, minHour, minEventHeight]);
|
|
@@ -541,7 +583,9 @@ function AnimatedEventBoxInner<T>({
|
|
|
541
583
|
const boxStyle = useAnimatedStyle(() => {
|
|
542
584
|
// A top-edge resize pushes the box down and shortens it (start moves later).
|
|
543
585
|
const top =
|
|
544
|
-
(startHours - minHour) * cellHeight.value +
|
|
586
|
+
(startHours + moveExtra.value.top - minHour) * cellHeight.value +
|
|
587
|
+
moveOffset.value +
|
|
588
|
+
resizeStartDelta.value;
|
|
545
589
|
// Cut the box off at midnight; whatever runs past it shows in the next column
|
|
546
590
|
// instead (see MoveSpillPreview), the way a committed event spanning midnight
|
|
547
591
|
// already renders. Purely geometric, so a resting box (already clipped to the
|
|
@@ -565,8 +609,9 @@ function AnimatedEventBoxInner<T>({
|
|
|
565
609
|
// moved, which is every box but one.
|
|
566
610
|
const spillHeight = useDerivedValue(() => {
|
|
567
611
|
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
568
|
-
const
|
|
569
|
-
const
|
|
612
|
+
const extra = moveExtra.value;
|
|
613
|
+
const liveStartHours = startHours + extra.top + moveOffset.value / cellHeight.value;
|
|
614
|
+
const overflowHours = liveStartHours + durationHours + extra.hours - HOURS_PER_DAY;
|
|
570
615
|
if (overflowHours <= 0) return 0;
|
|
571
616
|
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
572
617
|
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayCount - 1);
|
|
@@ -2458,13 +2503,13 @@ function TimeGridInner<T>(
|
|
|
2458
2503
|
const listRef = useRef<LegendListRef>(null);
|
|
2459
2504
|
// The pager's own view; measured in the window so an event drag can locate the
|
|
2460
2505
|
// horizontal edges (its screen-space left and width) for cross-week paging.
|
|
2461
|
-
const pagerRef = useRef<View
|
|
2506
|
+
const pagerRef = useRef<ComponentRef<typeof View>>(null);
|
|
2462
2507
|
// The grid's outer view; on web its ref resolves to the DOM node we attach the
|
|
2463
2508
|
// Ctrl/Cmd + scroll zoom listener to.
|
|
2464
|
-
const containerRef = useRef<View
|
|
2509
|
+
const containerRef = useRef<ComponentRef<typeof View>>(null);
|
|
2465
2510
|
// The scroll viewport; measured in the window so a lifted drag can map the
|
|
2466
2511
|
// finger into the scrolling content.
|
|
2467
|
-
const viewportRef = useRef<View
|
|
2512
|
+
const viewportRef = useRef<ComponentRef<typeof View>>(null);
|
|
2468
2513
|
// Width the pager last laid out at, so the zoom (which changes its height every
|
|
2469
2514
|
// frame) doesn't re-measure it.
|
|
2470
2515
|
const pagerLayoutWidthRef = useRef(-1);
|
|
@@ -2519,8 +2564,19 @@ function TimeGridInner<T>(
|
|
|
2519
2564
|
node.scrollTo({ y: seedDefaultY, animated: false });
|
|
2520
2565
|
// Latch only once the view can hold the offset: until both the viewport and
|
|
2521
2566
|
// the content have a size, the scroll clamps to 0 and would drop the seed.
|
|
2522
|
-
|
|
2523
|
-
|
|
2567
|
+
// Native types expose a node handle; react-native-web returns a DOM element.
|
|
2568
|
+
const dom: unknown = node.getScrollableNode();
|
|
2569
|
+
if (
|
|
2570
|
+
dom != null &&
|
|
2571
|
+
typeof dom === "object" &&
|
|
2572
|
+
"scrollHeight" in dom &&
|
|
2573
|
+
typeof dom.scrollHeight === "number" &&
|
|
2574
|
+
"clientHeight" in dom &&
|
|
2575
|
+
typeof dom.clientHeight === "number" &&
|
|
2576
|
+
dom.scrollHeight > dom.clientHeight
|
|
2577
|
+
) {
|
|
2578
|
+
webSeededRef.current = true;
|
|
2579
|
+
}
|
|
2524
2580
|
}, [scrollRef, seedDefaultY]);
|
|
2525
2581
|
// Height of the all-day band, shared by the hour column and every page. Each
|
|
2526
2582
|
// page reports its lane's natural height under its index, and the band follows
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
View,
|
|
12
12
|
type ScrollViewProps,
|
|
13
13
|
} from "react-native";
|
|
14
|
-
import { Gesture, GestureDetector
|
|
14
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
15
15
|
import { useCalendarTheme } from "../theme";
|
|
16
16
|
import type { CalendarEvent, WeekStartsOn } from "../types";
|
|
17
17
|
import { createSlots, type SlotStyleProps } from "../utils/slots";
|
|
@@ -522,7 +522,7 @@ function MiniMonthGrid({
|
|
|
522
522
|
if (day.getMonth() !== current.getMonth()) return null;
|
|
523
523
|
return selectable(day) ? day : null;
|
|
524
524
|
}, []);
|
|
525
|
-
const gesture = useMemo
|
|
525
|
+
const gesture = useMemo(() => {
|
|
526
526
|
if (!sweepEnabled) return undefined;
|
|
527
527
|
return Gesture.Pan()
|
|
528
528
|
.activateAfterLongPress(DRAG_HOLD_MS)
|