@legendapp/list 3.0.6 → 3.1.1
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/CHANGELOG.md +18 -0
- package/animated.d.ts +57 -17
- package/keyboard-legacy.d.ts +30 -17
- package/keyboard.d.ts +30 -17
- package/package.json +1 -1
- package/react-native.d.ts +54 -18
- package/react-native.js +848 -666
- package/react-native.mjs +847 -667
- package/react-native.web.d.ts +54 -18
- package/react-native.web.js +926 -730
- package/react-native.web.mjs +925 -731
- package/react.d.ts +54 -18
- package/react.js +926 -730
- package/react.mjs +925 -731
- package/reanimated.d.ts +57 -17
- package/section-list.d.ts +57 -17
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
|
*/
|
|
@@ -428,6 +461,7 @@ interface AlwaysRenderConfig {
|
|
|
428
461
|
}
|
|
429
462
|
interface MaintainScrollAtEndOnOptions {
|
|
430
463
|
dataChange?: boolean;
|
|
464
|
+
footerLayout?: boolean;
|
|
431
465
|
itemLayout?: boolean;
|
|
432
466
|
layout?: boolean;
|
|
433
467
|
}
|
|
@@ -491,6 +525,14 @@ type LegendListState = {
|
|
|
491
525
|
startBuffered: number;
|
|
492
526
|
};
|
|
493
527
|
type LegendListRef$1 = {
|
|
528
|
+
/**
|
|
529
|
+
* Clears internal virtualization caches.
|
|
530
|
+
* @param options - Cache clearing options.
|
|
531
|
+
* @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
|
|
532
|
+
*/
|
|
533
|
+
clearCaches(options?: {
|
|
534
|
+
mode?: "sizes" | "full";
|
|
535
|
+
}): void;
|
|
494
536
|
/**
|
|
495
537
|
* Displays the scroll indicators momentarily.
|
|
496
538
|
*/
|
|
@@ -511,6 +553,11 @@ type LegendListRef$1 = {
|
|
|
511
553
|
* Returns the internal state of the scroll virtualization.
|
|
512
554
|
*/
|
|
513
555
|
getState(): LegendListState;
|
|
556
|
+
/**
|
|
557
|
+
* Reports an externally measured content inset. Pass null/undefined to clear.
|
|
558
|
+
* Values are merged on top of props/animated/native insets.
|
|
559
|
+
*/
|
|
560
|
+
reportContentInset(inset?: Partial<Insets> | null): void;
|
|
514
561
|
/**
|
|
515
562
|
* Scrolls a specific index into view.
|
|
516
563
|
* @param params - Parameters for scrolling.
|
|
@@ -577,29 +624,22 @@ type LegendListRef$1 = {
|
|
|
577
624
|
animated?: boolean | undefined;
|
|
578
625
|
}): Promise<void>;
|
|
579
626
|
/**
|
|
580
|
-
* Sets
|
|
581
|
-
* @param
|
|
582
|
-
* @param
|
|
627
|
+
* Sets a measured item size and recalculates list positions as needed.
|
|
628
|
+
* @param itemKey - The key of the item whose size changed.
|
|
629
|
+
* @param size - The measured item size.
|
|
583
630
|
*/
|
|
584
|
-
|
|
631
|
+
setItemSize(itemKey: string, size: Pick<LayoutRectangle, "height" | "width">): void;
|
|
585
632
|
/**
|
|
586
633
|
* Sets whether scroll processing is enabled.
|
|
587
634
|
* @param enabled - If true, scroll processing is enabled.
|
|
588
635
|
*/
|
|
589
636
|
setScrollProcessingEnabled(enabled: boolean): void;
|
|
590
637
|
/**
|
|
591
|
-
*
|
|
592
|
-
* @param
|
|
593
|
-
* @param
|
|
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.
|
|
638
|
+
* Sets or adds to the offset of the visible content anchor.
|
|
639
|
+
* @param value - The offset to set or add.
|
|
640
|
+
* @param animated - If true, uses Animated to animate the change.
|
|
601
641
|
*/
|
|
602
|
-
|
|
642
|
+
setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
|
|
603
643
|
};
|
|
604
644
|
interface ViewToken<ItemT = any> {
|
|
605
645
|
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
|
*/
|
|
@@ -484,6 +517,7 @@ interface AlwaysRenderConfig {
|
|
|
484
517
|
}
|
|
485
518
|
interface MaintainScrollAtEndOnOptions {
|
|
486
519
|
dataChange?: boolean;
|
|
520
|
+
footerLayout?: boolean;
|
|
487
521
|
itemLayout?: boolean;
|
|
488
522
|
layout?: boolean;
|
|
489
523
|
}
|
|
@@ -547,6 +581,14 @@ type LegendListState = {
|
|
|
547
581
|
startBuffered: number;
|
|
548
582
|
};
|
|
549
583
|
type LegendListRef$1 = {
|
|
584
|
+
/**
|
|
585
|
+
* Clears internal virtualization caches.
|
|
586
|
+
* @param options - Cache clearing options.
|
|
587
|
+
* @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
|
|
588
|
+
*/
|
|
589
|
+
clearCaches(options?: {
|
|
590
|
+
mode?: "sizes" | "full";
|
|
591
|
+
}): void;
|
|
550
592
|
/**
|
|
551
593
|
* Displays the scroll indicators momentarily.
|
|
552
594
|
*/
|
|
@@ -567,6 +609,11 @@ type LegendListRef$1 = {
|
|
|
567
609
|
* Returns the internal state of the scroll virtualization.
|
|
568
610
|
*/
|
|
569
611
|
getState(): LegendListState;
|
|
612
|
+
/**
|
|
613
|
+
* Reports an externally measured content inset. Pass null/undefined to clear.
|
|
614
|
+
* Values are merged on top of props/animated/native insets.
|
|
615
|
+
*/
|
|
616
|
+
reportContentInset(inset?: Partial<Insets> | null): void;
|
|
570
617
|
/**
|
|
571
618
|
* Scrolls a specific index into view.
|
|
572
619
|
* @param params - Parameters for scrolling.
|
|
@@ -633,29 +680,22 @@ type LegendListRef$1 = {
|
|
|
633
680
|
animated?: boolean | undefined;
|
|
634
681
|
}): Promise<void>;
|
|
635
682
|
/**
|
|
636
|
-
* Sets
|
|
637
|
-
* @param
|
|
638
|
-
* @param
|
|
683
|
+
* Sets a measured item size and recalculates list positions as needed.
|
|
684
|
+
* @param itemKey - The key of the item whose size changed.
|
|
685
|
+
* @param size - The measured item size.
|
|
639
686
|
*/
|
|
640
|
-
|
|
687
|
+
setItemSize(itemKey: string, size: Pick<LayoutRectangle, "height" | "width">): void;
|
|
641
688
|
/**
|
|
642
689
|
* Sets whether scroll processing is enabled.
|
|
643
690
|
* @param enabled - If true, scroll processing is enabled.
|
|
644
691
|
*/
|
|
645
692
|
setScrollProcessingEnabled(enabled: boolean): void;
|
|
646
693
|
/**
|
|
647
|
-
*
|
|
648
|
-
* @param
|
|
649
|
-
* @param
|
|
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.
|
|
694
|
+
* Sets or adds to the offset of the visible content anchor.
|
|
695
|
+
* @param value - The offset to set or add.
|
|
696
|
+
* @param animated - If true, uses Animated to animate the change.
|
|
657
697
|
*/
|
|
658
|
-
|
|
698
|
+
setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
|
|
659
699
|
};
|
|
660
700
|
interface ViewToken<ItemT = any> {
|
|
661
701
|
containerId: number;
|