@legendapp/list 3.0.6 → 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,8 +9,8 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
9
9
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
10
10
  }
11
11
 
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" | `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
16
  alignItemsAtEndPadding: number;
@@ -44,6 +44,7 @@ type ListenerTypeValueMap = {
44
44
  snapToOffsets: number[];
45
45
  stylePaddingTop: number;
46
46
  totalSize: number;
47
+ adaptiveRender: "normal" | "light";
47
48
  } & {
48
49
  [K in ListenerType as K extends `containerItemKey${number}` ? K : never]: string;
49
50
  } & {
@@ -64,6 +65,12 @@ interface Insets {
64
65
  bottom: number;
65
66
  right: number;
66
67
  }
68
+ interface LayoutRectangle {
69
+ x: number;
70
+ y: number;
71
+ width: number;
72
+ height: number;
73
+ }
67
74
  interface NativeScrollEvent {
68
75
  contentOffset: {
69
76
  x: number;
@@ -85,6 +92,28 @@ interface NativeSyntheticEvent<T> {
85
92
  }
86
93
  type ViewStyle = Record<string, unknown>;
87
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
+ }
88
117
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
89
118
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
90
119
  /**
@@ -293,6 +322,10 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
293
322
  * Called when list layout metrics change.
294
323
  */
295
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;
296
329
  /**
297
330
  * Function to call when the user pulls to refresh.
298
331
  */
@@ -491,6 +524,14 @@ type LegendListState = {
491
524
  startBuffered: number;
492
525
  };
493
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;
494
535
  /**
495
536
  * Displays the scroll indicators momentarily.
496
537
  */
@@ -511,6 +552,11 @@ type LegendListRef$1 = {
511
552
  * Returns the internal state of the scroll virtualization.
512
553
  */
513
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;
514
560
  /**
515
561
  * Scrolls a specific index into view.
516
562
  * @param params - Parameters for scrolling.
@@ -577,29 +623,22 @@ type LegendListRef$1 = {
577
623
  animated?: boolean | undefined;
578
624
  }): Promise<void>;
579
625
  /**
580
- * Sets or adds to the offset of the visible content anchor.
581
- * @param value - The offset to set or add.
582
- * @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.
583
629
  */
584
- setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
630
+ setItemSize(itemKey: string, size: Pick<LayoutRectangle, "height" | "width">): void;
585
631
  /**
586
632
  * Sets whether scroll processing is enabled.
587
633
  * @param enabled - If true, scroll processing is enabled.
588
634
  */
589
635
  setScrollProcessingEnabled(enabled: boolean): void;
590
636
  /**
591
- * Clears internal virtualization caches.
592
- * @param options - Cache clearing options.
593
- * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
594
- */
595
- clearCaches(options?: {
596
- mode?: "sizes" | "full";
597
- }): void;
598
- /**
599
- * Reports an externally measured content inset. Pass null/undefined to clear.
600
- * 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.
601
640
  */
602
- reportContentInset(inset?: Partial<Insets> | null): void;
641
+ setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
603
642
  };
604
643
  interface ViewToken<ItemT = any> {
605
644
  containerId: number;
package/section-list.d.ts CHANGED
@@ -65,8 +65,8 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
65
65
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
66
66
  }
67
67
 
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" | `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
72
  alignItemsAtEndPadding: number;
@@ -100,6 +100,7 @@ type ListenerTypeValueMap = {
100
100
  snapToOffsets: number[];
101
101
  stylePaddingTop: number;
102
102
  totalSize: number;
103
+ adaptiveRender: "normal" | "light";
103
104
  } & {
104
105
  [K in ListenerType as K extends `containerItemKey${number}` ? K : never]: string;
105
106
  } & {
@@ -120,6 +121,12 @@ interface Insets {
120
121
  bottom: number;
121
122
  right: number;
122
123
  }
124
+ interface LayoutRectangle {
125
+ x: number;
126
+ y: number;
127
+ width: number;
128
+ height: number;
129
+ }
123
130
  interface NativeScrollEvent {
124
131
  contentOffset: {
125
132
  x: number;
@@ -141,6 +148,28 @@ interface NativeSyntheticEvent<T> {
141
148
  }
142
149
  type ViewStyle = Record<string, unknown>;
143
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
+ }
144
173
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
145
174
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
146
175
  /**
@@ -349,6 +378,10 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
349
378
  * Called when list layout metrics change.
350
379
  */
351
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;
352
385
  /**
353
386
  * Function to call when the user pulls to refresh.
354
387
  */
@@ -547,6 +580,14 @@ type LegendListState = {
547
580
  startBuffered: number;
548
581
  };
549
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;
550
591
  /**
551
592
  * Displays the scroll indicators momentarily.
552
593
  */
@@ -567,6 +608,11 @@ type LegendListRef$1 = {
567
608
  * Returns the internal state of the scroll virtualization.
568
609
  */
569
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;
570
616
  /**
571
617
  * Scrolls a specific index into view.
572
618
  * @param params - Parameters for scrolling.
@@ -633,29 +679,22 @@ type LegendListRef$1 = {
633
679
  animated?: boolean | undefined;
634
680
  }): Promise<void>;
635
681
  /**
636
- * Sets or adds to the offset of the visible content anchor.
637
- * @param value - The offset to set or add.
638
- * @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.
639
685
  */
640
- setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
686
+ setItemSize(itemKey: string, size: Pick<LayoutRectangle, "height" | "width">): void;
641
687
  /**
642
688
  * Sets whether scroll processing is enabled.
643
689
  * @param enabled - If true, scroll processing is enabled.
644
690
  */
645
691
  setScrollProcessingEnabled(enabled: boolean): void;
646
692
  /**
647
- * Clears internal virtualization caches.
648
- * @param options - Cache clearing options.
649
- * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
650
- */
651
- clearCaches(options?: {
652
- mode?: "sizes" | "full";
653
- }): void;
654
- /**
655
- * Reports an externally measured content inset. Pass null/undefined to clear.
656
- * 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.
657
696
  */
658
- reportContentInset(inset?: Partial<Insets> | null): void;
697
+ setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
659
698
  };
660
699
  interface ViewToken<ItemT = any> {
661
700
  containerId: number;