@legendapp/list 1.0.0-beta.9 → 1.0.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 +5 -0
- package/README.md +98 -43
- package/animated.d.mts +54 -4
- package/animated.d.ts +54 -4
- package/index.d.mts +341 -63
- package/index.d.ts +341 -63
- package/index.js +1130 -428
- package/index.mjs +1108 -406
- package/keyboard-controller.d.mts +401 -0
- package/keyboard-controller.d.ts +401 -0
- package/keyboard-controller.js +69 -0
- package/keyboard-controller.mjs +48 -0
- package/package.json +3 -6
- package/reanimated.d.mts +12 -11
- package/reanimated.d.ts +12 -11
- package/reanimated.js +27 -16
- package/reanimated.mjs +28 -17
package/index.d.ts
CHANGED
|
@@ -1,54 +1,139 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { ComponentProps, ReactNode,
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
|
|
3
|
+
import * as react_native from 'react-native';
|
|
4
|
+
import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
|
|
5
|
+
import react_native_reanimated__default from 'react-native-reanimated';
|
|
5
6
|
|
|
6
7
|
declare class ScrollAdjustHandler {
|
|
7
8
|
private ctx;
|
|
8
9
|
private appliedAdjust;
|
|
9
|
-
private pendingAdjust;
|
|
10
10
|
private busy;
|
|
11
11
|
private context;
|
|
12
|
-
private
|
|
12
|
+
private isPaused;
|
|
13
|
+
private isDisabled;
|
|
13
14
|
constructor(ctx: any);
|
|
15
|
+
private doAjdust;
|
|
14
16
|
requestAdjust(adjust: number, onAdjusted: (diff: number) => void): void;
|
|
15
17
|
getAppliedAdjust(): number;
|
|
18
|
+
pauseAdjust(): void;
|
|
19
|
+
setDisableAdjust(disable: boolean): void;
|
|
20
|
+
unPauseAdjust(): boolean;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof
|
|
23
|
+
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof react_native_reanimated__default.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
|
|
24
|
+
/**
|
|
25
|
+
* If true, aligns items at the end of the list.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
alignItemsAtEnd?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Style applied to each column's wrapper view.
|
|
31
|
+
*/
|
|
32
|
+
columnWrapperStyle?: ColumnWrapperStyle;
|
|
33
|
+
/**
|
|
34
|
+
* Array of items to render in the list.
|
|
35
|
+
* @required
|
|
36
|
+
*/
|
|
19
37
|
data: ReadonlyArray<ItemT>;
|
|
38
|
+
/**
|
|
39
|
+
* Distance in pixels to pre-render items ahead of the visible area.
|
|
40
|
+
* @default 250
|
|
41
|
+
*/
|
|
42
|
+
drawDistance?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Estimated size of each item in pixels, a hint for the first render. After some
|
|
45
|
+
* items are rendered, the average size of rendered items will be used instead.
|
|
46
|
+
* @default undefined
|
|
47
|
+
*/
|
|
48
|
+
estimatedItemSize?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Extra data to trigger re-rendering when changed.
|
|
51
|
+
*/
|
|
52
|
+
extraData?: any;
|
|
53
|
+
/**
|
|
54
|
+
* In case you have distinct item sizes, you can provide a function to get the size of an item.
|
|
55
|
+
* Use instead of FlatList's getItemLayout or FlashList overrideItemLayout if you want to have accurate initialScrollOffset, you should provide this function
|
|
56
|
+
*/
|
|
57
|
+
getEstimatedItemSize?: (index: number, item: ItemT) => number;
|
|
58
|
+
/**
|
|
59
|
+
* Ratio of initial container pool size to data length (e.g., 0.5 for half).
|
|
60
|
+
* @default 1
|
|
61
|
+
*/
|
|
62
|
+
initialContainerPoolRatio?: number | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Initial scroll position in pixels.
|
|
65
|
+
* @default 0
|
|
66
|
+
*/
|
|
20
67
|
initialScrollOffset?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Index to scroll to initially.
|
|
70
|
+
* @default 0
|
|
71
|
+
*/
|
|
21
72
|
initialScrollIndex?: number;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Component to render between items, receiving the leading item as prop.
|
|
75
|
+
*/
|
|
76
|
+
ItemSeparatorComponent?: React.ComponentType<{
|
|
77
|
+
leadingItem: ItemT;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Function to extract a unique key for each item.
|
|
81
|
+
*/
|
|
82
|
+
keyExtractor?: (item: ItemT, index: number) => string;
|
|
83
|
+
/**
|
|
84
|
+
* Component or element to render when the list is empty.
|
|
85
|
+
*/
|
|
86
|
+
ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Component or element to render below the list.
|
|
89
|
+
*/
|
|
90
|
+
ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Style for the footer component.
|
|
93
|
+
*/
|
|
94
|
+
ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Component or element to render above the list.
|
|
97
|
+
*/
|
|
98
|
+
ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Style for the header component.
|
|
101
|
+
*/
|
|
102
|
+
ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* If true, auto-scrolls to end when new items are added.
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
26
107
|
maintainScrollAtEnd?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Distance threshold in percentage of screen size to trigger maintainScrollAtEnd.
|
|
110
|
+
* @default 0.1
|
|
111
|
+
*/
|
|
27
112
|
maintainScrollAtEndThreshold?: number;
|
|
28
|
-
|
|
113
|
+
/**
|
|
114
|
+
* If true, maintains visibility of content during scroll (e.g., after insertions).
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
29
117
|
maintainVisibleContentPosition?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Number of columns to render items in.
|
|
120
|
+
* @default 1
|
|
121
|
+
*/
|
|
30
122
|
numColumns?: number;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
getEstimatedItemSize?: (index: number, item: ItemT) => number;
|
|
35
|
-
onStartReached?: ((info: {
|
|
36
|
-
distanceFromStart: number;
|
|
37
|
-
}) => void) | null | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Called when scrolling reaches the end within onEndReachedThreshold.
|
|
125
|
+
*/
|
|
38
126
|
onEndReached?: ((info: {
|
|
39
127
|
distanceFromEnd: number;
|
|
40
128
|
}) => void) | null | undefined;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
|
|
50
|
-
viewabilityConfig?: ViewabilityConfig;
|
|
51
|
-
onViewableItemsChanged?: OnViewableItemsChanged | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* How close to the end (in fractional units of visible length) to trigger onEndReached.
|
|
131
|
+
* @default 0.5
|
|
132
|
+
*/
|
|
133
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Called when an item's size changes.
|
|
136
|
+
*/
|
|
52
137
|
onItemSizeChanged?: (info: {
|
|
53
138
|
size: number;
|
|
54
139
|
previous: number;
|
|
@@ -56,19 +141,85 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
56
141
|
itemKey: string;
|
|
57
142
|
itemData: ItemT;
|
|
58
143
|
}) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Function to call when the user pulls to refresh.
|
|
146
|
+
*/
|
|
147
|
+
onRefresh?: () => void;
|
|
148
|
+
/**
|
|
149
|
+
* Called when scrolling reaches the start within onStartReachedThreshold.
|
|
150
|
+
*/
|
|
151
|
+
onStartReached?: ((info: {
|
|
152
|
+
distanceFromStart: number;
|
|
153
|
+
}) => void) | null | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* How close to the start (in fractional units of visible length) to trigger onStartReached.
|
|
156
|
+
* @default 0.5
|
|
157
|
+
*/
|
|
158
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* Called when the viewability of items changes.
|
|
161
|
+
*/
|
|
162
|
+
onViewableItemsChanged?: OnViewableItemsChanged | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Offset in pixels for the refresh indicator.
|
|
165
|
+
* @default 0
|
|
166
|
+
*/
|
|
167
|
+
progressViewOffset?: number;
|
|
168
|
+
/**
|
|
169
|
+
* If true, recycles item views for better performance.
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
recycleItems?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Ref to the underlying ScrollView component.
|
|
175
|
+
*/
|
|
176
|
+
refScrollView?: React.Ref<ScrollView>;
|
|
177
|
+
/**
|
|
178
|
+
* If true, shows a refresh indicator.
|
|
179
|
+
* @default false
|
|
180
|
+
*/
|
|
181
|
+
refreshing?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Function to render each item in the list.
|
|
184
|
+
* @required
|
|
185
|
+
*/
|
|
186
|
+
renderItem?: (props: LegendListRenderItemProps<ItemT>) => ReactNode;
|
|
59
187
|
/**
|
|
60
188
|
* Render custom ScrollView component.
|
|
61
189
|
* @default (props) => <ScrollView {...props} />
|
|
62
190
|
*/
|
|
63
191
|
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
64
|
-
|
|
192
|
+
/**
|
|
193
|
+
* This will log a suggested estimatedItemSize.
|
|
194
|
+
* @required
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
suggestEstimatedItemSize?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Configuration for determining item viewability.
|
|
200
|
+
*/
|
|
201
|
+
viewabilityConfig?: ViewabilityConfig;
|
|
202
|
+
/**
|
|
203
|
+
* Pairs of viewability configs and their callbacks for tracking visibility.
|
|
204
|
+
*/
|
|
205
|
+
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* If true, delays rendering until initial layout is complete.
|
|
208
|
+
* @default false
|
|
209
|
+
*/
|
|
210
|
+
waitForInitialLayout?: boolean;
|
|
65
211
|
};
|
|
212
|
+
interface ColumnWrapperStyle {
|
|
213
|
+
rowGap?: number;
|
|
214
|
+
gap?: number;
|
|
215
|
+
columnGap?: number;
|
|
216
|
+
}
|
|
66
217
|
type AnchoredPosition = {
|
|
67
|
-
type:
|
|
218
|
+
type: "top" | "bottom";
|
|
68
219
|
relativeCoordinate: number;
|
|
69
220
|
top: number;
|
|
70
221
|
};
|
|
71
|
-
type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
|
|
222
|
+
type LegendListProps<ItemT> = LegendListPropsBase<ItemT, Omit<ComponentProps<typeof ScrollView>, "scrollEventThrottle">>;
|
|
72
223
|
interface InternalState {
|
|
73
224
|
anchorElement?: {
|
|
74
225
|
id: string;
|
|
@@ -79,16 +230,14 @@ interface InternalState {
|
|
|
79
230
|
positions: Map<string, number>;
|
|
80
231
|
columns: Map<string, number>;
|
|
81
232
|
sizes: Map<string, number>;
|
|
82
|
-
|
|
233
|
+
sizesKnown: Map<string, number>;
|
|
83
234
|
pendingAdjust: number;
|
|
84
|
-
waitingForMicrotask: any;
|
|
85
235
|
isStartReached: boolean;
|
|
86
236
|
isEndReached: boolean;
|
|
87
237
|
isAtBottom: boolean;
|
|
88
238
|
isAtTop: boolean;
|
|
89
239
|
data: readonly any[];
|
|
90
|
-
|
|
91
|
-
hasScrolled: boolean;
|
|
240
|
+
hasScrolled?: boolean;
|
|
92
241
|
scrollLength: number;
|
|
93
242
|
startBuffered: number;
|
|
94
243
|
startBufferedId?: string;
|
|
@@ -101,6 +250,7 @@ interface InternalState {
|
|
|
101
250
|
scrollPrevTime: number;
|
|
102
251
|
scrollVelocity: number;
|
|
103
252
|
scrollAdjustHandler: ScrollAdjustHandler;
|
|
253
|
+
maintainingScrollAtEnd?: boolean;
|
|
104
254
|
totalSize: number;
|
|
105
255
|
totalSizeBelowAnchor: number;
|
|
106
256
|
timeouts: Set<number>;
|
|
@@ -115,12 +265,24 @@ interface InternalState {
|
|
|
115
265
|
}>;
|
|
116
266
|
scrollTimer: Timer | undefined;
|
|
117
267
|
startReachedBlockedByTimer: boolean;
|
|
268
|
+
endReachedBlockedByTimer: boolean;
|
|
118
269
|
scrollForNextCalculateItemsInView: {
|
|
119
270
|
top: number;
|
|
120
271
|
bottom: number;
|
|
121
272
|
} | undefined;
|
|
122
273
|
enableScrollForNextCalculateItemsInView: boolean;
|
|
123
274
|
minIndexSizeChanged: number | undefined;
|
|
275
|
+
numPendingInitialLayout: number;
|
|
276
|
+
queuedInitialLayout?: boolean | undefined;
|
|
277
|
+
queuedCalculateItemsInView: number | undefined;
|
|
278
|
+
lastBatchingAction: number;
|
|
279
|
+
ignoreScrollFromCalcTotal?: boolean;
|
|
280
|
+
scrollingToOffset?: number | undefined;
|
|
281
|
+
averageSizes: Record<string, {
|
|
282
|
+
num: number;
|
|
283
|
+
avg: number;
|
|
284
|
+
}>;
|
|
285
|
+
onScroll: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
|
|
124
286
|
}
|
|
125
287
|
interface ViewableRange<T> {
|
|
126
288
|
startBuffered: number;
|
|
@@ -132,44 +294,105 @@ interface ViewableRange<T> {
|
|
|
132
294
|
interface LegendListRenderItemProps<ItemT> {
|
|
133
295
|
item: ItemT;
|
|
134
296
|
index: number;
|
|
135
|
-
|
|
136
|
-
useViewabilityAmount: (callback: ViewabilityAmountCallback) => void;
|
|
137
|
-
useRecyclingEffect: (effect: (info: LegendListRecyclingState<ItemT>) => void | (() => void)) => void;
|
|
138
|
-
useRecyclingState: <T>(updateState: ((info: LegendListRecyclingState<ItemT>) => T) | T) => [T, React.Dispatch<T>];
|
|
297
|
+
extraData: any;
|
|
139
298
|
}
|
|
299
|
+
type ScrollState = {
|
|
300
|
+
contentLength: number;
|
|
301
|
+
end: number;
|
|
302
|
+
endBuffered: number;
|
|
303
|
+
isAtEnd: boolean;
|
|
304
|
+
isAtStart: boolean;
|
|
305
|
+
scroll: number;
|
|
306
|
+
scrollLength: number;
|
|
307
|
+
start: number;
|
|
308
|
+
startBuffered: number;
|
|
309
|
+
};
|
|
140
310
|
type LegendListRef = {
|
|
141
311
|
/**
|
|
142
312
|
* Displays the scroll indicators momentarily.
|
|
143
313
|
*/
|
|
144
314
|
flashScrollIndicators(): void;
|
|
315
|
+
/**
|
|
316
|
+
* Returns the native ScrollView component reference.
|
|
317
|
+
*/
|
|
145
318
|
getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
146
|
-
|
|
319
|
+
/**
|
|
320
|
+
* Returns the scroll responder instance for handling scroll events.
|
|
321
|
+
*/
|
|
147
322
|
getScrollableNode(): any;
|
|
148
323
|
/**
|
|
149
|
-
*
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*
|
|
154
|
-
|
|
324
|
+
* Returns the ScrollResponderMixin for advanced scroll handling.
|
|
325
|
+
*/
|
|
326
|
+
getScrollResponder(): ScrollResponderMixin;
|
|
327
|
+
/**
|
|
328
|
+
* Returns the internal state of the scroll virtualization.
|
|
329
|
+
*/
|
|
330
|
+
getState(): ScrollState;
|
|
331
|
+
/**
|
|
332
|
+
* Scrolls a specific index into view.
|
|
333
|
+
* @param params - Parameters for scrolling.
|
|
334
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
335
|
+
* @param params.index - The index to scroll to.
|
|
336
|
+
*/
|
|
337
|
+
scrollIndexIntoView(params: {
|
|
338
|
+
animated?: boolean | undefined;
|
|
339
|
+
index: number;
|
|
340
|
+
}): void;
|
|
341
|
+
/**
|
|
342
|
+
* Scrolls a specific index into view.
|
|
343
|
+
* @param params - Parameters for scrolling.
|
|
344
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
345
|
+
* @param params.item - The item to scroll to.
|
|
346
|
+
*/
|
|
347
|
+
scrollItemIntoView(params: {
|
|
348
|
+
animated?: boolean | undefined;
|
|
349
|
+
item: any;
|
|
350
|
+
}): void;
|
|
351
|
+
/**
|
|
352
|
+
* Scrolls to the end of the list.
|
|
353
|
+
* @param options - Options for scrolling.
|
|
354
|
+
* @param options.animated - If true, animates the scroll. Default: true.
|
|
155
355
|
*/
|
|
156
356
|
scrollToEnd(options?: {
|
|
157
357
|
animated?: boolean | undefined;
|
|
158
358
|
}): void;
|
|
159
|
-
|
|
359
|
+
/**
|
|
360
|
+
* Scrolls to a specific index in the list.
|
|
361
|
+
* @param params - Parameters for scrolling.
|
|
362
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
363
|
+
* @param params.index - The index to scroll to.
|
|
364
|
+
* @param params.viewOffset - Offset from the target position.
|
|
365
|
+
* @param params.viewPosition - Position of the item in the viewport (0 to 1).
|
|
366
|
+
*/
|
|
367
|
+
scrollToIndex(params: {
|
|
368
|
+
animated?: boolean | undefined;
|
|
160
369
|
index: number;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
370
|
+
viewOffset?: number | undefined;
|
|
371
|
+
viewPosition?: number | undefined;
|
|
372
|
+
}): void;
|
|
373
|
+
/**
|
|
374
|
+
* Scrolls to a specific item in the list.
|
|
375
|
+
* @param params - Parameters for scrolling.
|
|
376
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
377
|
+
* @param params.item - The item to scroll to.
|
|
378
|
+
* @param params.viewOffset - Offset from the target position.
|
|
379
|
+
* @param params.viewPosition - Position of the item in the viewport (0 to 1).
|
|
380
|
+
*/
|
|
165
381
|
scrollToItem(params: {
|
|
166
|
-
animated?: boolean;
|
|
382
|
+
animated?: boolean | undefined;
|
|
167
383
|
item: any;
|
|
168
|
-
|
|
384
|
+
viewOffset?: number | undefined;
|
|
385
|
+
viewPosition?: number | undefined;
|
|
169
386
|
}): void;
|
|
387
|
+
/**
|
|
388
|
+
* Scrolls to a specific offset in pixels.
|
|
389
|
+
* @param params - Parameters for scrolling.
|
|
390
|
+
* @param params.offset - The pixel offset to scroll to.
|
|
391
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
392
|
+
*/
|
|
170
393
|
scrollToOffset(params: {
|
|
171
394
|
offset: number;
|
|
172
|
-
animated?: boolean;
|
|
395
|
+
animated?: boolean | undefined;
|
|
173
396
|
}): void;
|
|
174
397
|
};
|
|
175
398
|
interface ViewToken<ItemT = any> {
|
|
@@ -177,13 +400,13 @@ interface ViewToken<ItemT = any> {
|
|
|
177
400
|
key: string;
|
|
178
401
|
index: number;
|
|
179
402
|
isViewable: boolean;
|
|
403
|
+
containerId: number;
|
|
180
404
|
}
|
|
181
405
|
interface ViewAmountToken<ItemT = any> extends ViewToken<ItemT> {
|
|
182
406
|
sizeVisible: number;
|
|
183
407
|
size: number;
|
|
184
408
|
percentVisible: number;
|
|
185
409
|
percentOfScroller: number;
|
|
186
|
-
position: number;
|
|
187
410
|
scrollSize: number;
|
|
188
411
|
}
|
|
189
412
|
interface ViewabilityConfigCallbackPair {
|
|
@@ -232,14 +455,69 @@ interface LegendListRecyclingState<T> {
|
|
|
232
455
|
index: number;
|
|
233
456
|
prevIndex: number | undefined;
|
|
234
457
|
}
|
|
458
|
+
type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
|
|
459
|
+
declare const typedForwardRef: TypedForwardRef;
|
|
460
|
+
type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean) => T & {
|
|
461
|
+
displayName?: string;
|
|
462
|
+
};
|
|
463
|
+
declare const typedMemo: TypedMemo;
|
|
235
464
|
|
|
236
|
-
declare const LegendList: <T>(props:
|
|
237
|
-
|
|
238
|
-
|
|
465
|
+
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
|
|
466
|
+
alignItemsAtEnd?: boolean;
|
|
467
|
+
columnWrapperStyle?: ColumnWrapperStyle;
|
|
468
|
+
data: readonly T[];
|
|
469
|
+
drawDistance?: number;
|
|
470
|
+
estimatedItemSize?: number;
|
|
471
|
+
extraData?: any;
|
|
472
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
473
|
+
initialContainerPoolRatio?: number | undefined;
|
|
474
|
+
initialScrollOffset?: number;
|
|
475
|
+
initialScrollIndex?: number;
|
|
476
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
477
|
+
leadingItem: T;
|
|
478
|
+
}> | undefined;
|
|
479
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
480
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
481
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
482
|
+
ListFooterComponentStyle?: react_native.StyleProp<ViewStyle> | undefined;
|
|
483
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
484
|
+
ListHeaderComponentStyle?: react_native.StyleProp<ViewStyle> | undefined;
|
|
485
|
+
maintainScrollAtEnd?: boolean;
|
|
486
|
+
maintainScrollAtEndThreshold?: number;
|
|
487
|
+
maintainVisibleContentPosition?: boolean;
|
|
488
|
+
numColumns?: number;
|
|
489
|
+
onEndReached?: ((info: {
|
|
490
|
+
distanceFromEnd: number;
|
|
491
|
+
}) => void) | null | undefined;
|
|
492
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
493
|
+
onItemSizeChanged?: ((info: {
|
|
494
|
+
size: number;
|
|
495
|
+
previous: number;
|
|
496
|
+
index: number;
|
|
497
|
+
itemKey: string;
|
|
498
|
+
itemData: T;
|
|
499
|
+
}) => void) | undefined;
|
|
500
|
+
onRefresh?: () => void;
|
|
501
|
+
onStartReached?: ((info: {
|
|
502
|
+
distanceFromStart: number;
|
|
503
|
+
}) => void) | null | undefined;
|
|
504
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
505
|
+
onViewableItemsChanged?: OnViewableItemsChanged | undefined;
|
|
506
|
+
progressViewOffset?: number;
|
|
507
|
+
recycleItems?: boolean;
|
|
508
|
+
refScrollView?: React$1.Ref<ScrollView>;
|
|
509
|
+
refreshing?: boolean;
|
|
510
|
+
renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
511
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
512
|
+
suggestEstimatedItemSize?: boolean;
|
|
513
|
+
viewabilityConfig?: ViewabilityConfig;
|
|
514
|
+
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
|
|
515
|
+
waitForInitialLayout?: boolean;
|
|
516
|
+
} & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
|
|
239
517
|
|
|
240
|
-
declare function useViewability(
|
|
518
|
+
declare function useViewability(callback: ViewabilityCallback, configId?: string): void;
|
|
241
519
|
declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
|
|
242
520
|
declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
|
|
243
|
-
declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<
|
|
521
|
+
declare function useRecyclingState<ItemT>(valueOrFun: ((info: LegendListRecyclingState<ItemT>) => ItemT) | ItemT): readonly [ItemT | null, Dispatch<SetStateAction<ItemT>>];
|
|
244
522
|
|
|
245
|
-
export { type AnchoredPosition, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
|
523
|
+
export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|