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