@legendapp/list 2.1.0-beta.12 → 2.1.0-beta.13
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/index.d.mts +8 -664
- package/index.d.ts +8 -664
- package/index.js +175 -143
- package/index.mjs +175 -143
- package/index.native.d.mts +8 -664
- package/index.native.d.ts +8 -664
- package/index.native.js +154 -144
- package/index.native.mjs +154 -144
- package/package.json +1 -1
- package/section-list.d.mts +113 -0
- package/section-list.d.ts +113 -0
- package/section-list.js +3924 -0
- package/section-list.mjs +3903 -0
- package/section-list.native.d.mts +113 -0
- package/section-list.native.d.ts +113 -0
- package/section-list.native.js +3703 -0
- package/section-list.native.mjs +3682 -0
- package/types-JPHClxiw.d.mts +670 -0
- package/types-JPHClxiw.d.ts +670 -0
- package/types-YNdphn_A.d.mts +670 -0
- package/types-YNdphn_A.d.ts +670 -0
package/index.d.mts
CHANGED
|
@@ -1,667 +1,11 @@
|
|
|
1
|
-
import * as React
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-JPHClxiw.mjs';
|
|
4
|
+
export { C as ColumnWrapperStyle, u as GetRenderedItem, G as GetRenderedItemResult, s as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, f as LegendListRenderItemProps, M as MaintainScrollAtEndOptions, O as OnViewableItemsChanged, p as ScrollIndexWithOffset, r as ScrollIndexWithOffsetAndContentOffset, q as ScrollIndexWithOffsetPosition, g as ScrollState, S as ScrollTarget, T as ThresholdSnapshot, m as TypedForwardRef, n as TypedMemo, i as ViewAmountToken, h as ViewToken, l as ViewabilityConfig, j as ViewabilityConfigCallbackPair, k as ViewabilityConfigCallbackPairs, e as ViewableRange, t as typedForwardRef, o as typedMemo } from './types-JPHClxiw.mjs';
|
|
5
|
+
import 'react-native';
|
|
6
|
+
import 'react-native-reanimated';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "lastPositionUpdate" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "scrollAdjustPending" | "scrollingTo" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize" | "activeStickyIndex";
|
|
9
|
-
interface StateContext {
|
|
10
|
-
internalState: InternalState | undefined;
|
|
11
|
-
listeners: Map<ListenerType, Set<(value: any) => void>>;
|
|
12
|
-
values: Map<ListenerType, any>;
|
|
13
|
-
mapViewabilityCallbacks: Map<string, ViewabilityCallback>;
|
|
14
|
-
mapViewabilityValues: Map<string, ViewToken>;
|
|
15
|
-
mapViewabilityAmountCallbacks: Map<number, ViewabilityAmountCallback>;
|
|
16
|
-
mapViewabilityAmountValues: Map<number, ViewAmountToken>;
|
|
17
|
-
mapViewabilityConfigStates: Map<string, {
|
|
18
|
-
viewableItems: ViewToken[];
|
|
19
|
-
start: number;
|
|
20
|
-
end: number;
|
|
21
|
-
previousStart: number;
|
|
22
|
-
previousEnd: number;
|
|
23
|
-
}>;
|
|
24
|
-
columnWrapperStyle: ColumnWrapperStyle | undefined;
|
|
25
|
-
viewRefs: Map<number, React$1.RefObject<View>>;
|
|
26
|
-
animatedScrollY: AnimatedValue;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare class ScrollAdjustHandler {
|
|
30
|
-
private appliedAdjust;
|
|
31
|
-
private pendingAdjust;
|
|
32
|
-
private context;
|
|
33
|
-
private mounted;
|
|
34
|
-
constructor(ctx: StateContext);
|
|
35
|
-
requestAdjust(add: number): void;
|
|
36
|
-
setMounted(): void;
|
|
37
|
-
getAdjust(): number;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
|
|
41
|
-
interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
42
|
-
/**
|
|
43
|
-
* Array of items to render in the list.
|
|
44
|
-
* @required when using data mode
|
|
45
|
-
*/
|
|
46
|
-
data: ReadonlyArray<ItemT>;
|
|
47
|
-
/**
|
|
48
|
-
* Function or React component to render each item in the list.
|
|
49
|
-
* Can be either:
|
|
50
|
-
* - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
|
|
51
|
-
* - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
|
|
52
|
-
* @required when using data mode
|
|
53
|
-
*/
|
|
54
|
-
renderItem: ((props: LegendListRenderItemProps<ItemT, TItemType>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT, TItemType>>;
|
|
55
|
-
children?: never;
|
|
56
|
-
}
|
|
57
|
-
interface ChildrenModeProps {
|
|
58
|
-
/**
|
|
59
|
-
* React children elements to render as list items.
|
|
60
|
-
* Each child will be treated as an individual list item.
|
|
61
|
-
* @required when using children mode
|
|
62
|
-
*/
|
|
63
|
-
children: ReactNode;
|
|
64
|
-
data?: never;
|
|
65
|
-
renderItem?: never;
|
|
66
|
-
}
|
|
67
|
-
interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
68
|
-
/**
|
|
69
|
-
* If true, aligns items at the end of the list.
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
alignItemsAtEnd?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* If true, enables using average sizes for performance optimization.
|
|
75
|
-
* @default true
|
|
76
|
-
*/
|
|
77
|
-
enableAverages?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Style applied to each column's wrapper view.
|
|
80
|
-
*/
|
|
81
|
-
columnWrapperStyle?: ColumnWrapperStyle;
|
|
82
|
-
/**
|
|
83
|
-
* Distance in pixels to pre-render items ahead of the visible area.
|
|
84
|
-
* @default 250
|
|
85
|
-
*/
|
|
86
|
-
drawDistance?: number;
|
|
87
|
-
/**
|
|
88
|
-
* Estimated size of each item in pixels, a hint for the first render. After some
|
|
89
|
-
* items are rendered, the average size of rendered items will be used instead.
|
|
90
|
-
* @default undefined
|
|
91
|
-
*/
|
|
92
|
-
estimatedItemSize?: number;
|
|
93
|
-
/**
|
|
94
|
-
* Estimated size of the ScrollView in pixels, a hint for the first render to improve performance
|
|
95
|
-
* @default undefined
|
|
96
|
-
*/
|
|
97
|
-
estimatedListSize?: {
|
|
98
|
-
height: number;
|
|
99
|
-
width: number;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Extra data to trigger re-rendering when changed.
|
|
103
|
-
*/
|
|
104
|
-
extraData?: any;
|
|
105
|
-
/**
|
|
106
|
-
* Version token that forces the list to treat data as updated even when the array reference is stable.
|
|
107
|
-
* Increment or change this when mutating the data array in place.
|
|
108
|
-
*/
|
|
109
|
-
dataVersion?: Key;
|
|
110
|
-
/**
|
|
111
|
-
* In case you have distinct item sizes, you can provide a function to get the size of an item.
|
|
112
|
-
* Use instead of FlatList's getItemLayout or FlashList overrideItemLayout if you want to have accurate initialScrollOffset, you should provide this function
|
|
113
|
-
*/
|
|
114
|
-
getEstimatedItemSize?: (index: number, item: ItemT, type: TItemType) => number;
|
|
115
|
-
/**
|
|
116
|
-
* Ratio of initial container pool size to data length (e.g., 0.5 for half).
|
|
117
|
-
* @default 2
|
|
118
|
-
*/
|
|
119
|
-
initialContainerPoolRatio?: number | undefined;
|
|
120
|
-
/**
|
|
121
|
-
* Initial scroll position in pixels.
|
|
122
|
-
* @default 0
|
|
123
|
-
*/
|
|
124
|
-
initialScrollOffset?: number;
|
|
125
|
-
/**
|
|
126
|
-
* Index to scroll to initially.
|
|
127
|
-
* @default 0
|
|
128
|
-
*/
|
|
129
|
-
initialScrollIndex?: number | {
|
|
130
|
-
index: number;
|
|
131
|
-
viewOffset?: number | undefined;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* When true, the list initializes scrolled to the last item.
|
|
135
|
-
* Overrides `initialScrollIndex` and `initialScrollOffset` when data is available.
|
|
136
|
-
* @default false
|
|
137
|
-
*/
|
|
138
|
-
initialScrollAtEnd?: boolean;
|
|
139
|
-
/**
|
|
140
|
-
* Component to render between items, receiving the leading item as prop.
|
|
141
|
-
*/
|
|
142
|
-
ItemSeparatorComponent?: React.ComponentType<{
|
|
143
|
-
leadingItem: ItemT;
|
|
144
|
-
}>;
|
|
145
|
-
/**
|
|
146
|
-
* Function to extract a unique key for each item.
|
|
147
|
-
*/
|
|
148
|
-
keyExtractor?: (item: ItemT, index: number) => string;
|
|
149
|
-
/**
|
|
150
|
-
* Component or element to render when the list is empty.
|
|
151
|
-
*/
|
|
152
|
-
ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
153
|
-
/**
|
|
154
|
-
* Component or element to render below the list.
|
|
155
|
-
*/
|
|
156
|
-
ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
157
|
-
/**
|
|
158
|
-
* Style for the footer component.
|
|
159
|
-
*/
|
|
160
|
-
ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
|
|
161
|
-
/**
|
|
162
|
-
* Component or element to render above the list.
|
|
163
|
-
*/
|
|
164
|
-
ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
165
|
-
/**
|
|
166
|
-
* Style for the header component.
|
|
167
|
-
*/
|
|
168
|
-
ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
|
|
169
|
-
/**
|
|
170
|
-
* If true, auto-scrolls to end when new items are added.
|
|
171
|
-
* @default false
|
|
172
|
-
*/
|
|
173
|
-
maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions;
|
|
174
|
-
/**
|
|
175
|
-
* Distance threshold in percentage of screen size to trigger maintainScrollAtEnd.
|
|
176
|
-
* @default 0.1
|
|
177
|
-
*/
|
|
178
|
-
maintainScrollAtEndThreshold?: number;
|
|
179
|
-
/**
|
|
180
|
-
* If true, maintains visibility of content during scroll (e.g., after insertions).
|
|
181
|
-
* @default false
|
|
182
|
-
*/
|
|
183
|
-
maintainVisibleContentPosition?: boolean;
|
|
184
|
-
/**
|
|
185
|
-
* Number of columns to render items in.
|
|
186
|
-
* @default 1
|
|
187
|
-
*/
|
|
188
|
-
numColumns?: number;
|
|
189
|
-
/**
|
|
190
|
-
* Called when scrolling reaches the end within onEndReachedThreshold.
|
|
191
|
-
*/
|
|
192
|
-
onEndReached?: ((info: {
|
|
193
|
-
distanceFromEnd: number;
|
|
194
|
-
}) => void) | null | undefined;
|
|
195
|
-
/**
|
|
196
|
-
* How close to the end (in fractional units of visible length) to trigger onEndReached.
|
|
197
|
-
* @default 0.5
|
|
198
|
-
*/
|
|
199
|
-
onEndReachedThreshold?: number | null | undefined;
|
|
200
|
-
/**
|
|
201
|
-
* Called when an item's size changes.
|
|
202
|
-
*/
|
|
203
|
-
onItemSizeChanged?: (info: {
|
|
204
|
-
size: number;
|
|
205
|
-
previous: number;
|
|
206
|
-
index: number;
|
|
207
|
-
itemKey: string;
|
|
208
|
-
itemData: ItemT;
|
|
209
|
-
}) => void;
|
|
210
|
-
/**
|
|
211
|
-
* Function to call when the user pulls to refresh.
|
|
212
|
-
*/
|
|
213
|
-
onRefresh?: () => void;
|
|
214
|
-
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
215
|
-
/**
|
|
216
|
-
* Called when scrolling reaches the start within onStartReachedThreshold.
|
|
217
|
-
*/
|
|
218
|
-
onStartReached?: ((info: {
|
|
219
|
-
distanceFromStart: number;
|
|
220
|
-
}) => void) | null | undefined;
|
|
221
|
-
/**
|
|
222
|
-
* How close to the start (in fractional units of visible length) to trigger onStartReached.
|
|
223
|
-
* @default 0.5
|
|
224
|
-
*/
|
|
225
|
-
onStartReachedThreshold?: number | null | undefined;
|
|
226
|
-
/**
|
|
227
|
-
* Called when the sticky header changes.
|
|
228
|
-
*/
|
|
229
|
-
onStickyHeaderChange?: (info: {
|
|
230
|
-
index: number;
|
|
231
|
-
item: any;
|
|
232
|
-
}) => void;
|
|
233
|
-
/**
|
|
234
|
-
* Called when the viewability of items changes.
|
|
235
|
-
*/
|
|
236
|
-
onViewableItemsChanged?: OnViewableItemsChanged<ItemT> | undefined;
|
|
237
|
-
/**
|
|
238
|
-
* Offset in pixels for the refresh indicator.
|
|
239
|
-
* @default 0
|
|
240
|
-
*/
|
|
241
|
-
progressViewOffset?: number;
|
|
242
|
-
/**
|
|
243
|
-
* If true, recycles item views for better performance.
|
|
244
|
-
* @default false
|
|
245
|
-
*/
|
|
246
|
-
recycleItems?: boolean;
|
|
247
|
-
/**
|
|
248
|
-
* Ref to the underlying ScrollView component.
|
|
249
|
-
*/
|
|
250
|
-
refScrollView?: React.Ref<ScrollView>;
|
|
251
|
-
/**
|
|
252
|
-
* If true, shows a refresh indicator.
|
|
253
|
-
* @default false
|
|
254
|
-
*/
|
|
255
|
-
refreshing?: boolean;
|
|
256
|
-
/**
|
|
257
|
-
* Render custom ScrollView component.
|
|
258
|
-
* Note: When using `stickyHeaderIndices`, you must provide an Animated ScrollView component.
|
|
259
|
-
* @default (props) => <ScrollView {...props} />
|
|
260
|
-
*/
|
|
261
|
-
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
262
|
-
/**
|
|
263
|
-
* This will log a suggested estimatedItemSize.
|
|
264
|
-
* @required
|
|
265
|
-
* @default false
|
|
266
|
-
*/
|
|
267
|
-
suggestEstimatedItemSize?: boolean;
|
|
268
|
-
/**
|
|
269
|
-
* Configuration for determining item viewability.
|
|
270
|
-
*/
|
|
271
|
-
viewabilityConfig?: ViewabilityConfig;
|
|
272
|
-
/**
|
|
273
|
-
* Pairs of viewability configs and their callbacks for tracking visibility.
|
|
274
|
-
*/
|
|
275
|
-
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs<ItemT> | undefined;
|
|
276
|
-
/**
|
|
277
|
-
* If true, delays rendering until initial layout is complete.
|
|
278
|
-
* @default false
|
|
279
|
-
*/
|
|
280
|
-
waitForInitialLayout?: boolean;
|
|
281
|
-
onLoad?: (info: {
|
|
282
|
-
elapsedTimeInMs: number;
|
|
283
|
-
}) => void;
|
|
284
|
-
snapToIndices?: number[];
|
|
285
|
-
/**
|
|
286
|
-
* Array of child indices determining which children get docked to the top of the screen when scrolling.
|
|
287
|
-
* For example, passing stickyIndices={[0]} will cause the first child to be fixed to the top of the scroll view.
|
|
288
|
-
* Not supported in conjunction with horizontal={true}.
|
|
289
|
-
* @default undefined
|
|
290
|
-
*/
|
|
291
|
-
stickyIndices?: number[];
|
|
292
|
-
getItemType?: (item: ItemT, index: number) => TItemType;
|
|
293
|
-
getFixedItemSize?: (index: number, item: ItemT, type: TItemType) => number | undefined;
|
|
294
|
-
itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
295
|
-
}
|
|
296
|
-
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView> | ComponentProps<typeof Animated$1.ScrollView>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollView> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
|
|
297
|
-
interface MaintainScrollAtEndOptions {
|
|
298
|
-
onLayout?: boolean;
|
|
299
|
-
onItemLayout?: boolean;
|
|
300
|
-
onDataChange?: boolean;
|
|
301
|
-
}
|
|
302
|
-
interface ColumnWrapperStyle {
|
|
303
|
-
rowGap?: number;
|
|
304
|
-
gap?: number;
|
|
305
|
-
columnGap?: number;
|
|
306
|
-
}
|
|
307
|
-
type LegendListProps<ItemT = any> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
|
|
308
|
-
interface ThresholdSnapshot {
|
|
309
|
-
scrollPosition: number;
|
|
310
|
-
contentSize?: number;
|
|
311
|
-
dataLength?: number;
|
|
312
|
-
atThreshold: boolean;
|
|
313
|
-
}
|
|
314
|
-
interface ScrollTarget {
|
|
315
|
-
offset: number;
|
|
316
|
-
index?: number;
|
|
317
|
-
viewOffset?: number;
|
|
318
|
-
viewPosition?: number;
|
|
319
|
-
animated?: boolean;
|
|
320
|
-
isInitialScroll?: boolean;
|
|
321
|
-
precomputedWithViewOffset?: boolean;
|
|
322
|
-
}
|
|
323
|
-
interface InternalState {
|
|
324
|
-
positions: Map<string, number>;
|
|
325
|
-
columns: Map<string, number>;
|
|
326
|
-
sizes: Map<string, number>;
|
|
327
|
-
sizesKnown: Map<string, number>;
|
|
328
|
-
containerItemKeys: Set<string>;
|
|
329
|
-
containerItemTypes: Map<number, string>;
|
|
330
|
-
isStartReached: boolean;
|
|
331
|
-
isEndReached: boolean;
|
|
332
|
-
isAtEnd: boolean;
|
|
333
|
-
isAtStart: boolean;
|
|
334
|
-
hasScrolled?: boolean;
|
|
335
|
-
scrollLength: number;
|
|
336
|
-
startBuffered: number;
|
|
337
|
-
startBufferedId?: string;
|
|
338
|
-
startNoBuffer: number;
|
|
339
|
-
endBuffered: number;
|
|
340
|
-
endNoBuffer: number;
|
|
341
|
-
firstFullyOnScreenIndex: number;
|
|
342
|
-
idsInView: string[];
|
|
343
|
-
scrollPending: number;
|
|
344
|
-
scroll: number;
|
|
345
|
-
scrollTime: number;
|
|
346
|
-
scrollPrev: number;
|
|
347
|
-
scrollPrevTime: number;
|
|
348
|
-
scrollAdjustHandler: ScrollAdjustHandler;
|
|
349
|
-
triggerCalculateItemsInView?: (params?: {
|
|
350
|
-
doMVCP?: boolean;
|
|
351
|
-
dataChanged?: boolean;
|
|
352
|
-
forceFullItemPositions?: boolean;
|
|
353
|
-
}) => void;
|
|
354
|
-
maintainingScrollAtEnd?: boolean;
|
|
355
|
-
totalSize: number;
|
|
356
|
-
otherAxisSize?: number;
|
|
357
|
-
timeouts: Set<number>;
|
|
358
|
-
timeoutSizeMessage: any;
|
|
359
|
-
nativeMarginTop: number;
|
|
360
|
-
indexByKey: Map<string, number>;
|
|
361
|
-
idCache: string[];
|
|
362
|
-
viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs<any> | undefined;
|
|
363
|
-
scrollHistory: Array<{
|
|
364
|
-
scroll: number;
|
|
365
|
-
time: number;
|
|
366
|
-
}>;
|
|
367
|
-
lastScrollAdjustForHistory?: number;
|
|
368
|
-
startReachedSnapshot: ThresholdSnapshot | undefined;
|
|
369
|
-
endReachedSnapshot: ThresholdSnapshot | undefined;
|
|
370
|
-
scrollForNextCalculateItemsInView: {
|
|
371
|
-
top: number;
|
|
372
|
-
bottom: number;
|
|
373
|
-
} | undefined;
|
|
374
|
-
enableScrollForNextCalculateItemsInView: boolean;
|
|
375
|
-
minIndexSizeChanged: number | undefined;
|
|
376
|
-
queuedInitialLayout?: boolean | undefined;
|
|
377
|
-
queuedCalculateItemsInView: number | undefined;
|
|
378
|
-
dataChangeNeedsScrollUpdate: boolean;
|
|
379
|
-
previousData?: readonly unknown[];
|
|
380
|
-
didColumnsChange?: boolean;
|
|
381
|
-
didDataChange?: boolean;
|
|
382
|
-
isFirst?: boolean;
|
|
383
|
-
lastBatchingAction: number;
|
|
384
|
-
ignoreScrollFromMVCP?: {
|
|
385
|
-
lt?: number;
|
|
386
|
-
gt?: number;
|
|
387
|
-
};
|
|
388
|
-
ignoreScrollFromMVCPIgnored?: boolean;
|
|
389
|
-
ignoreScrollFromMVCPTimeout?: any;
|
|
390
|
-
needsOtherAxisSize?: boolean;
|
|
391
|
-
averageSizes: Record<string, {
|
|
392
|
-
num: number;
|
|
393
|
-
avg: number;
|
|
394
|
-
}>;
|
|
395
|
-
refScroller: React.RefObject<ScrollView>;
|
|
396
|
-
loadStartTime: number;
|
|
397
|
-
initialScroll: ScrollIndexWithOffsetAndContentOffset | undefined;
|
|
398
|
-
initialAnchor?: InitialScrollAnchor;
|
|
399
|
-
lastLayout: LayoutRectangle | undefined;
|
|
400
|
-
timeoutSetPaddingTop?: any;
|
|
401
|
-
activeStickyIndex: number | undefined;
|
|
402
|
-
stickyContainers: Map<number, number>;
|
|
403
|
-
stickyContainerPool: Set<number>;
|
|
404
|
-
scrollProcessingEnabled: boolean;
|
|
405
|
-
pendingTotalSize?: number;
|
|
406
|
-
props: {
|
|
407
|
-
alignItemsAtEnd: boolean;
|
|
408
|
-
data: readonly any[];
|
|
409
|
-
dataVersion: Key | undefined;
|
|
410
|
-
estimatedItemSize: number | undefined;
|
|
411
|
-
getEstimatedItemSize: LegendListProps["getEstimatedItemSize"];
|
|
412
|
-
getFixedItemSize: LegendListProps["getFixedItemSize"];
|
|
413
|
-
getItemType: LegendListProps["getItemType"];
|
|
414
|
-
horizontal: boolean;
|
|
415
|
-
keyExtractor: LegendListProps["keyExtractor"];
|
|
416
|
-
maintainScrollAtEnd: boolean | MaintainScrollAtEndOptions;
|
|
417
|
-
maintainScrollAtEndThreshold: number | undefined;
|
|
418
|
-
maintainVisibleContentPosition: boolean;
|
|
419
|
-
onEndReached: LegendListProps["onEndReached"];
|
|
420
|
-
onEndReachedThreshold: number | null | undefined;
|
|
421
|
-
onItemSizeChanged: LegendListProps["onItemSizeChanged"];
|
|
422
|
-
onLoad: LegendListProps["onLoad"];
|
|
423
|
-
onScroll: LegendListProps["onScroll"];
|
|
424
|
-
onStartReached: LegendListProps["onStartReached"];
|
|
425
|
-
onStartReachedThreshold: number | null | undefined;
|
|
426
|
-
onStickyHeaderChange: LegendListProps["onStickyHeaderChange"];
|
|
427
|
-
recycleItems: boolean;
|
|
428
|
-
suggestEstimatedItemSize: boolean;
|
|
429
|
-
stylePaddingBottom: number | undefined;
|
|
430
|
-
renderItem: LegendListProps["renderItem"];
|
|
431
|
-
scrollBuffer: number;
|
|
432
|
-
numColumns: number;
|
|
433
|
-
initialContainerPoolRatio: number;
|
|
434
|
-
stylePaddingTop: number | undefined;
|
|
435
|
-
snapToIndices: number[] | undefined;
|
|
436
|
-
stickyIndicesSet: Set<number>;
|
|
437
|
-
stickyIndicesArr: number[];
|
|
438
|
-
itemsAreEqual: LegendListProps["itemsAreEqual"];
|
|
439
|
-
enableAverages: boolean;
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
interface ViewableRange<T> {
|
|
443
|
-
startBuffered: number;
|
|
444
|
-
start: number;
|
|
445
|
-
endBuffered: number;
|
|
446
|
-
end: number;
|
|
447
|
-
items: T[];
|
|
448
|
-
}
|
|
449
|
-
interface LegendListRenderItemProps<ItemT, TItemType extends string | number | undefined = string | number | undefined> {
|
|
450
|
-
item: ItemT;
|
|
451
|
-
type: TItemType;
|
|
452
|
-
index: number;
|
|
453
|
-
data: readonly ItemT[];
|
|
454
|
-
extraData: any;
|
|
455
|
-
}
|
|
456
|
-
type ScrollState = {
|
|
457
|
-
activeStickyIndex: number | undefined;
|
|
458
|
-
contentLength: number;
|
|
459
|
-
data: readonly any[];
|
|
460
|
-
elementAtIndex: (index: number) => View | null | undefined;
|
|
461
|
-
end: number;
|
|
462
|
-
endBuffered: number;
|
|
463
|
-
isAtEnd: boolean;
|
|
464
|
-
isAtStart: boolean;
|
|
465
|
-
positionAtIndex: (index: number) => number;
|
|
466
|
-
positions: Map<string, number>;
|
|
467
|
-
scroll: number;
|
|
468
|
-
scrollLength: number;
|
|
469
|
-
sizeAtIndex: (index: number) => number;
|
|
470
|
-
sizes: Map<string, number>;
|
|
471
|
-
start: number;
|
|
472
|
-
startBuffered: number;
|
|
473
|
-
};
|
|
474
|
-
type LegendListRef = {
|
|
475
|
-
/**
|
|
476
|
-
* Displays the scroll indicators momentarily.
|
|
477
|
-
*/
|
|
478
|
-
flashScrollIndicators(): void;
|
|
479
|
-
/**
|
|
480
|
-
* Returns the native ScrollView component reference.
|
|
481
|
-
*/
|
|
482
|
-
getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
483
|
-
/**
|
|
484
|
-
* Returns the scroll responder instance for handling scroll events.
|
|
485
|
-
*/
|
|
486
|
-
getScrollableNode(): any;
|
|
487
|
-
/**
|
|
488
|
-
* Returns the ScrollResponderMixin for advanced scroll handling.
|
|
489
|
-
*/
|
|
490
|
-
getScrollResponder(): ScrollResponderMixin;
|
|
491
|
-
/**
|
|
492
|
-
* Returns the internal state of the scroll virtualization.
|
|
493
|
-
*/
|
|
494
|
-
getState(): ScrollState;
|
|
495
|
-
/**
|
|
496
|
-
* Scrolls a specific index into view.
|
|
497
|
-
* @param params - Parameters for scrolling.
|
|
498
|
-
* @param params.animated - If true, animates the scroll. Default: true.
|
|
499
|
-
* @param params.index - The index to scroll to.
|
|
500
|
-
*/
|
|
501
|
-
scrollIndexIntoView(params: {
|
|
502
|
-
animated?: boolean | undefined;
|
|
503
|
-
index: number;
|
|
504
|
-
}): void;
|
|
505
|
-
/**
|
|
506
|
-
* Scrolls a specific index into view.
|
|
507
|
-
* @param params - Parameters for scrolling.
|
|
508
|
-
* @param params.animated - If true, animates the scroll. Default: true.
|
|
509
|
-
* @param params.item - The item to scroll to.
|
|
510
|
-
*/
|
|
511
|
-
scrollItemIntoView(params: {
|
|
512
|
-
animated?: boolean | undefined;
|
|
513
|
-
item: any;
|
|
514
|
-
}): void;
|
|
515
|
-
/**
|
|
516
|
-
* Scrolls to the end of the list.
|
|
517
|
-
* @param options - Options for scrolling.
|
|
518
|
-
* @param options.animated - If true, animates the scroll. Default: true.
|
|
519
|
-
* @param options.viewOffset - Offset from the target position.
|
|
520
|
-
*/
|
|
521
|
-
scrollToEnd(options?: {
|
|
522
|
-
animated?: boolean | undefined;
|
|
523
|
-
viewOffset?: number | undefined;
|
|
524
|
-
}): void;
|
|
525
|
-
/**
|
|
526
|
-
* Scrolls to a specific index in the list.
|
|
527
|
-
* @param params - Parameters for scrolling.
|
|
528
|
-
* @param params.animated - If true, animates the scroll. Default: true.
|
|
529
|
-
* @param params.index - The index to scroll to.
|
|
530
|
-
* @param params.viewOffset - Offset from the target position.
|
|
531
|
-
* @param params.viewPosition - Position of the item in the viewport (0 to 1).
|
|
532
|
-
*/
|
|
533
|
-
scrollToIndex(params: {
|
|
534
|
-
animated?: boolean | undefined;
|
|
535
|
-
index: number;
|
|
536
|
-
viewOffset?: number | undefined;
|
|
537
|
-
viewPosition?: number | undefined;
|
|
538
|
-
}): void;
|
|
539
|
-
/**
|
|
540
|
-
* Scrolls to a specific item in the list.
|
|
541
|
-
* @param params - Parameters for scrolling.
|
|
542
|
-
* @param params.animated - If true, animates the scroll. Default: true.
|
|
543
|
-
* @param params.item - The item to scroll to.
|
|
544
|
-
* @param params.viewOffset - Offset from the target position.
|
|
545
|
-
* @param params.viewPosition - Position of the item in the viewport (0 to 1).
|
|
546
|
-
*/
|
|
547
|
-
scrollToItem(params: {
|
|
548
|
-
animated?: boolean | undefined;
|
|
549
|
-
item: any;
|
|
550
|
-
viewOffset?: number | undefined;
|
|
551
|
-
viewPosition?: number | undefined;
|
|
552
|
-
}): void;
|
|
553
|
-
/**
|
|
554
|
-
* Scrolls to a specific offset in pixels.
|
|
555
|
-
* @param params - Parameters for scrolling.
|
|
556
|
-
* @param params.offset - The pixel offset to scroll to.
|
|
557
|
-
* @param params.animated - If true, animates the scroll. Default: true.
|
|
558
|
-
*/
|
|
559
|
-
scrollToOffset(params: {
|
|
560
|
-
offset: number;
|
|
561
|
-
animated?: boolean | undefined;
|
|
562
|
-
}): void;
|
|
563
|
-
/**
|
|
564
|
-
* Sets or adds to the offset of the visible content anchor.
|
|
565
|
-
* @param value - The offset to set or add.
|
|
566
|
-
* @param animated - If true, uses Animated to animate the change.
|
|
567
|
-
*/
|
|
568
|
-
setVisibleContentAnchorOffset(value: number | ((value: number) => number)): void;
|
|
569
|
-
/**
|
|
570
|
-
* Sets whether scroll processing is enabled.
|
|
571
|
-
* @param enabled - If true, scroll processing is enabled.
|
|
572
|
-
*/
|
|
573
|
-
setScrollProcessingEnabled(enabled: boolean): void;
|
|
574
|
-
};
|
|
575
|
-
interface ViewToken<ItemT = any> {
|
|
576
|
-
item: ItemT;
|
|
577
|
-
key: string;
|
|
578
|
-
index: number;
|
|
579
|
-
isViewable: boolean;
|
|
580
|
-
containerId: number;
|
|
581
|
-
}
|
|
582
|
-
interface ViewAmountToken<ItemT = any> extends ViewToken<ItemT> {
|
|
583
|
-
sizeVisible: number;
|
|
584
|
-
size: number;
|
|
585
|
-
percentVisible: number;
|
|
586
|
-
percentOfScroller: number;
|
|
587
|
-
scrollSize: number;
|
|
588
|
-
}
|
|
589
|
-
interface ViewabilityConfigCallbackPair<ItemT = any> {
|
|
590
|
-
viewabilityConfig: ViewabilityConfig;
|
|
591
|
-
onViewableItemsChanged?: OnViewableItemsChanged<ItemT>;
|
|
592
|
-
}
|
|
593
|
-
type ViewabilityConfigCallbackPairs<ItemT> = ViewabilityConfigCallbackPair<ItemT>[];
|
|
594
|
-
type OnViewableItemsChanged<ItemT> = ((info: {
|
|
595
|
-
viewableItems: Array<ViewToken<ItemT>>;
|
|
596
|
-
changed: Array<ViewToken<ItemT>>;
|
|
597
|
-
}) => void) | null;
|
|
598
|
-
interface ViewabilityConfig {
|
|
599
|
-
/**
|
|
600
|
-
* A unique ID to identify this viewability config
|
|
601
|
-
*/
|
|
602
|
-
id?: string;
|
|
603
|
-
/**
|
|
604
|
-
* Minimum amount of time (in milliseconds) that an item must be physically viewable before the
|
|
605
|
-
* viewability callback will be fired. A high number means that scrolling through content without
|
|
606
|
-
* stopping will not mark the content as viewable.
|
|
607
|
-
*/
|
|
608
|
-
minimumViewTime?: number | undefined;
|
|
609
|
-
/**
|
|
610
|
-
* Percent of viewport that must be covered for a partially occluded item to count as
|
|
611
|
-
* "viewable", 0-100. Fully visible items are always considered viewable. A value of 0 means
|
|
612
|
-
* that a single pixel in the viewport makes the item viewable, and a value of 100 means that
|
|
613
|
-
* an item must be either entirely visible or cover the entire viewport to count as viewable.
|
|
614
|
-
*/
|
|
615
|
-
viewAreaCoveragePercentThreshold?: number | undefined;
|
|
616
|
-
/**
|
|
617
|
-
* Similar to `viewAreaCoveragePercentThreshold`, but considers the percent of the item that is visible,
|
|
618
|
-
* rather than the fraction of the viewable area it covers.
|
|
619
|
-
*/
|
|
620
|
-
itemVisiblePercentThreshold?: number | undefined;
|
|
621
|
-
/**
|
|
622
|
-
* Nothing is considered viewable until the user scrolls or `recordInteraction` is called after
|
|
623
|
-
* render.
|
|
624
|
-
*/
|
|
625
|
-
waitForInteraction?: boolean | undefined;
|
|
626
|
-
}
|
|
627
|
-
type ViewabilityCallback<ItemT = any> = (viewToken: ViewToken<ItemT>) => void;
|
|
628
|
-
type ViewabilityAmountCallback<ItemT = any> = (viewToken: ViewAmountToken<ItemT>) => void;
|
|
629
|
-
interface LegendListRecyclingState<T> {
|
|
630
|
-
item: T;
|
|
631
|
-
prevItem: T | undefined;
|
|
632
|
-
index: number;
|
|
633
|
-
prevIndex: number | undefined;
|
|
634
|
-
}
|
|
635
|
-
type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
|
|
636
|
-
declare const typedForwardRef: TypedForwardRef;
|
|
637
|
-
type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<React.JSXElementConstructor<T>>, nextProps: Readonly<React.JSXElementConstructor<T>>) => boolean) => T & {
|
|
638
|
-
displayName?: string;
|
|
639
|
-
};
|
|
640
|
-
declare const typedMemo: TypedMemo;
|
|
641
|
-
interface ScrollIndexWithOffset {
|
|
642
|
-
index: number;
|
|
643
|
-
viewOffset?: number;
|
|
644
|
-
viewPosition?: number;
|
|
645
|
-
}
|
|
646
|
-
interface ScrollIndexWithOffsetPosition extends ScrollIndexWithOffset {
|
|
647
|
-
viewPosition?: number;
|
|
648
|
-
}
|
|
649
|
-
interface ScrollIndexWithOffsetAndContentOffset extends ScrollIndexWithOffsetPosition {
|
|
650
|
-
contentOffset?: number;
|
|
651
|
-
}
|
|
652
|
-
interface InitialScrollAnchor extends ScrollIndexWithOffsetPosition {
|
|
653
|
-
attempts?: number;
|
|
654
|
-
lastDelta?: number;
|
|
655
|
-
settledTicks?: number;
|
|
656
|
-
}
|
|
657
|
-
type GetRenderedItemResult<ItemT> = {
|
|
658
|
-
index: number;
|
|
659
|
-
item: ItemT;
|
|
660
|
-
renderedItem: React.ReactNode;
|
|
661
|
-
};
|
|
662
|
-
type GetRenderedItem = (key: string) => GetRenderedItemResult<any> | null;
|
|
663
|
-
|
|
664
|
-
declare const LegendList: (<T>(props: LegendListProps<T> & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode) & {
|
|
8
|
+
declare const LegendList: (<T>(props: LegendListProps<T> & React.RefAttributes<LegendListRef>) => React.ReactNode) & {
|
|
665
9
|
displayName?: string;
|
|
666
10
|
};
|
|
667
11
|
|
|
@@ -676,4 +20,4 @@ declare function useListScrollSize(): {
|
|
|
676
20
|
};
|
|
677
21
|
declare function useSyncLayout(): () => void;
|
|
678
22
|
|
|
679
|
-
export {
|
|
23
|
+
export { LegendList, LegendListProps, LegendListRecyclingState, LegendListRef, ViewabilityAmountCallback, ViewabilityCallback, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
|