@legendapp/list 3.0.0-beta.9 → 3.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/.DS_Store +0 -0
- package/CHANGELOG.md +27 -1
- package/README.md +8 -2
- package/animated.d.ts +659 -5
- package/animated.js +2 -2
- package/animated.mjs +1 -1
- package/keyboard-legacy.d.ts +226 -0
- package/keyboard-legacy.js +456 -0
- package/keyboard-legacy.mjs +435 -0
- package/keyboard.d.ts +261 -9
- package/keyboard.js +114 -135
- package/keyboard.mjs +115 -137
- package/package.json +55 -5
- package/{types-1Hgg1rTO.d.mts → react-native.d.ts} +269 -284
- package/react-native.js +6471 -0
- package/react-native.mjs +6442 -0
- package/{types-1Hgg1rTO.d.ts → react-native.web.d.ts} +330 -283
- package/react-native.web.js +7125 -0
- package/react-native.web.mjs +7096 -0
- package/react.d.ts +771 -0
- package/react.js +7125 -0
- package/react.mjs +7096 -0
- package/reanimated.d.ts +681 -8
- package/reanimated.js +225 -38
- package/reanimated.mjs +227 -40
- package/section-list.d.ts +682 -7
- package/section-list.js +85 -3854
- package/section-list.mjs +83 -3853
- package/animated.d.mts +0 -9
- package/index.d.mts +0 -23
- package/index.d.ts +0 -23
- package/index.js +0 -3935
- package/index.mjs +0 -3907
- package/index.native.d.mts +0 -23
- package/index.native.d.ts +0 -23
- package/index.native.js +0 -3739
- package/index.native.mjs +0 -3711
- package/keyboard-controller.d.mts +0 -12
- package/keyboard-controller.d.ts +0 -12
- package/keyboard-controller.js +0 -69
- package/keyboard-controller.mjs +0 -48
- package/keyboard.d.mts +0 -13
- package/reanimated.d.mts +0 -18
- package/section-list.d.mts +0 -113
- package/section-list.native.d.mts +0 -113
- package/section-list.native.d.ts +0 -113
- package/section-list.native.js +0 -3897
- package/section-list.native.mjs +0 -3876
|
@@ -1,24 +1,55 @@
|
|
|
1
|
-
import * as React
|
|
2
|
-
import {
|
|
3
|
-
import { View, ScrollView, Animated, LayoutRectangle, ScrollViewProps, Insets, ScrollViewComponent, ScrollResponderMixin, StyleProp, ViewStyle, NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
|
|
4
|
-
import Reanimated from 'react-native-reanimated';
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Key, ReactElement, HTMLAttributes, CSSProperties, Ref, RefAttributes, Dispatch, SetStateAction } from 'react';
|
|
5
3
|
|
|
6
|
-
type
|
|
4
|
+
type ScrollEventTarget = Window | HTMLElement;
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
interface ScrollViewMethods {
|
|
7
|
+
getBoundingClientRect(): DOMRect | null | undefined;
|
|
8
|
+
getCurrentScrollOffset(): number;
|
|
9
|
+
getScrollableNode(): HTMLElement;
|
|
10
|
+
getScrollEventTarget(): ScrollEventTarget | null;
|
|
11
|
+
getScrollResponder(): HTMLElement | null;
|
|
12
|
+
isWindowScroll?(): boolean;
|
|
13
|
+
scrollBy(x: number, y: number): void;
|
|
14
|
+
scrollTo(options: {
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
animated?: boolean;
|
|
18
|
+
}): void;
|
|
19
|
+
scrollToEnd(options?: {
|
|
20
|
+
animated?: boolean;
|
|
21
|
+
}): void;
|
|
22
|
+
scrollToOffset(params: {
|
|
23
|
+
offset: number;
|
|
24
|
+
animated?: boolean;
|
|
25
|
+
}): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface MaintainVisibleContentPositionNormalized<ItemT = any> {
|
|
29
|
+
data: boolean;
|
|
30
|
+
size: boolean;
|
|
31
|
+
shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type ListenerType = "activeStickyIndex" | "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}`;
|
|
35
|
+
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
10
36
|
type ListenerTypeValueMap = {
|
|
11
37
|
activeStickyIndex: number;
|
|
12
|
-
|
|
38
|
+
anchoredEndSpaceSize: number;
|
|
13
39
|
animatedScrollY: any;
|
|
14
40
|
debugComputedScroll: number;
|
|
15
41
|
debugRawScroll: number;
|
|
16
42
|
extraData: any;
|
|
17
43
|
footerSize: number;
|
|
18
44
|
headerSize: number;
|
|
45
|
+
isAtEnd: boolean;
|
|
46
|
+
isAtStart: boolean;
|
|
47
|
+
isNearEnd: boolean;
|
|
48
|
+
isNearStart: boolean;
|
|
49
|
+
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
19
50
|
lastItemKeys: string[];
|
|
20
51
|
lastPositionUpdate: number;
|
|
21
|
-
maintainVisibleContentPosition:
|
|
52
|
+
maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
|
|
22
53
|
numColumns: number;
|
|
23
54
|
numContainers: number;
|
|
24
55
|
numContainersPooled: number;
|
|
@@ -43,49 +74,44 @@ type ListenerTypeValueMap = {
|
|
|
43
74
|
} & {
|
|
44
75
|
[K in ListenerType as K extends `containerColumn${number}` ? K : never]: number;
|
|
45
76
|
} & {
|
|
46
|
-
[K in ListenerType as K extends `
|
|
77
|
+
[K in ListenerType as K extends `containerSpan${number}` ? K : never]: number;
|
|
47
78
|
} & {
|
|
48
|
-
[K in ListenerType as K extends `
|
|
79
|
+
[K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
|
|
49
80
|
};
|
|
50
|
-
interface StateContext {
|
|
51
|
-
animatedScrollY: AnimatedValue;
|
|
52
|
-
columnWrapperStyle: ColumnWrapperStyle | undefined;
|
|
53
|
-
contextNum: number;
|
|
54
|
-
listeners: Map<ListenerType, Set<(value: any) => void>>;
|
|
55
|
-
mapViewabilityCallbacks: Map<string, ViewabilityCallback>;
|
|
56
|
-
mapViewabilityValues: Map<string, ViewToken>;
|
|
57
|
-
mapViewabilityAmountCallbacks: Map<number, ViewabilityAmountCallback>;
|
|
58
|
-
mapViewabilityAmountValues: Map<number, ViewAmountToken>;
|
|
59
|
-
mapViewabilityConfigStates: Map<string, {
|
|
60
|
-
viewableItems: ViewToken[];
|
|
61
|
-
start: number;
|
|
62
|
-
end: number;
|
|
63
|
-
previousStart: number;
|
|
64
|
-
previousEnd: number;
|
|
65
|
-
}>;
|
|
66
|
-
positionListeners: Map<string, Set<(value: any) => void>>;
|
|
67
|
-
state: InternalState;
|
|
68
|
-
values: Map<ListenerType, any>;
|
|
69
|
-
viewRefs: Map<number, React$1.RefObject<View>>;
|
|
70
|
-
}
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
requestAdjust(add: number): void;
|
|
78
|
-
getAdjust(): number;
|
|
79
|
-
commitPendingAdjust(): void;
|
|
82
|
+
interface Insets {
|
|
83
|
+
top: number;
|
|
84
|
+
left: number;
|
|
85
|
+
bottom: number;
|
|
86
|
+
right: number;
|
|
80
87
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
interface LayoutRectangle {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
}
|
|
94
|
+
interface NativeScrollEvent {
|
|
95
|
+
contentOffset: {
|
|
96
|
+
x: number;
|
|
97
|
+
y: number;
|
|
98
|
+
};
|
|
99
|
+
contentSize: {
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
};
|
|
103
|
+
layoutMeasurement: {
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
};
|
|
107
|
+
contentInset: Insets;
|
|
108
|
+
zoomScale: number;
|
|
109
|
+
}
|
|
110
|
+
interface NativeSyntheticEvent<T> {
|
|
111
|
+
nativeEvent: T;
|
|
112
|
+
}
|
|
113
|
+
type ViewStyle = Record<string, unknown>;
|
|
114
|
+
type StyleProp<T> = T | T[] | null | undefined | false;
|
|
89
115
|
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
|
|
90
116
|
interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
91
117
|
/**
|
|
@@ -94,13 +120,11 @@ interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
|
94
120
|
*/
|
|
95
121
|
data: ReadonlyArray<ItemT>;
|
|
96
122
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
|
|
100
|
-
* - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
|
|
123
|
+
* Callback to render each item in the list.
|
|
124
|
+
* To use hooks in an item component, return that component from this callback.
|
|
101
125
|
* @required when using data mode
|
|
102
126
|
*/
|
|
103
|
-
renderItem: (
|
|
127
|
+
renderItem: (props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode;
|
|
104
128
|
children?: never;
|
|
105
129
|
}
|
|
106
130
|
interface ChildrenModeProps {
|
|
@@ -109,7 +133,7 @@ interface ChildrenModeProps {
|
|
|
109
133
|
* Each child will be treated as an individual list item.
|
|
110
134
|
* @required when using children mode
|
|
111
135
|
*/
|
|
112
|
-
children: ReactNode;
|
|
136
|
+
children: React.ReactNode;
|
|
113
137
|
data?: never;
|
|
114
138
|
renderItem?: never;
|
|
115
139
|
}
|
|
@@ -119,10 +143,20 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
119
143
|
* @default false
|
|
120
144
|
*/
|
|
121
145
|
alignItemsAtEnd?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Keeps selected items mounted even when they scroll out of view.
|
|
148
|
+
* @default undefined
|
|
149
|
+
*/
|
|
150
|
+
alwaysRender?: AlwaysRenderConfig;
|
|
122
151
|
/**
|
|
123
152
|
* Style applied to each column's wrapper view.
|
|
124
153
|
*/
|
|
125
154
|
columnWrapperStyle?: ColumnWrapperStyle;
|
|
155
|
+
/**
|
|
156
|
+
* Version token that forces the list to treat data as updated even when the array reference is stable.
|
|
157
|
+
* Increment or change this when mutating the data array in place.
|
|
158
|
+
*/
|
|
159
|
+
dataVersion?: Key;
|
|
126
160
|
/**
|
|
127
161
|
* Distance in pixels to pre-render items ahead of the visible area.
|
|
128
162
|
* @default 250
|
|
@@ -147,25 +181,25 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
147
181
|
*/
|
|
148
182
|
extraData?: any;
|
|
149
183
|
/**
|
|
150
|
-
*
|
|
151
|
-
* Increment or change this when mutating the data array in place.
|
|
184
|
+
* In case items always have a fixed size, you can provide a function to return it.
|
|
152
185
|
*/
|
|
153
|
-
|
|
186
|
+
getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
|
|
154
187
|
/**
|
|
155
|
-
*
|
|
156
|
-
* Use instead of FlatList's getItemLayout or FlashList overrideItemLayout if you want to have accurate initialScrollOffset, you should provide this function
|
|
188
|
+
* Returns a stable item type used for pooling and size estimation.
|
|
157
189
|
*/
|
|
158
|
-
|
|
190
|
+
getItemType?: (item: ItemT, index: number) => TItemType;
|
|
159
191
|
/**
|
|
160
|
-
*
|
|
161
|
-
* @default 2
|
|
192
|
+
* Component to render between items, receiving the leading item as prop.
|
|
162
193
|
*/
|
|
163
|
-
|
|
194
|
+
ItemSeparatorComponent?: React.ComponentType<{
|
|
195
|
+
leadingItem: ItemT;
|
|
196
|
+
}>;
|
|
164
197
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
198
|
+
* When true, the list initializes scrolled to the last item.
|
|
199
|
+
* Overrides `initialScrollIndex` and `initialScrollOffset` when data is available.
|
|
200
|
+
* @default false
|
|
167
201
|
*/
|
|
168
|
-
|
|
202
|
+
initialScrollAtEnd?: boolean;
|
|
169
203
|
/**
|
|
170
204
|
* Index to scroll to initially.
|
|
171
205
|
* @default 0
|
|
@@ -173,19 +207,17 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
173
207
|
initialScrollIndex?: number | {
|
|
174
208
|
index: number;
|
|
175
209
|
viewOffset?: number | undefined;
|
|
210
|
+
viewPosition?: number | undefined;
|
|
176
211
|
};
|
|
177
212
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* @default false
|
|
213
|
+
* Initial scroll position in pixels.
|
|
214
|
+
* @default 0
|
|
181
215
|
*/
|
|
182
|
-
|
|
216
|
+
initialScrollOffset?: number;
|
|
183
217
|
/**
|
|
184
|
-
*
|
|
218
|
+
* Custom equality function to detect semantically unchanged items.
|
|
185
219
|
*/
|
|
186
|
-
|
|
187
|
-
leadingItem: ItemT;
|
|
188
|
-
}>;
|
|
220
|
+
itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
189
221
|
/**
|
|
190
222
|
* Function to extract a unique key for each item.
|
|
191
223
|
*/
|
|
@@ -210,8 +242,16 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
210
242
|
* Style for the header component.
|
|
211
243
|
*/
|
|
212
244
|
ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Estimated height of the ListHeaderComponent. Provide this when the expected header height
|
|
247
|
+
* is known before layout so that only the items actually visible below the header are rendered
|
|
248
|
+
* on the initial frame, rather than a full screen's worth of items that are hidden behind it.
|
|
249
|
+
* The measured header size still replaces this value after layout.
|
|
250
|
+
*/
|
|
251
|
+
estimatedHeaderSize?: number;
|
|
213
252
|
/**
|
|
214
253
|
* If true, auto-scrolls to end when new items are added.
|
|
254
|
+
* Use an options object to opt into specific triggers and control whether that scroll is animated.
|
|
215
255
|
* @default false
|
|
216
256
|
*/
|
|
217
257
|
maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions;
|
|
@@ -221,16 +261,34 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
221
261
|
*/
|
|
222
262
|
maintainScrollAtEndThreshold?: number;
|
|
223
263
|
/**
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
264
|
+
* Maintains visibility of content.
|
|
265
|
+
* - scroll (default: true) stabilizes during size/layout changes while scrolling.
|
|
266
|
+
* - data (default: false) stabilizes when the data array changes; passing true also sets the RN maintainVisibleContentPosition prop.
|
|
267
|
+
* - shouldRestorePosition can opt out specific items from data-change anchoring.
|
|
268
|
+
* - undefined (default) enables scroll stabilization but skips data-change anchoring.
|
|
269
|
+
* - true enables both behaviors; false disables both.
|
|
270
|
+
*/
|
|
271
|
+
maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig<ItemT>;
|
|
272
|
+
/**
|
|
273
|
+
* Keeps an item visually anchored to the start by adding trailing space when the content below it underflows.
|
|
227
274
|
*/
|
|
228
|
-
|
|
275
|
+
anchoredEndSpace?: AnchoredEndSpaceConfig$1;
|
|
276
|
+
/**
|
|
277
|
+
* Adjusts the effective end content inset for web lists without replacing the base contentInset.
|
|
278
|
+
* The adjustment is also rendered as real content padding so the browser scroll range includes it.
|
|
279
|
+
*/
|
|
280
|
+
contentInsetEndAdjustment?: number;
|
|
229
281
|
/**
|
|
230
282
|
* Number of columns to render items in.
|
|
231
283
|
* @default 1
|
|
232
284
|
*/
|
|
233
285
|
numColumns?: number;
|
|
286
|
+
/**
|
|
287
|
+
* Force RTL mode for this list instance.
|
|
288
|
+
* When undefined, uses React Native's global I18nManager.isRTL.
|
|
289
|
+
* @default undefined
|
|
290
|
+
*/
|
|
291
|
+
rtl?: boolean;
|
|
234
292
|
/**
|
|
235
293
|
* Called when scrolling reaches the end within onEndReachedThreshold.
|
|
236
294
|
*/
|
|
@@ -252,10 +310,23 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
252
310
|
itemKey: string;
|
|
253
311
|
itemData: ItemT;
|
|
254
312
|
}) => void;
|
|
313
|
+
/**
|
|
314
|
+
* Called after the initial render work completes.
|
|
315
|
+
*/
|
|
316
|
+
onLoad?: (info: {
|
|
317
|
+
elapsedTimeInMs: number;
|
|
318
|
+
}) => void;
|
|
319
|
+
/**
|
|
320
|
+
* Called when list layout metrics change.
|
|
321
|
+
*/
|
|
322
|
+
onMetricsChange?: (metrics: LegendListMetrics) => void;
|
|
255
323
|
/**
|
|
256
324
|
* Function to call when the user pulls to refresh.
|
|
257
325
|
*/
|
|
258
326
|
onRefresh?: () => void;
|
|
327
|
+
/**
|
|
328
|
+
* Called when the list scrolls.
|
|
329
|
+
*/
|
|
259
330
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
260
331
|
/**
|
|
261
332
|
* Called when scrolling reaches the start within onStartReachedThreshold.
|
|
@@ -279,6 +350,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
279
350
|
* Called when the viewability of items changes.
|
|
280
351
|
*/
|
|
281
352
|
onViewableItemsChanged?: OnViewableItemsChanged<ItemT> | undefined;
|
|
353
|
+
/**
|
|
354
|
+
* Customize layout for multi-column lists, such as allowing items to span multiple columns.
|
|
355
|
+
*/
|
|
356
|
+
overrideItemLayout?: (layout: {
|
|
357
|
+
span?: number;
|
|
358
|
+
}, item: ItemT, index: number, maxColumns: number, extraData?: any) => void;
|
|
282
359
|
/**
|
|
283
360
|
* Offset in pixels for the refresh indicator.
|
|
284
361
|
* @default 0
|
|
@@ -292,7 +369,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
292
369
|
/**
|
|
293
370
|
* Ref to the underlying ScrollView component.
|
|
294
371
|
*/
|
|
295
|
-
refScrollView?: React.Ref<
|
|
372
|
+
refScrollView?: React.Ref<any>;
|
|
296
373
|
/**
|
|
297
374
|
* If true, shows a refresh indicator.
|
|
298
375
|
* @default false
|
|
@@ -303,13 +380,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
303
380
|
* Note: When using `stickyHeaderIndices`, you must provide an Animated ScrollView component.
|
|
304
381
|
* @default (props) => <ScrollView {...props} />
|
|
305
382
|
*/
|
|
306
|
-
renderScrollComponent?: (props:
|
|
383
|
+
renderScrollComponent?: (props: any) => React.ReactElement | null;
|
|
307
384
|
/**
|
|
308
|
-
*
|
|
309
|
-
* @required
|
|
310
|
-
* @default false
|
|
385
|
+
* Array of item indices to use as snap points.
|
|
311
386
|
*/
|
|
312
|
-
|
|
387
|
+
snapToIndices?: number[];
|
|
313
388
|
/**
|
|
314
389
|
* Configuration for determining item viewability.
|
|
315
390
|
*/
|
|
@@ -318,15 +393,6 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
318
393
|
* Pairs of viewability configs and their callbacks for tracking visibility.
|
|
319
394
|
*/
|
|
320
395
|
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs<ItemT> | undefined;
|
|
321
|
-
/**
|
|
322
|
-
* If true, delays rendering until initial layout is complete.
|
|
323
|
-
* @default false
|
|
324
|
-
*/
|
|
325
|
-
waitForInitialLayout?: boolean;
|
|
326
|
-
onLoad?: (info: {
|
|
327
|
-
elapsedTimeInMs: number;
|
|
328
|
-
}) => void;
|
|
329
|
-
snapToIndices?: number[];
|
|
330
396
|
/**
|
|
331
397
|
* Array of child indices determining which children get docked to the top of the screen when scrolling.
|
|
332
398
|
* For example, passing stickyHeaderIndices={[0]} will cause the first child to be fixed to the top of the scroll view.
|
|
@@ -335,174 +401,77 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
335
401
|
*/
|
|
336
402
|
stickyHeaderIndices?: number[];
|
|
337
403
|
/**
|
|
338
|
-
*
|
|
404
|
+
* Configuration for sticky headers.
|
|
405
|
+
* @default undefined
|
|
339
406
|
*/
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
407
|
+
stickyHeaderConfig?: StickyHeaderConfig;
|
|
408
|
+
/**
|
|
409
|
+
* Web only: when true, listens to window/body scrolling instead of rendering a scrollable list container.
|
|
410
|
+
* @default false
|
|
411
|
+
*/
|
|
412
|
+
useWindowScroll?: boolean;
|
|
413
|
+
}
|
|
414
|
+
type LegendListPropsBase<ItemT, TScrollViewProps = Record<string, any>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollViewProps> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
|
|
415
|
+
interface MaintainVisibleContentPositionConfig<ItemT = any> {
|
|
416
|
+
data?: boolean;
|
|
417
|
+
size?: boolean;
|
|
418
|
+
shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
419
|
+
}
|
|
420
|
+
interface AnchoredEndSpaceConfig$1 {
|
|
421
|
+
anchorIndex: number;
|
|
422
|
+
anchorOffset?: number;
|
|
423
|
+
anchorMaxSize?: number;
|
|
424
|
+
includeInEndInset?: boolean;
|
|
425
|
+
onSizeChanged?: (size: number) => void;
|
|
426
|
+
}
|
|
427
|
+
interface StickyHeaderConfig {
|
|
428
|
+
/**
|
|
429
|
+
* Specifies how far from the top edge sticky headers should start sticking.
|
|
430
|
+
* Useful for scenarios with a fixed navbar or header, where sticky elements pin below it..
|
|
431
|
+
* @default 0
|
|
432
|
+
*/
|
|
433
|
+
offset?: number;
|
|
434
|
+
/**
|
|
435
|
+
* Component to render as a backdrop behind the sticky header.
|
|
436
|
+
* @default undefined
|
|
437
|
+
*/
|
|
438
|
+
backdropComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
439
|
+
}
|
|
440
|
+
interface AlwaysRenderConfig {
|
|
441
|
+
top?: number;
|
|
442
|
+
bottom?: number;
|
|
443
|
+
indices?: number[];
|
|
444
|
+
keys?: string[];
|
|
445
|
+
}
|
|
446
|
+
interface MaintainScrollAtEndOnOptions {
|
|
447
|
+
dataChange?: boolean;
|
|
448
|
+
itemLayout?: boolean;
|
|
449
|
+
layout?: boolean;
|
|
344
450
|
}
|
|
345
|
-
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView> | ComponentProps<typeof Reanimated.ScrollView>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollView> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
|
|
346
451
|
interface MaintainScrollAtEndOptions {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
452
|
+
/**
|
|
453
|
+
* Whether maintainScrollAtEnd should animate when it scrolls to the end.
|
|
454
|
+
*/
|
|
455
|
+
animated?: boolean;
|
|
456
|
+
/**
|
|
457
|
+
* Which events should keep the list pinned to the end.
|
|
458
|
+
* - If omitted, object values default to all triggers.
|
|
459
|
+
* - If provided, only the keys set to `true` are enabled.
|
|
460
|
+
*/
|
|
461
|
+
on?: MaintainScrollAtEndOnOptions;
|
|
350
462
|
}
|
|
351
463
|
interface ColumnWrapperStyle {
|
|
352
464
|
rowGap?: number;
|
|
353
465
|
gap?: number;
|
|
354
466
|
columnGap?: number;
|
|
355
467
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
contentSize?: number;
|
|
360
|
-
dataLength?: number;
|
|
361
|
-
atThreshold: boolean;
|
|
362
|
-
}
|
|
363
|
-
interface ScrollTarget {
|
|
364
|
-
animated?: boolean;
|
|
365
|
-
index?: number;
|
|
366
|
-
isInitialScroll?: boolean;
|
|
367
|
-
itemSize?: number;
|
|
368
|
-
offset: number;
|
|
369
|
-
precomputedWithViewOffset?: boolean;
|
|
370
|
-
viewOffset?: number;
|
|
371
|
-
viewPosition?: number;
|
|
372
|
-
}
|
|
373
|
-
interface InternalState {
|
|
374
|
-
activeStickyIndex: number | undefined;
|
|
375
|
-
adjustingFromInitialMount?: number;
|
|
376
|
-
animFrameCheckFinishedScroll?: any;
|
|
377
|
-
averageSizes: Record<string, {
|
|
378
|
-
num: number;
|
|
379
|
-
avg: number;
|
|
380
|
-
}>;
|
|
381
|
-
columns: Map<string, number>;
|
|
382
|
-
containerItemKeys: Set<string>;
|
|
383
|
-
containerItemTypes: Map<number, string>;
|
|
384
|
-
dataChangeNeedsScrollUpdate: boolean;
|
|
385
|
-
didColumnsChange?: boolean;
|
|
386
|
-
didDataChange?: boolean;
|
|
387
|
-
didFinishInitialScroll?: boolean;
|
|
388
|
-
didContainersLayout?: boolean;
|
|
389
|
-
enableScrollForNextCalculateItemsInView: boolean;
|
|
390
|
-
endBuffered: number;
|
|
391
|
-
endNoBuffer: number;
|
|
392
|
-
endReachedSnapshot: ThresholdSnapshot | undefined;
|
|
393
|
-
firstFullyOnScreenIndex: number;
|
|
394
|
-
hasScrolled?: boolean;
|
|
395
|
-
idCache: string[];
|
|
396
|
-
idsInView: string[];
|
|
397
|
-
ignoreScrollFromMVCP?: {
|
|
398
|
-
lt?: number;
|
|
399
|
-
gt?: number;
|
|
400
|
-
};
|
|
401
|
-
ignoreScrollFromMVCPIgnored?: boolean;
|
|
402
|
-
ignoreScrollFromMVCPTimeout?: any;
|
|
403
|
-
indexByKey: Map<string, number>;
|
|
404
|
-
initialAnchor?: InitialScrollAnchor;
|
|
405
|
-
initialScroll: ScrollIndexWithOffsetAndContentOffset | undefined;
|
|
406
|
-
isAtEnd: boolean;
|
|
407
|
-
isAtStart: boolean;
|
|
408
|
-
isEndReached: boolean | null;
|
|
409
|
-
isFirst?: boolean;
|
|
410
|
-
isStartReached: boolean | null;
|
|
411
|
-
lastBatchingAction: number;
|
|
412
|
-
lastLayout: LayoutRectangle | undefined;
|
|
413
|
-
lastScrollAdjustForHistory?: number;
|
|
414
|
-
loadStartTime: number;
|
|
415
|
-
maintainingScrollAtEnd?: boolean;
|
|
416
|
-
minIndexSizeChanged: number | undefined;
|
|
417
|
-
nativeMarginTop: number;
|
|
418
|
-
needsOtherAxisSize?: boolean;
|
|
419
|
-
otherAxisSize?: number;
|
|
420
|
-
pendingTotalSize?: number;
|
|
421
|
-
positions: Map<string, number>;
|
|
422
|
-
previousData?: readonly unknown[];
|
|
423
|
-
queuedCalculateItemsInView: number | undefined;
|
|
424
|
-
queuedInitialLayout?: boolean | undefined;
|
|
425
|
-
refScroller: React.RefObject<ScrollView>;
|
|
426
|
-
scroll: number;
|
|
427
|
-
scrollAdjustHandler: ScrollAdjustHandler;
|
|
428
|
-
scrollForNextCalculateItemsInView: {
|
|
429
|
-
top: number | null;
|
|
430
|
-
bottom: number | null;
|
|
431
|
-
} | undefined;
|
|
432
|
-
scrollHistory: Array<{
|
|
433
|
-
scroll: number;
|
|
434
|
-
time: number;
|
|
435
|
-
}>;
|
|
436
|
-
scrollingTo?: ScrollTarget | undefined;
|
|
437
|
-
scrollLastCalculate?: number;
|
|
438
|
-
scrollLength: number;
|
|
439
|
-
scrollPending: number;
|
|
440
|
-
scrollPrev: number;
|
|
441
|
-
scrollPrevTime: number;
|
|
442
|
-
scrollProcessingEnabled: boolean;
|
|
443
|
-
scrollTime: number;
|
|
444
|
-
sizes: Map<string, number>;
|
|
445
|
-
sizesKnown: Map<string, number>;
|
|
446
|
-
startBuffered: number;
|
|
447
|
-
startBufferedId?: string;
|
|
448
|
-
startNoBuffer: number;
|
|
449
|
-
startReachedSnapshot: ThresholdSnapshot | undefined;
|
|
450
|
-
stickyContainerPool: Set<number>;
|
|
451
|
-
stickyContainers: Map<number, number>;
|
|
452
|
-
timeouts: Set<number>;
|
|
453
|
-
timeoutSetPaddingTop?: any;
|
|
454
|
-
timeoutSizeMessage: any;
|
|
455
|
-
timeoutCheckFinishedScrollFallback?: any;
|
|
456
|
-
totalSize: number;
|
|
457
|
-
triggerCalculateItemsInView?: (params?: {
|
|
458
|
-
doMVCP?: boolean;
|
|
459
|
-
dataChanged?: boolean;
|
|
460
|
-
forceFullItemPositions?: boolean;
|
|
461
|
-
}) => void;
|
|
462
|
-
viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs<any> | undefined;
|
|
463
|
-
props: {
|
|
464
|
-
alignItemsAtEnd: boolean;
|
|
465
|
-
animatedProps: StylesAsSharedValue<ScrollViewProps>;
|
|
466
|
-
contentInset: Insets | undefined;
|
|
467
|
-
data: readonly any[];
|
|
468
|
-
dataVersion: Key | undefined;
|
|
469
|
-
estimatedItemSize: number | undefined;
|
|
470
|
-
getEstimatedItemSize: LegendListProps["getEstimatedItemSize"];
|
|
471
|
-
getFixedItemSize: LegendListProps["getFixedItemSize"];
|
|
472
|
-
getItemType: LegendListProps["getItemType"];
|
|
473
|
-
horizontal: boolean;
|
|
474
|
-
initialContainerPoolRatio: number;
|
|
475
|
-
itemsAreEqual: LegendListProps["itemsAreEqual"];
|
|
476
|
-
keyExtractor: LegendListProps["keyExtractor"];
|
|
477
|
-
maintainScrollAtEnd: boolean | MaintainScrollAtEndOptions;
|
|
478
|
-
maintainScrollAtEndThreshold: number | undefined;
|
|
479
|
-
maintainVisibleContentPosition: boolean;
|
|
480
|
-
numColumns: number;
|
|
481
|
-
onEndReached: LegendListProps["onEndReached"];
|
|
482
|
-
onEndReachedThreshold: number | null | undefined;
|
|
483
|
-
onItemSizeChanged: LegendListProps["onItemSizeChanged"];
|
|
484
|
-
onLoad: LegendListProps["onLoad"];
|
|
485
|
-
onScroll: LegendListProps["onScroll"];
|
|
486
|
-
onStartReached: LegendListProps["onStartReached"];
|
|
487
|
-
onStartReachedThreshold: number | null | undefined;
|
|
488
|
-
onStickyHeaderChange: LegendListProps["onStickyHeaderChange"];
|
|
489
|
-
recycleItems: boolean;
|
|
490
|
-
renderItem: LegendListProps["renderItem"];
|
|
491
|
-
scrollBuffer: number;
|
|
492
|
-
snapToIndices: number[] | undefined;
|
|
493
|
-
stickyIndicesArr: number[];
|
|
494
|
-
stickyIndicesSet: Set<number>;
|
|
495
|
-
stylePaddingBottom: number | undefined;
|
|
496
|
-
stylePaddingTop: number | undefined;
|
|
497
|
-
suggestEstimatedItemSize: boolean;
|
|
498
|
-
};
|
|
468
|
+
interface LegendListMetrics {
|
|
469
|
+
headerSize: number;
|
|
470
|
+
footerSize: number;
|
|
499
471
|
}
|
|
500
|
-
interface
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
items: T[];
|
|
504
|
-
start: number;
|
|
505
|
-
startBuffered: number;
|
|
472
|
+
interface LegendListAverageItemSize {
|
|
473
|
+
average: number;
|
|
474
|
+
count: number;
|
|
506
475
|
}
|
|
507
476
|
interface LegendListRenderItemProps<ItemT, TItemType extends string | number | undefined = string | number | undefined> {
|
|
508
477
|
data: readonly ItemT[];
|
|
@@ -511,27 +480,34 @@ interface LegendListRenderItemProps<ItemT, TItemType extends string | number | u
|
|
|
511
480
|
item: ItemT;
|
|
512
481
|
type: TItemType;
|
|
513
482
|
}
|
|
514
|
-
type LegendListState = {
|
|
483
|
+
type LegendListState$1 = {
|
|
515
484
|
activeStickyIndex: number;
|
|
516
485
|
contentLength: number;
|
|
517
486
|
data: readonly any[];
|
|
518
|
-
elementAtIndex: (index: number) =>
|
|
487
|
+
elementAtIndex: (index: number) => any;
|
|
519
488
|
end: number;
|
|
520
489
|
endBuffered: number;
|
|
521
490
|
isAtEnd: boolean;
|
|
522
491
|
isAtStart: boolean;
|
|
492
|
+
isNearEnd: boolean;
|
|
493
|
+
isNearStart: boolean;
|
|
494
|
+
isEndReached: boolean;
|
|
495
|
+
isStartReached: boolean;
|
|
496
|
+
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
497
|
+
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
523
498
|
listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
|
|
524
499
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
525
500
|
positionAtIndex: (index: number) => number;
|
|
526
|
-
|
|
501
|
+
positionByKey: (key: string) => number | undefined;
|
|
527
502
|
scroll: number;
|
|
528
503
|
scrollLength: number;
|
|
504
|
+
scrollVelocity: number;
|
|
529
505
|
sizeAtIndex: (index: number) => number;
|
|
530
506
|
sizes: Map<string, number>;
|
|
531
507
|
start: number;
|
|
532
508
|
startBuffered: number;
|
|
533
509
|
};
|
|
534
|
-
type LegendListRef = {
|
|
510
|
+
type LegendListRef$1 = {
|
|
535
511
|
/**
|
|
536
512
|
* Displays the scroll indicators momentarily.
|
|
537
513
|
*/
|
|
@@ -539,7 +515,7 @@ type LegendListRef = {
|
|
|
539
515
|
/**
|
|
540
516
|
* Returns the native ScrollView component reference.
|
|
541
517
|
*/
|
|
542
|
-
getNativeScrollRef():
|
|
518
|
+
getNativeScrollRef(): any;
|
|
543
519
|
/**
|
|
544
520
|
* Returns the scroll responder instance for handling scroll events.
|
|
545
521
|
*/
|
|
@@ -547,11 +523,11 @@ type LegendListRef = {
|
|
|
547
523
|
/**
|
|
548
524
|
* Returns the ScrollResponderMixin for advanced scroll handling.
|
|
549
525
|
*/
|
|
550
|
-
getScrollResponder():
|
|
526
|
+
getScrollResponder(): any;
|
|
551
527
|
/**
|
|
552
528
|
* Returns the internal state of the scroll virtualization.
|
|
553
529
|
*/
|
|
554
|
-
getState(): LegendListState;
|
|
530
|
+
getState(): LegendListState$1;
|
|
555
531
|
/**
|
|
556
532
|
* Scrolls a specific index into view.
|
|
557
533
|
* @param params - Parameters for scrolling.
|
|
@@ -561,7 +537,7 @@ type LegendListRef = {
|
|
|
561
537
|
scrollIndexIntoView(params: {
|
|
562
538
|
animated?: boolean | undefined;
|
|
563
539
|
index: number;
|
|
564
|
-
}): void
|
|
540
|
+
}): Promise<void>;
|
|
565
541
|
/**
|
|
566
542
|
* Scrolls a specific index into view.
|
|
567
543
|
* @param params - Parameters for scrolling.
|
|
@@ -571,7 +547,7 @@ type LegendListRef = {
|
|
|
571
547
|
scrollItemIntoView(params: {
|
|
572
548
|
animated?: boolean | undefined;
|
|
573
549
|
item: any;
|
|
574
|
-
}): void
|
|
550
|
+
}): Promise<void>;
|
|
575
551
|
/**
|
|
576
552
|
* Scrolls to the end of the list.
|
|
577
553
|
* @param options - Options for scrolling.
|
|
@@ -581,7 +557,7 @@ type LegendListRef = {
|
|
|
581
557
|
scrollToEnd(options?: {
|
|
582
558
|
animated?: boolean | undefined;
|
|
583
559
|
viewOffset?: number | undefined;
|
|
584
|
-
}): void
|
|
560
|
+
}): Promise<void>;
|
|
585
561
|
/**
|
|
586
562
|
* Scrolls to a specific index in the list.
|
|
587
563
|
* @param params - Parameters for scrolling.
|
|
@@ -595,7 +571,7 @@ type LegendListRef = {
|
|
|
595
571
|
index: number;
|
|
596
572
|
viewOffset?: number | undefined;
|
|
597
573
|
viewPosition?: number | undefined;
|
|
598
|
-
}): void
|
|
574
|
+
}): Promise<void>;
|
|
599
575
|
/**
|
|
600
576
|
* Scrolls to a specific item in the list.
|
|
601
577
|
* @param params - Parameters for scrolling.
|
|
@@ -609,7 +585,7 @@ type LegendListRef = {
|
|
|
609
585
|
item: any;
|
|
610
586
|
viewOffset?: number | undefined;
|
|
611
587
|
viewPosition?: number | undefined;
|
|
612
|
-
}): void
|
|
588
|
+
}): Promise<void>;
|
|
613
589
|
/**
|
|
614
590
|
* Scrolls to a specific offset in pixels.
|
|
615
591
|
* @param params - Parameters for scrolling.
|
|
@@ -619,7 +595,7 @@ type LegendListRef = {
|
|
|
619
595
|
scrollToOffset(params: {
|
|
620
596
|
offset: number;
|
|
621
597
|
animated?: boolean | undefined;
|
|
622
|
-
}): void
|
|
598
|
+
}): Promise<void>;
|
|
623
599
|
/**
|
|
624
600
|
* Sets or adds to the offset of the visible content anchor.
|
|
625
601
|
* @param value - The offset to set or add.
|
|
@@ -631,6 +607,19 @@ type LegendListRef = {
|
|
|
631
607
|
* @param enabled - If true, scroll processing is enabled.
|
|
632
608
|
*/
|
|
633
609
|
setScrollProcessingEnabled(enabled: boolean): void;
|
|
610
|
+
/**
|
|
611
|
+
* Clears internal virtualization caches.
|
|
612
|
+
* @param options - Cache clearing options.
|
|
613
|
+
* @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
|
|
614
|
+
*/
|
|
615
|
+
clearCaches(options?: {
|
|
616
|
+
mode?: "sizes" | "full";
|
|
617
|
+
}): void;
|
|
618
|
+
/**
|
|
619
|
+
* Reports an externally measured content inset. Pass null/undefined to clear.
|
|
620
|
+
* Values are merged on top of props/animated/native insets.
|
|
621
|
+
*/
|
|
622
|
+
reportContentInset(inset?: Partial<Insets> | null): void;
|
|
634
623
|
};
|
|
635
624
|
interface ViewToken<ItemT = any> {
|
|
636
625
|
containerId: number;
|
|
@@ -651,10 +640,15 @@ interface ViewabilityConfigCallbackPair<ItemT = any> {
|
|
|
651
640
|
viewabilityConfig: ViewabilityConfig;
|
|
652
641
|
}
|
|
653
642
|
type ViewabilityConfigCallbackPairs<ItemT> = ViewabilityConfigCallbackPair<ItemT>[];
|
|
654
|
-
|
|
655
|
-
viewableItems: Array<ViewToken<ItemT>>;
|
|
643
|
+
interface OnViewableItemsChangedInfo<ItemT> {
|
|
656
644
|
changed: Array<ViewToken<ItemT>>;
|
|
657
|
-
|
|
645
|
+
end: number;
|
|
646
|
+
endBuffered: number;
|
|
647
|
+
start: number;
|
|
648
|
+
startBuffered: number;
|
|
649
|
+
viewableItems: Array<ViewToken<ItemT>>;
|
|
650
|
+
}
|
|
651
|
+
type OnViewableItemsChanged<ItemT> = ((info: OnViewableItemsChangedInfo<ItemT>) => void) | null;
|
|
658
652
|
interface ViewabilityConfig {
|
|
659
653
|
/**
|
|
660
654
|
* A unique ID to identify this viewability config
|
|
@@ -692,12 +686,6 @@ interface LegendListRecyclingState<T> {
|
|
|
692
686
|
prevIndex: number | undefined;
|
|
693
687
|
prevItem: T | undefined;
|
|
694
688
|
}
|
|
695
|
-
type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
|
|
696
|
-
declare const typedForwardRef: TypedForwardRef;
|
|
697
|
-
type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<React.JSXElementConstructor<T>>, nextProps: Readonly<React.JSXElementConstructor<T>>) => boolean) => T & {
|
|
698
|
-
displayName?: string;
|
|
699
|
-
};
|
|
700
|
-
declare const typedMemo: TypedMemo;
|
|
701
689
|
interface ScrollIndexWithOffset {
|
|
702
690
|
index: number;
|
|
703
691
|
viewOffset?: number;
|
|
@@ -709,16 +697,75 @@ interface ScrollIndexWithOffsetPosition extends ScrollIndexWithOffset {
|
|
|
709
697
|
interface ScrollIndexWithOffsetAndContentOffset extends ScrollIndexWithOffsetPosition {
|
|
710
698
|
contentOffset?: number;
|
|
711
699
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
700
|
+
|
|
701
|
+
type LooseLayoutChangeEvent = {
|
|
702
|
+
nativeEvent: {
|
|
703
|
+
layout: LayoutRectangle;
|
|
704
|
+
};
|
|
705
|
+
};
|
|
706
|
+
interface LooseScrollViewProps {
|
|
707
|
+
contentContainerClassName?: string;
|
|
708
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
709
|
+
contentInset?: Insets;
|
|
710
|
+
contentOffset?: {
|
|
711
|
+
x: number;
|
|
712
|
+
y: number;
|
|
713
|
+
};
|
|
714
|
+
horizontal?: boolean;
|
|
715
|
+
maintainVisibleContentPosition?: {
|
|
716
|
+
autoscrollToTopThreshold?: number;
|
|
717
|
+
minIndexForVisible: number;
|
|
718
|
+
};
|
|
719
|
+
onLayout?: (event: LooseLayoutChangeEvent) => void;
|
|
720
|
+
onMomentumScrollBegin?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
721
|
+
onMomentumScrollEnd?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
722
|
+
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
723
|
+
refreshControl?: ReactElement | null;
|
|
724
|
+
removeClippedSubviews?: boolean;
|
|
725
|
+
scrollEventThrottle?: number;
|
|
726
|
+
showsHorizontalScrollIndicator?: boolean;
|
|
727
|
+
showsVerticalScrollIndicator?: boolean;
|
|
728
|
+
stickyHeaderIndices?: number[];
|
|
729
|
+
style?: StyleProp<ViewStyle>;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
interface AnchoredEndSpaceConfig extends Omit<AnchoredEndSpaceConfig$1, "includeInEndInset"> {
|
|
716
733
|
}
|
|
717
|
-
type
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
734
|
+
type ScrollViewPropsWeb = Omit<LooseScrollViewProps, "style" | "contentContainerStyle" | "onScroll" | "onLayout" | "onMomentumScrollBegin" | "onMomentumScrollEnd" | "pagingEnabled" | "snapToInterval"> & Omit<HTMLAttributes<HTMLDivElement>, "onScroll" | "onLayout" | "style"> & {
|
|
735
|
+
style?: CSSProperties;
|
|
736
|
+
contentContainerClassName?: string;
|
|
737
|
+
contentContainerStyle?: CSSProperties;
|
|
738
|
+
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
739
|
+
onLayout?: (event: LooseLayoutChangeEvent) => void;
|
|
740
|
+
};
|
|
741
|
+
type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewPropsWeb, TItemType>, "anchoredEndSpace" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle" | "onRefresh" | "progressViewOffset" | "refreshing"> & {
|
|
742
|
+
anchoredEndSpace?: AnchoredEndSpaceConfig;
|
|
743
|
+
refScrollView?: Ref<HTMLElement | ScrollViewMethods>;
|
|
744
|
+
ListHeaderComponentStyle?: CSSProperties | undefined;
|
|
745
|
+
ListFooterComponentStyle?: CSSProperties | undefined;
|
|
721
746
|
};
|
|
722
|
-
type
|
|
747
|
+
type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
|
|
748
|
+
type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollableNode" | "getScrollResponder"> & {
|
|
749
|
+
getNativeScrollRef(): HTMLElement | ScrollViewMethods;
|
|
750
|
+
getScrollableNode(): HTMLElement;
|
|
751
|
+
getScrollResponder(): HTMLElement | null;
|
|
752
|
+
};
|
|
753
|
+
type LegendListState = Omit<LegendListState$1, "elementAtIndex"> & {
|
|
754
|
+
elementAtIndex: (index: number) => HTMLElement | null | undefined;
|
|
755
|
+
};
|
|
756
|
+
type LegendListComponent = <ItemT = any>(props: LegendListProps<ItemT> & RefAttributes<LegendListRef>) => ReactElement | null;
|
|
757
|
+
|
|
758
|
+
declare function useViewability<ItemT = any>(callback: ViewabilityCallback<ItemT>, configId?: string): void;
|
|
759
|
+
declare function useViewabilityAmount<ItemT = any>(callback: ViewabilityAmountCallback<ItemT>): void;
|
|
760
|
+
declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
|
|
761
|
+
declare function useRecyclingState<ItemT>(valueOrFun: ((info: LegendListRecyclingState<ItemT>) => ItemT) | ItemT): readonly [ItemT, Dispatch<SetStateAction<ItemT>>];
|
|
762
|
+
declare function useIsLastItem(): boolean;
|
|
763
|
+
declare function useListScrollSize(): {
|
|
764
|
+
width: number;
|
|
765
|
+
height: number;
|
|
766
|
+
};
|
|
767
|
+
declare function useSyncLayout(): () => void;
|
|
768
|
+
|
|
769
|
+
declare const LegendList: LegendListComponent;
|
|
723
770
|
|
|
724
|
-
export { type
|
|
771
|
+
export { type AlwaysRenderConfig, type AnchoredEndSpaceConfig, type ColumnWrapperStyle, type Insets, type LayoutRectangle, LegendList, type LegendListAverageItemSize, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListState, type MaintainScrollAtEndOnOptions, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type OnViewableItemsChangedInfo, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type StickyHeaderConfig, type StyleProp, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
|