@super-calendar/native 2.6.0 → 2.8.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.
@@ -1,5 +1,5 @@
1
- import type { ComponentType, ReactElement } from "react";
2
- import { useCallback, useEffect, useMemo, useRef } from "react";
1
+ import type { ComponentType, ReactElement, ReactNode } from "react";
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
3
  import {
4
4
  type AccessibilityActionEvent,
5
5
  type GestureResponderEvent,
@@ -13,8 +13,13 @@ import {
13
13
  import { Gesture, GestureDetector } from "react-native-gesture-handler";
14
14
  import Animated, { runOnJS, useAnimatedStyle, useSharedValue } from "react-native-reanimated";
15
15
  import {
16
+ backgroundBandsForDay,
16
17
  type CalendarEvent,
17
18
  cellRangeFromDrag,
19
+ isSameCalendarDay,
20
+ useNow,
21
+ type BusinessHoursBand,
22
+ type BusinessHoursValue,
18
23
  closedHourBands,
19
24
  eventTimeLabel,
20
25
  formatHour,
@@ -67,6 +72,19 @@ export interface ResourceTimelineProps<T = unknown> {
67
72
  orientation?: "horizontal" | "vertical";
68
73
  /** The resource lanes: rows when horizontal, columns when vertical. */
69
74
  resources: Resource[];
75
+ /**
76
+ * Cap the number of lanes shown at once; the rest sit on further pages. Pair
77
+ * with `resourcePage` and your own prev/next controls to page through them
78
+ * (like `date` drives the time axis). Omit to show every lane, sharing the
79
+ * available space.
80
+ */
81
+ resourcesPerPage?: number;
82
+ /**
83
+ * The 0-based page of lanes to show when `resourcesPerPage` is set (default
84
+ * 0, clamped to the last page). Controlled: update it from your own paging
85
+ * controls.
86
+ */
87
+ resourcePage?: number;
70
88
  /** Events; each is placed in the row named by `resourceId(event)`. */
71
89
  events: CalendarEvent<T>[];
72
90
  /** Read an event's resource id. Default: `event.resourceId`. */
@@ -95,11 +113,19 @@ export interface ResourceTimelineProps<T = unknown> {
95
113
  */
96
114
  onLongPressEvent?: (event: CalendarEvent<T>) => void;
97
115
  /**
98
- * Enables drag-to-move and edge-resize along the time axis: long-press a bar to
99
- * move it, or drag its right edge to resize. Called with the proposed new
100
- * start/end; return `false` to reject the drop (it snaps back).
116
+ * Enables drag-to-move and edge-resize: long-press a bar to move it along the
117
+ * time axis or across lanes, or drag its trailing edge to resize. Called with
118
+ * the proposed new start/end and the lane the bar was dropped in (the original
119
+ * lane when it didn't cross); retarget the event's resource from it. Return
120
+ * `false` to reject the drop (it snaps back). Only visible lanes are drop
121
+ * targets (see `resourcesPerPage`).
101
122
  */
102
- onDragEvent?: (event: CalendarEvent<T>, start: Date, end: Date) => void | boolean;
123
+ onDragEvent?: (
124
+ event: CalendarEvent<T>,
125
+ start: Date,
126
+ end: Date,
127
+ resource: Resource,
128
+ ) => void | boolean;
103
129
  /** Tap empty lane space; called with the snapped time and the lane's resource. */
104
130
  onPressCell?: (at: Date, resource: Resource) => void;
105
131
  /**
@@ -117,9 +143,30 @@ export interface ResourceTimelineProps<T = unknown> {
117
143
  * `businessHours` plus the lane's resource, so per-resource opening hours work
118
144
  * (return `null` for a fully closed lane). A date-only function is accepted.
119
145
  */
120
- businessHours?: (date: Date, resource: Resource) => { start: number; end: number } | null;
146
+ businessHours?: (date: Date, resource: Resource) => BusinessHoursValue;
147
+ /**
148
+ * Render a closed-hours band's content yourself (a label, icon, pattern). The
149
+ * board keeps positioning the band; when set, the themed tint is dropped and
150
+ * your output fills the band instead. Receives the lane's resource. Decorative only: the
151
+ * band stays non-interactive and hidden from assistive tech.
152
+ */
153
+ renderBusinessHours?: (band: BusinessHoursBand & { resource: Resource }) => ReactNode;
154
+ /**
155
+ * Render each resource's header cell yourself (an avatar, a subtitle, a status
156
+ * dot). Receives the resource and its index; return the cell's content. The board
157
+ * keeps the header cell's sizing so columns stay aligned, so this replaces only
158
+ * the label content. Falls back to the resource title (or id). Applies to both
159
+ * orientations: the top header cells when vertical, the row labels when horizontal.
160
+ */
161
+ renderResourceHeader?: (resource: Resource, index: number) => ReactNode;
121
162
  /** Snap dragged events to this many minutes (default 15). */
122
163
  dragStepMinutes?: number;
164
+ /** Show the current-time line when `date` is today (default true). */
165
+ showNowIndicator?: boolean;
166
+ /** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
167
+ now?: Date;
168
+ /** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
169
+ timeZone?: string;
123
170
  }
124
171
 
125
172
  const clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));
@@ -186,7 +233,22 @@ type ResourceBarProps<T> = {
186
233
  Renderer: ComponentType<ResourceEventArgs<T>>;
187
234
  onPress: () => void;
188
235
  onLongPress?: () => void;
189
- onDragEvent: (event: CalendarEvent<T>, start: Date, end: Date) => void | boolean;
236
+ onDragEvent: (
237
+ event: CalendarEvent<T>,
238
+ start: Date,
239
+ end: Date,
240
+ resource: Resource,
241
+ ) => void | boolean;
242
+ /** The visible lanes, for cross-lane drops and their screen-reader actions. */
243
+ resources: Resource[];
244
+ /** This bar's lane index within `resources`. */
245
+ laneIndex: number;
246
+ /** Cross-axis pixels per lane; 0 disables cross-lane dragging (unmeasured). */
247
+ laneSize: number;
248
+ /** True while a drag on this bar's lane is live (holds the preview until settle). */
249
+ dragActive: boolean;
250
+ /** Raise this bar's lane above its siblings while a drag is live. */
251
+ onDragActiveChange: (laneId: string | null) => void;
190
252
  theme: ReturnType<typeof useCalendarTheme>;
191
253
  };
192
254
 
@@ -208,28 +270,45 @@ function ResourceBar<T>({
208
270
  onPress,
209
271
  onLongPress,
210
272
  onDragEvent,
273
+ resources,
274
+ laneIndex,
275
+ laneSize,
276
+ dragActive,
277
+ onDragActiveChange,
211
278
  theme,
212
279
  }: ResourceBarProps<T>): ReactElement {
213
280
  const moveX = useSharedValue(0);
281
+ const moveCross = useSharedValue(0);
214
282
  const resizeW = useSharedValue(0);
215
- const latest = useRef({ event: pe.event, onDragEvent });
216
- latest.current = { event: pe.event, onDragEvent };
217
- const draggable = !(pe.event as { disabled?: boolean }).disabled;
283
+ const latest = useRef({ event: pe.event, onDragEvent, resources, laneIndex });
284
+ latest.current = { event: pe.event, onDragEvent, resources, laneIndex };
285
+ const laneCount = resources.length;
286
+ // `draggable: false` locks a single bar (keeps taps, blocks move/resize).
287
+ const draggable =
288
+ !(pe.event as { disabled?: boolean }).disabled &&
289
+ (pe.event as { draggable?: boolean }).draggable !== false;
218
290
 
219
- // Clear the live preview once the committed change re-renders the bar.
291
+ // Clear the live preview when the drag on this lane settles, or when a
292
+ // committed change re-renders the bar. Skip while a drag is active so this
293
+ // never clobbers the in-flight preview; the cross-lane offset is held through
294
+ // the drag (so a relocation stays seamless) and cleared here on settle, which
295
+ // also snaps a bar back when the handler accepts the move without relocating.
220
296
  useEffect(() => {
297
+ if (dragActive) return;
221
298
  moveX.value = 0;
299
+ moveCross.value = 0;
222
300
  resizeW.value = 0;
223
- }, [pe.startHours, pe.durationHours, moveX, resizeW]);
301
+ }, [dragActive, pe.startHours, pe.durationHours, moveX, moveCross, resizeW]);
224
302
 
225
303
  const snapBack = useCallback(() => {
226
304
  moveX.value = 0;
305
+ moveCross.value = 0;
227
306
  resizeW.value = 0;
228
- }, [moveX, resizeW]);
307
+ }, [moveX, moveCross, resizeW]);
229
308
 
230
309
  const commit = useCallback(
231
- (deltaStartMin: number, deltaEndMin: number) => {
232
- const { event, onDragEvent: handler } = latest.current;
310
+ (deltaStartMin: number, deltaEndMin: number, laneDelta = 0) => {
311
+ const { event, onDragEvent: handler, resources: lanes, laneIndex: lane } = latest.current;
233
312
  const next = resolveDraggedBounds(
234
313
  event.start,
235
314
  event.end,
@@ -237,11 +316,12 @@ function ResourceBar<T>({
237
316
  deltaEndMin,
238
317
  snapMinutes,
239
318
  );
240
- if (!next) {
319
+ const target = lanes[Math.min(Math.max(lane + laneDelta, 0), lanes.length - 1)];
320
+ if (!next || !target) {
241
321
  snapBack();
242
322
  return;
243
323
  }
244
- if (handler(event, next.start, next.end) === false) snapBack();
324
+ if (handler(event, next.start, next.end, target) === false) snapBack();
245
325
  },
246
326
  [snapMinutes, snapBack],
247
327
  );
@@ -251,12 +331,17 @@ function ResourceBar<T>({
251
331
  // resize grip is a non-focusable visual/gesture affordance, so an `adjustable`
252
332
  // role there would never receive focus on a real device).
253
333
  const unit = (n: number) => `${n} minute${n === 1 ? "" : "s"}`;
334
+ const laneTitle = (lane?: Resource) => lane && (lane.title || lane.id);
335
+ const nextLane = laneTitle(resources[laneIndex + 1]);
336
+ const previousLane = laneTitle(resources[laneIndex - 1]);
254
337
  const barActions = draggable
255
338
  ? [
256
339
  { name: "move-later", label: `Move ${unit(snapMinutes)} later` },
257
340
  { name: "move-earlier", label: `Move ${unit(snapMinutes)} earlier` },
258
341
  { name: "extend", label: `Extend by ${unit(snapMinutes)}` },
259
342
  { name: "shrink", label: `Shorten by ${unit(snapMinutes)}` },
343
+ ...(nextLane ? [{ name: "move-next-lane", label: `Move to ${nextLane}` }] : []),
344
+ ...(previousLane ? [{ name: "move-previous-lane", label: `Move to ${previousLane}` }] : []),
260
345
  ]
261
346
  : undefined;
262
347
  const onBarAction = draggable
@@ -274,6 +359,12 @@ function ResourceBar<T>({
274
359
  case "shrink":
275
360
  commit(0, -snapMinutes);
276
361
  break;
362
+ case "move-next-lane":
363
+ commit(0, 0, 1);
364
+ break;
365
+ case "move-previous-lane":
366
+ commit(0, 0, -1);
367
+ break;
277
368
  }
278
369
  }
279
370
  : undefined;
@@ -282,35 +373,74 @@ function ResourceBar<T>({
282
373
  () =>
283
374
  vertical
284
375
  ? {
285
- transform: [{ translateY: moveX.value }],
376
+ transform: [{ translateY: moveX.value }, { translateX: moveCross.value }],
286
377
  height: Math.max(height + resizeW.value, 2),
287
378
  }
288
379
  : {
289
- transform: [{ translateX: moveX.value }],
380
+ transform: [{ translateX: moveX.value }, { translateY: moveCross.value }],
290
381
  width: Math.max((width as number) + resizeW.value, 2),
291
382
  },
292
383
  [vertical, width, height],
293
384
  );
294
385
 
386
+ const laneId = resources[laneIndex]?.id ?? "";
295
387
  const moveGesture = useMemo(
296
388
  () =>
297
389
  Gesture.Pan()
298
390
  .enabled(draggable)
299
391
  .activateAfterLongPress(MOVE_ACTIVATE_MS)
392
+ .onStart(() => {
393
+ // Lift this bar's lane above its siblings so the preview isn't
394
+ // painted under later lanes (RN zIndex only orders siblings).
395
+ runOnJS(onDragActiveChange)(laneId);
396
+ })
300
397
  .onUpdate((e) => {
301
398
  moveX.value = vertical ? e.translationY : e.translationX;
399
+ if (laneSize > 0 && laneCount > 1) {
400
+ const cross = vertical ? e.translationX : e.translationY;
401
+ moveCross.value = Math.min(
402
+ Math.max(cross, -laneIndex * laneSize),
403
+ (laneCount - 1 - laneIndex) * laneSize,
404
+ );
405
+ }
302
406
  })
303
407
  .onEnd((e) => {
304
408
  const translation = vertical ? e.translationY : e.translationX;
305
409
  const delta = snapDeltaMinutes(translation, hourSize, snapMinutes);
306
- if (delta === 0) {
410
+ const cross = laneSize > 0 ? (vertical ? e.translationX : e.translationY) : 0;
411
+ const laneDelta =
412
+ laneSize > 0
413
+ ? Math.min(
414
+ Math.max(Math.round(cross / laneSize), -laneIndex),
415
+ laneCount - 1 - laneIndex,
416
+ )
417
+ : 0;
418
+ if (delta === 0 && laneDelta === 0) {
307
419
  moveX.value = 0;
420
+ moveCross.value = 0;
308
421
  return;
309
422
  }
310
423
  moveX.value = (delta / MINUTES_PER_HOUR) * hourSize;
311
- runOnJS(commit)(delta, delta);
424
+ moveCross.value = laneDelta * laneSize;
425
+ runOnJS(commit)(delta, delta, laneDelta);
426
+ })
427
+ .onFinalize(() => {
428
+ runOnJS(onDragActiveChange)(null);
312
429
  }),
313
- [draggable, vertical, hourSize, snapMinutes, moveX, commit],
430
+ [
431
+ draggable,
432
+ vertical,
433
+ hourSize,
434
+ snapMinutes,
435
+ laneSize,
436
+ laneCount,
437
+ laneIndex,
438
+ laneId,
439
+ moveX,
440
+ moveCross,
441
+ commit,
442
+ onDragActiveChange,
443
+ ],
314
444
  );
315
445
 
316
446
  const resizeGesture = useMemo(
@@ -564,7 +694,9 @@ function LaneInteractionLayer({
564
694
  export function ResourceTimeline<T = unknown>({
565
695
  date,
566
696
  orientation = "horizontal",
567
- resources,
697
+ resources: allResources,
698
+ resourcesPerPage,
699
+ resourcePage = 0,
568
700
  events,
569
701
  resourceId = (event) => (event as { resourceId?: string }).resourceId,
570
702
  startHour = 0,
@@ -582,16 +714,74 @@ export function ResourceTimeline<T = unknown>({
582
714
  onLongPressCell,
583
715
  onCreateEvent,
584
716
  businessHours,
717
+ renderBusinessHours,
718
+ renderResourceHeader,
585
719
  dragStepMinutes = 15,
720
+ showNowIndicator = true,
721
+ now: nowProp,
722
+ timeZone,
586
723
  }: ResourceTimelineProps<T>): ReactElement {
587
724
  const theme = useCalendarTheme();
725
+ // Window the lanes to the requested page when resourcesPerPage caps them.
726
+ const resources = useMemo(() => {
727
+ if (!resourcesPerPage || resourcesPerPage <= 0) return allResources;
728
+ const pages = Math.max(1, Math.ceil(allResources.length / resourcesPerPage));
729
+ const page = Math.min(Math.max(resourcePage, 0), pages - 1);
730
+ return allResources.slice(page * resourcesPerPage, (page + 1) * resourcesPerPage);
731
+ }, [allResources, resourcesPerPage, resourcePage]);
732
+ // The lane a bar is being dragged in, lifted above its siblings (RN zIndex
733
+ // only orders siblings, so the lane itself must be raised for the cross-lane
734
+ // preview to stay visible).
735
+ const [dragLaneId, setDragLaneId] = useState<string | null>(null);
736
+ // Vertical columns flex, so measure the body to get the per-lane width.
737
+ const [vBodyWidth, setVBodyWidth] = useState(0);
738
+ const vLaneSize =
739
+ resources.length > 0 && vBodyWidth > GUTTER_WIDTH
740
+ ? (vBodyWidth - GUTTER_WIDTH) / resources.length
741
+ : 0;
588
742
  const Renderer = renderEvent ?? DefaultBar;
589
743
  const cellEnabled = !!onPressCell || !!onLongPressCell || !!onCreateEvent;
744
+ // The current-time line, shown only when the board's day is the zone's today.
745
+ const now = useNow(showNowIndicator, { now: nowProp, timeZone });
746
+ const nowHours = now.getHours() + now.getMinutes() / 60;
747
+ const showNow =
748
+ showNowIndicator &&
749
+ isSameCalendarDay(now, date) &&
750
+ nowHours >= startHour &&
751
+ nowHours <= endHour;
752
+ const nowLine = (vertical: boolean, hourSize: number) =>
753
+ showNow ? (
754
+ <View
755
+ pointerEvents="none"
756
+ testID="resource-now-indicator"
757
+ style={[
758
+ vertical
759
+ ? { position: "absolute", left: 0, right: 0, height: 2 }
760
+ : { position: "absolute", top: 0, bottom: 0, width: 2 },
761
+ vertical
762
+ ? { top: (nowHours - startHour) * hourSize }
763
+ : { left: (nowHours - startHour) * hourSize },
764
+ { backgroundColor: theme.colors.nowIndicator, zIndex: 2 },
765
+ ]}
766
+ />
767
+ ) : null;
590
768
  // The closed-hours bands to shade in a lane, resolved per resource.
591
769
  const bandsFor = (resource: Resource) =>
592
770
  businessHours
593
771
  ? closedHourBands(date, (d) => businessHours(d, resource), startHour, endHour)
594
772
  : [];
773
+ // `display: "background"` events in a lane, clipped to the visible window.
774
+ const backgroundBandsFor = (resource: Resource) =>
775
+ backgroundBandsForDay(
776
+ events.filter((event) => resourceId(event) === resource.id),
777
+ date,
778
+ )
779
+ .map((b) => ({
780
+ ...b,
781
+ startHours: Math.max(b.startHours, startHour),
782
+ endHours: Math.min(b.endHours, endHour),
783
+ }))
784
+ .filter((b) => b.endHours > b.startHours);
595
785
 
596
786
  const hours = useMemo(
597
787
  () => Array.from({ length: Math.max(0, endHour - startHour) }, (_, i) => startHour + i),
@@ -618,20 +808,27 @@ export function ResourceTimeline<T = unknown>({
618
808
  <View style={styles.vroot}>
619
809
  <View style={[styles.header, { borderBottomColor: theme.colors.gridLine }]}>
620
810
  <View style={{ width: GUTTER_WIDTH }} />
621
- {resources.map((resource) => (
811
+ {resources.map((resource, index) => (
622
812
  <View key={resource.id} style={[styles.vheaderCell, theme.containers.resourceLabel]}>
623
- <Text
624
- numberOfLines={1}
625
- style={[styles.vheaderText, { color: theme.colors.text }]}
626
- allowFontScaling={false}
627
- >
628
- {resource.title ?? resource.id}
629
- </Text>
813
+ {renderResourceHeader ? (
814
+ renderResourceHeader(resource, index)
815
+ ) : (
816
+ <Text
817
+ numberOfLines={1}
818
+ style={[styles.vheaderText, { color: theme.colors.text }]}
819
+ allowFontScaling={false}
820
+ >
821
+ {resource.title ?? resource.id}
822
+ </Text>
823
+ )}
630
824
  </View>
631
825
  ))}
632
826
  </View>
633
827
  <ScrollView showsVerticalScrollIndicator>
634
- <View style={[styles.vbody, { height: trackHeight }]}>
828
+ <View
829
+ style={[styles.vbody, { height: trackHeight }]}
830
+ onLayout={(event) => setVBodyWidth(event.nativeEvent.layout.width)}
831
+ >
635
832
  <View style={{ width: GUTTER_WIDTH }}>
636
833
  {hours.map((h) => (
637
834
  <Text
@@ -649,7 +846,7 @@ export function ResourceTimeline<T = unknown>({
649
846
  </Text>
650
847
  ))}
651
848
  </View>
652
- {resources.map((resource) => {
849
+ {resources.map((resource, laneIndex) => {
653
850
  const positioned = byResource.get(resource.id) ?? [];
654
851
  return (
655
852
  <View
@@ -658,6 +855,7 @@ export function ResourceTimeline<T = unknown>({
658
855
  styles.vcolumn,
659
856
  { borderLeftColor: theme.colors.gridLine },
660
857
  theme.containers.resourceRow,
858
+ dragLaneId === resource.id && styles.laneLifted,
661
859
  ]}
662
860
  >
663
861
  {/* Closed-hours shade, behind the grid lines and bars. */}
@@ -665,13 +863,34 @@ export function ResourceTimeline<T = unknown>({
665
863
  <View
666
864
  key={`shade-${b.start}`}
667
865
  pointerEvents="none"
866
+ accessibilityElementsHidden
867
+ importantForAccessibility="no-hide-descendants"
668
868
  testID="resource-hours-shade"
669
869
  style={[
670
870
  styles.vshadeBand,
671
871
  {
672
872
  top: (b.start - startHour) * hourHeight,
673
873
  height: (b.end - b.start) * hourHeight,
674
- backgroundColor: theme.colors.outsideHoursBackground,
874
+ },
875
+ renderBusinessHours
876
+ ? null
877
+ : { backgroundColor: theme.colors.outsideHoursBackground },
878
+ ]}
879
+ >
880
+ {renderBusinessHours?.({ date, start: b.start, end: b.end, resource })}
881
+ </View>
882
+ ))}
883
+ {backgroundBandsFor(resource).map((b, i) => (
884
+ <View
885
+ key={`bg-${i}`}
886
+ pointerEvents="none"
887
+ testID="background-event-shade"
888
+ style={[
889
+ styles.vshadeBand,
890
+ {
891
+ top: (b.startHours - startHour) * hourHeight,
892
+ height: (b.endHours - b.startHours) * hourHeight,
893
+ backgroundColor: theme.colors.backgroundEvent,
675
894
  },
676
895
  ]}
677
896
  />
@@ -689,6 +908,7 @@ export function ResourceTimeline<T = unknown>({
689
908
  ]}
690
909
  />
691
910
  ))}
911
+ {nowLine(true, hourHeight)}
692
912
  {cellEnabled ? (
693
913
  <LaneInteractionLayer
694
914
  resource={resource}
@@ -721,6 +941,11 @@ export function ResourceTimeline<T = unknown>({
721
941
  key={idx}
722
942
  pe={pe}
723
943
  vertical
944
+ resources={resources}
945
+ laneIndex={laneIndex}
946
+ laneSize={vLaneSize}
947
+ dragActive={dragLaneId === resource.id}
948
+ onDragActiveChange={setDragLaneId}
724
949
  hourSize={hourHeight}
725
950
  left={left}
726
951
  top={top}
@@ -785,7 +1010,7 @@ export function ResourceTimeline<T = unknown>({
785
1010
  </View>
786
1011
 
787
1012
  {/* Resource rows */}
788
- {resources.map((resource) => {
1013
+ {resources.map((resource, laneIndex) => {
789
1014
  const positioned = byResource.get(resource.id) ?? [];
790
1015
  return (
791
1016
  <View
@@ -794,6 +1019,7 @@ export function ResourceTimeline<T = unknown>({
794
1019
  styles.row,
795
1020
  { height: rowHeight, borderBottomColor: theme.colors.gridLine },
796
1021
  theme.containers.resourceRow,
1022
+ dragLaneId === resource.id && styles.laneLifted,
797
1023
  ]}
798
1024
  >
799
1025
  <View
@@ -803,13 +1029,17 @@ export function ResourceTimeline<T = unknown>({
803
1029
  theme.containers.resourceLabel,
804
1030
  ]}
805
1031
  >
806
- <Text
807
- numberOfLines={1}
808
- style={{ color: theme.colors.text }}
809
- allowFontScaling={false}
810
- >
811
- {resource.title ?? resource.id}
812
- </Text>
1032
+ {renderResourceHeader ? (
1033
+ renderResourceHeader(resource, laneIndex)
1034
+ ) : (
1035
+ <Text
1036
+ numberOfLines={1}
1037
+ style={{ color: theme.colors.text }}
1038
+ allowFontScaling={false}
1039
+ >
1040
+ {resource.title ?? resource.id}
1041
+ </Text>
1042
+ )}
813
1043
  </View>
814
1044
  <View style={{ width: trackWidth }}>
815
1045
  {/* Closed-hours shade, behind the grid lines and bars. */}
@@ -817,13 +1047,34 @@ export function ResourceTimeline<T = unknown>({
817
1047
  <View
818
1048
  key={`shade-${b.start}`}
819
1049
  pointerEvents="none"
1050
+ accessibilityElementsHidden
1051
+ importantForAccessibility="no-hide-descendants"
820
1052
  testID="resource-hours-shade"
821
1053
  style={[
822
1054
  styles.hshadeBand,
823
1055
  {
824
1056
  left: (b.start - startHour) * hourWidth,
825
1057
  width: (b.end - b.start) * hourWidth,
826
- backgroundColor: theme.colors.outsideHoursBackground,
1058
+ },
1059
+ renderBusinessHours
1060
+ ? null
1061
+ : { backgroundColor: theme.colors.outsideHoursBackground },
1062
+ ]}
1063
+ >
1064
+ {renderBusinessHours?.({ date, start: b.start, end: b.end, resource })}
1065
+ </View>
1066
+ ))}
1067
+ {backgroundBandsFor(resource).map((b, i) => (
1068
+ <View
1069
+ key={`bg-${i}`}
1070
+ pointerEvents="none"
1071
+ testID="background-event-shade"
1072
+ style={[
1073
+ styles.hshadeBand,
1074
+ {
1075
+ left: (b.startHours - startHour) * hourWidth,
1076
+ width: (b.endHours - b.startHours) * hourWidth,
1077
+ backgroundColor: theme.colors.backgroundEvent,
827
1078
  },
828
1079
  ]}
829
1080
  />
@@ -839,6 +1090,7 @@ export function ResourceTimeline<T = unknown>({
839
1090
  ]}
840
1091
  />
841
1092
  ))}
1093
+ {nowLine(false, hourWidth)}
842
1094
  {cellEnabled ? (
843
1095
  <LaneInteractionLayer
844
1096
  resource={resource}
@@ -868,6 +1120,11 @@ export function ResourceTimeline<T = unknown>({
868
1120
  key={idx}
869
1121
  pe={pe}
870
1122
  vertical={false}
1123
+ resources={resources}
1124
+ laneIndex={laneIndex}
1125
+ laneSize={rowHeight}
1126
+ dragActive={dragLaneId === resource.id}
1127
+ onDragActiveChange={setDragLaneId}
871
1128
  hourSize={hourWidth}
872
1129
  left={left}
873
1130
  top={pe.column * laneHeight}
@@ -958,6 +1215,7 @@ const styles = StyleSheet.create({
958
1215
  },
959
1216
  vheaderText: { fontSize: 13, fontWeight: "600" },
960
1217
  vbody: { flexDirection: "row" },
1218
+ laneLifted: { zIndex: 10 },
961
1219
  vcolumn: { flex: 1, borderLeftWidth: StyleSheet.hairlineWidth },
962
1220
  vhourLabel: { position: "absolute", right: 6, fontSize: 10 },
963
1221
  vgridLine: { position: "absolute", left: 0, right: 0, height: StyleSheet.hairlineWidth },