@legendapp/list 3.0.5 → 3.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/reanimated.d.ts CHANGED
@@ -9,10 +9,11 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
9
9
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
10
10
  }
11
11
 
12
- type ListenerType = "activeStickyIndex" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
13
- type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
12
+ type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
13
+ type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
14
14
  type ListenerTypeValueMap = {
15
15
  activeStickyIndex: number;
16
+ alignItemsAtEndPadding: number;
16
17
  anchoredEndSpaceSize: number;
17
18
  animatedScrollY: any;
18
19
  debugComputedScroll: number;
@@ -43,6 +44,7 @@ type ListenerTypeValueMap = {
43
44
  snapToOffsets: number[];
44
45
  stylePaddingTop: number;
45
46
  totalSize: number;
47
+ adaptiveRender: "normal" | "light";
46
48
  } & {
47
49
  [K in ListenerType as K extends `containerItemKey${number}` ? K : never]: string;
48
50
  } & {
@@ -63,6 +65,12 @@ interface Insets {
63
65
  bottom: number;
64
66
  right: number;
65
67
  }
68
+ interface LayoutRectangle {
69
+ x: number;
70
+ y: number;
71
+ width: number;
72
+ height: number;
73
+ }
66
74
  interface NativeScrollEvent {
67
75
  contentOffset: {
68
76
  x: number;
@@ -84,6 +92,28 @@ interface NativeSyntheticEvent<T> {
84
92
  }
85
93
  type ViewStyle = Record<string, unknown>;
86
94
  type StyleProp<T> = T | T[] | null | undefined | false;
95
+ type AdaptiveRender = "normal" | "light";
96
+ interface AdaptiveRenderConfig {
97
+ /**
98
+ * Scroll velocity in pixels per millisecond above which items should switch to light mode.
99
+ * @default 4
100
+ */
101
+ enterVelocity?: number;
102
+ /**
103
+ * Scroll velocity in pixels per millisecond below which items can return to normal mode.
104
+ * @default 1
105
+ */
106
+ exitVelocity?: number;
107
+ /**
108
+ * Time to wait without velocity above exitVelocity before returning to normal mode.
109
+ * @default 1000
110
+ */
111
+ exitDelay?: number;
112
+ /**
113
+ * Called when the list-level adaptive render changes.
114
+ */
115
+ onChange?: (mode: AdaptiveRender) => void;
116
+ }
87
117
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
88
118
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
89
119
  /**
@@ -292,6 +322,10 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
292
322
  * Called when list layout metrics change.
293
323
  */
294
324
  onMetricsChange?: (metrics: LegendListMetrics) => void;
325
+ /**
326
+ * Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
327
+ */
328
+ experimental_adaptiveRender?: AdaptiveRenderConfig;
295
329
  /**
296
330
  * Function to call when the user pulls to refresh.
297
331
  */
@@ -490,6 +524,14 @@ type LegendListState = {
490
524
  startBuffered: number;
491
525
  };
492
526
  type LegendListRef$1 = {
527
+ /**
528
+ * Clears internal virtualization caches.
529
+ * @param options - Cache clearing options.
530
+ * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
531
+ */
532
+ clearCaches(options?: {
533
+ mode?: "sizes" | "full";
534
+ }): void;
493
535
  /**
494
536
  * Displays the scroll indicators momentarily.
495
537
  */
@@ -510,6 +552,11 @@ type LegendListRef$1 = {
510
552
  * Returns the internal state of the scroll virtualization.
511
553
  */
512
554
  getState(): LegendListState;
555
+ /**
556
+ * Reports an externally measured content inset. Pass null/undefined to clear.
557
+ * Values are merged on top of props/animated/native insets.
558
+ */
559
+ reportContentInset(inset?: Partial<Insets> | null): void;
513
560
  /**
514
561
  * Scrolls a specific index into view.
515
562
  * @param params - Parameters for scrolling.
@@ -576,29 +623,22 @@ type LegendListRef$1 = {
576
623
  animated?: boolean | undefined;
577
624
  }): Promise<void>;
578
625
  /**
579
- * Sets or adds to the offset of the visible content anchor.
580
- * @param value - The offset to set or add.
581
- * @param animated - If true, uses Animated to animate the change.
626
+ * Sets a measured item size and recalculates list positions as needed.
627
+ * @param itemKey - The key of the item whose size changed.
628
+ * @param size - The measured item size.
582
629
  */
583
- setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
630
+ setItemSize(itemKey: string, size: Pick<LayoutRectangle, "height" | "width">): void;
584
631
  /**
585
632
  * Sets whether scroll processing is enabled.
586
633
  * @param enabled - If true, scroll processing is enabled.
587
634
  */
588
635
  setScrollProcessingEnabled(enabled: boolean): void;
589
636
  /**
590
- * Clears internal virtualization caches.
591
- * @param options - Cache clearing options.
592
- * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
593
- */
594
- clearCaches(options?: {
595
- mode?: "sizes" | "full";
596
- }): void;
597
- /**
598
- * Reports an externally measured content inset. Pass null/undefined to clear.
599
- * Values are merged on top of props/animated/native insets.
637
+ * Sets or adds to the offset of the visible content anchor.
638
+ * @param value - The offset to set or add.
639
+ * @param animated - If true, uses Animated to animate the change.
600
640
  */
601
- reportContentInset(inset?: Partial<Insets> | null): void;
641
+ setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
602
642
  };
603
643
  interface ViewToken<ItemT = any> {
604
644
  containerId: number;
package/section-list.d.ts CHANGED
@@ -65,10 +65,11 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
65
65
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
66
66
  }
67
67
 
68
- type ListenerType = "activeStickyIndex" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
69
- type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
68
+ type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
69
+ type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
70
70
  type ListenerTypeValueMap = {
71
71
  activeStickyIndex: number;
72
+ alignItemsAtEndPadding: number;
72
73
  anchoredEndSpaceSize: number;
73
74
  animatedScrollY: any;
74
75
  debugComputedScroll: number;
@@ -99,6 +100,7 @@ type ListenerTypeValueMap = {
99
100
  snapToOffsets: number[];
100
101
  stylePaddingTop: number;
101
102
  totalSize: number;
103
+ adaptiveRender: "normal" | "light";
102
104
  } & {
103
105
  [K in ListenerType as K extends `containerItemKey${number}` ? K : never]: string;
104
106
  } & {
@@ -119,6 +121,12 @@ interface Insets {
119
121
  bottom: number;
120
122
  right: number;
121
123
  }
124
+ interface LayoutRectangle {
125
+ x: number;
126
+ y: number;
127
+ width: number;
128
+ height: number;
129
+ }
122
130
  interface NativeScrollEvent {
123
131
  contentOffset: {
124
132
  x: number;
@@ -140,6 +148,28 @@ interface NativeSyntheticEvent<T> {
140
148
  }
141
149
  type ViewStyle = Record<string, unknown>;
142
150
  type StyleProp<T> = T | T[] | null | undefined | false;
151
+ type AdaptiveRender = "normal" | "light";
152
+ interface AdaptiveRenderConfig {
153
+ /**
154
+ * Scroll velocity in pixels per millisecond above which items should switch to light mode.
155
+ * @default 4
156
+ */
157
+ enterVelocity?: number;
158
+ /**
159
+ * Scroll velocity in pixels per millisecond below which items can return to normal mode.
160
+ * @default 1
161
+ */
162
+ exitVelocity?: number;
163
+ /**
164
+ * Time to wait without velocity above exitVelocity before returning to normal mode.
165
+ * @default 1000
166
+ */
167
+ exitDelay?: number;
168
+ /**
169
+ * Called when the list-level adaptive render changes.
170
+ */
171
+ onChange?: (mode: AdaptiveRender) => void;
172
+ }
143
173
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
144
174
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
145
175
  /**
@@ -348,6 +378,10 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
348
378
  * Called when list layout metrics change.
349
379
  */
350
380
  onMetricsChange?: (metrics: LegendListMetrics) => void;
381
+ /**
382
+ * Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
383
+ */
384
+ experimental_adaptiveRender?: AdaptiveRenderConfig;
351
385
  /**
352
386
  * Function to call when the user pulls to refresh.
353
387
  */
@@ -546,6 +580,14 @@ type LegendListState = {
546
580
  startBuffered: number;
547
581
  };
548
582
  type LegendListRef$1 = {
583
+ /**
584
+ * Clears internal virtualization caches.
585
+ * @param options - Cache clearing options.
586
+ * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
587
+ */
588
+ clearCaches(options?: {
589
+ mode?: "sizes" | "full";
590
+ }): void;
549
591
  /**
550
592
  * Displays the scroll indicators momentarily.
551
593
  */
@@ -566,6 +608,11 @@ type LegendListRef$1 = {
566
608
  * Returns the internal state of the scroll virtualization.
567
609
  */
568
610
  getState(): LegendListState;
611
+ /**
612
+ * Reports an externally measured content inset. Pass null/undefined to clear.
613
+ * Values are merged on top of props/animated/native insets.
614
+ */
615
+ reportContentInset(inset?: Partial<Insets> | null): void;
569
616
  /**
570
617
  * Scrolls a specific index into view.
571
618
  * @param params - Parameters for scrolling.
@@ -632,29 +679,22 @@ type LegendListRef$1 = {
632
679
  animated?: boolean | undefined;
633
680
  }): Promise<void>;
634
681
  /**
635
- * Sets or adds to the offset of the visible content anchor.
636
- * @param value - The offset to set or add.
637
- * @param animated - If true, uses Animated to animate the change.
682
+ * Sets a measured item size and recalculates list positions as needed.
683
+ * @param itemKey - The key of the item whose size changed.
684
+ * @param size - The measured item size.
638
685
  */
639
- setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
686
+ setItemSize(itemKey: string, size: Pick<LayoutRectangle, "height" | "width">): void;
640
687
  /**
641
688
  * Sets whether scroll processing is enabled.
642
689
  * @param enabled - If true, scroll processing is enabled.
643
690
  */
644
691
  setScrollProcessingEnabled(enabled: boolean): void;
645
692
  /**
646
- * Clears internal virtualization caches.
647
- * @param options - Cache clearing options.
648
- * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
649
- */
650
- clearCaches(options?: {
651
- mode?: "sizes" | "full";
652
- }): void;
653
- /**
654
- * Reports an externally measured content inset. Pass null/undefined to clear.
655
- * Values are merged on top of props/animated/native insets.
693
+ * Sets or adds to the offset of the visible content anchor.
694
+ * @param value - The offset to set or add.
695
+ * @param animated - If true, uses Animated to animate the change.
656
696
  */
657
- reportContentInset(inset?: Partial<Insets> | null): void;
697
+ setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
658
698
  };
659
699
  interface ViewToken<ItemT = any> {
660
700
  containerId: number;