@react-native-tvos/virtualized-lists 0.81.4-0 → 0.81.5-0
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/package.json +1 -1
- package/types_generated/Lists/CellRenderMask.d.ts +0 -27
- package/types_generated/Lists/FillRateHelper.d.ts +0 -60
- package/types_generated/Lists/ListMetricsAggregator.d.ts +0 -119
- package/types_generated/Lists/StateSafePureComponent.d.ts +0 -27
- package/types_generated/Lists/ViewabilityHelper.d.ts +0 -100
- package/types_generated/Lists/VirtualizeUtils.d.ts +0 -53
- package/types_generated/Lists/VirtualizedList.d.ts +0 -116
- package/types_generated/Lists/VirtualizedListContext.d.ts +0 -59
- package/types_generated/Lists/VirtualizedListProps.d.ts +0 -275
- package/types_generated/Lists/VirtualizedSectionList.d.ts +0 -113
- package/types_generated/index.d.ts +0 -36
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<f61be1758ae0ac5c3b456e1351e93910>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/CellRenderMask.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export type CellRegion = {
|
|
14
|
-
first: number;
|
|
15
|
-
last: number;
|
|
16
|
-
isSpacer: boolean;
|
|
17
|
-
};
|
|
18
|
-
export declare class CellRenderMask {
|
|
19
|
-
constructor(numCells: number);
|
|
20
|
-
enumerateRegions(): ReadonlyArray<CellRegion>;
|
|
21
|
-
addCells(cells: {
|
|
22
|
-
first: number;
|
|
23
|
-
last: number;
|
|
24
|
-
}): void;
|
|
25
|
-
numCells(): number;
|
|
26
|
-
equals(other: CellRenderMask): boolean;
|
|
27
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<e813b2d289d62a261179b333cb431e6f>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/FillRateHelper.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { CellMetricProps } from "./ListMetricsAggregator";
|
|
14
|
-
import ListMetricsAggregator from "./ListMetricsAggregator";
|
|
15
|
-
export type FillRateInfo = Info;
|
|
16
|
-
declare class Info {
|
|
17
|
-
any_blank_count: number;
|
|
18
|
-
any_blank_ms: number;
|
|
19
|
-
any_blank_speed_sum: number;
|
|
20
|
-
mostly_blank_count: number;
|
|
21
|
-
mostly_blank_ms: number;
|
|
22
|
-
pixels_blank: number;
|
|
23
|
-
pixels_sampled: number;
|
|
24
|
-
pixels_scrolled: number;
|
|
25
|
-
total_time_spent: number;
|
|
26
|
-
sample_count: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* A helper class for detecting when the maximem fill rate of `VirtualizedList` is exceeded.
|
|
30
|
-
* By default the sampling rate is set to zero and this will do nothing. If you want to collect
|
|
31
|
-
* samples (e.g. to log them), make sure to call `FillRateHelper.setSampleRate(0.0-1.0)`.
|
|
32
|
-
*
|
|
33
|
-
* Listeners and sample rate are global for all `VirtualizedList`s - typical usage will combine with
|
|
34
|
-
* `SceneTracker.getActiveScene` to determine the context of the events.
|
|
35
|
-
*/
|
|
36
|
-
declare class FillRateHelper {
|
|
37
|
-
static addListener(callback: ($$PARAM_0$$: FillRateInfo) => void): {
|
|
38
|
-
remove: () => void;
|
|
39
|
-
};
|
|
40
|
-
static setSampleRate(sampleRate: number): void;
|
|
41
|
-
static setMinSampleCount(minSampleCount: number): void;
|
|
42
|
-
constructor(listMetrics: ListMetricsAggregator);
|
|
43
|
-
activate(): void;
|
|
44
|
-
deactivateAndFlush(): void;
|
|
45
|
-
computeBlankness(props: Omit<CellMetricProps, keyof {
|
|
46
|
-
initialNumToRender?: number | undefined;
|
|
47
|
-
}> & {
|
|
48
|
-
initialNumToRender?: number | undefined;
|
|
49
|
-
}, cellsAroundViewport: {
|
|
50
|
-
first: number;
|
|
51
|
-
last: number;
|
|
52
|
-
}, scrollMetrics: {
|
|
53
|
-
dOffset: number;
|
|
54
|
-
offset: number;
|
|
55
|
-
velocity: number;
|
|
56
|
-
visibleLength: number;
|
|
57
|
-
}): number;
|
|
58
|
-
enabled(): boolean;
|
|
59
|
-
}
|
|
60
|
-
export default FillRateHelper;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<993b116aaf2c8d4835bce3f9a4c6392f>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/ListMetricsAggregator.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { VirtualizedListProps } from "./VirtualizedListProps";
|
|
14
|
-
import type { LayoutRectangle } from "react-native";
|
|
15
|
-
export type CellMetrics = {
|
|
16
|
-
/**
|
|
17
|
-
* Index of the item in the list
|
|
18
|
-
*/
|
|
19
|
-
index: number;
|
|
20
|
-
/**
|
|
21
|
-
* Length of the cell along the scrolling axis
|
|
22
|
-
*/
|
|
23
|
-
length: number;
|
|
24
|
-
/**
|
|
25
|
-
* Distance between this cell and the start of the list along the scrolling
|
|
26
|
-
* axis
|
|
27
|
-
*/
|
|
28
|
-
offset: number;
|
|
29
|
-
/**
|
|
30
|
-
* Whether the cell is last known to be mounted
|
|
31
|
-
*/
|
|
32
|
-
isMounted: boolean;
|
|
33
|
-
};
|
|
34
|
-
export type ListOrientation = {
|
|
35
|
-
horizontal: boolean;
|
|
36
|
-
rtl: boolean;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Subset of VirtualizedList props needed to calculate cell metrics
|
|
40
|
-
*/
|
|
41
|
-
export type CellMetricProps = {
|
|
42
|
-
data: VirtualizedListProps["data"];
|
|
43
|
-
getItemCount: VirtualizedListProps["getItemCount"];
|
|
44
|
-
getItem: VirtualizedListProps["getItem"];
|
|
45
|
-
getItemLayout?: VirtualizedListProps["getItemLayout"];
|
|
46
|
-
keyExtractor?: VirtualizedListProps["keyExtractor"];
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Provides an interface to query information about the metrics of a list and its cells.
|
|
50
|
-
*/
|
|
51
|
-
declare class ListMetricsAggregator {
|
|
52
|
-
/**
|
|
53
|
-
* Notify the ListMetricsAggregator that a cell has been laid out.
|
|
54
|
-
*
|
|
55
|
-
* @returns whether the cell layout has changed since last notification
|
|
56
|
-
*/
|
|
57
|
-
notifyCellLayout($$PARAM_0$$: {
|
|
58
|
-
cellIndex: number;
|
|
59
|
-
cellKey: string;
|
|
60
|
-
orientation: ListOrientation;
|
|
61
|
-
layout: LayoutRectangle;
|
|
62
|
-
}): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Notify ListMetricsAggregator that a cell has been unmounted.
|
|
65
|
-
*/
|
|
66
|
-
notifyCellUnmounted(cellKey: string): void;
|
|
67
|
-
/**
|
|
68
|
-
* Notify ListMetricsAggregator that the lists content container has been laid out.
|
|
69
|
-
*/
|
|
70
|
-
notifyListContentLayout($$PARAM_0$$: {
|
|
71
|
-
orientation: ListOrientation;
|
|
72
|
-
layout: Readonly<{
|
|
73
|
-
width: number;
|
|
74
|
-
height: number;
|
|
75
|
-
}>;
|
|
76
|
-
}): void;
|
|
77
|
-
/**
|
|
78
|
-
* Return the average length of the cells which have been measured
|
|
79
|
-
*/
|
|
80
|
-
getAverageCellLength(): number;
|
|
81
|
-
/**
|
|
82
|
-
* Return the highest measured cell index (or 0 if nothing has been measured
|
|
83
|
-
* yet)
|
|
84
|
-
*/
|
|
85
|
-
getHighestMeasuredCellIndex(): number;
|
|
86
|
-
/**
|
|
87
|
-
* Returns the exact metrics of a cell if it has already been laid out,
|
|
88
|
-
* otherwise an estimate based on the average length of previously measured
|
|
89
|
-
* cells
|
|
90
|
-
*/
|
|
91
|
-
getCellMetricsApprox(index: number, props: CellMetricProps): CellMetrics;
|
|
92
|
-
/**
|
|
93
|
-
* Returns the exact metrics of a cell if it has already been laid out
|
|
94
|
-
*/
|
|
95
|
-
getCellMetrics(index: number, props: CellMetricProps): null | undefined | CellMetrics;
|
|
96
|
-
/**
|
|
97
|
-
* Gets an approximate offset to an item at a given index. Supports
|
|
98
|
-
* fractional indices.
|
|
99
|
-
*/
|
|
100
|
-
getCellOffsetApprox(index: number, props: CellMetricProps): number;
|
|
101
|
-
/**
|
|
102
|
-
* Returns the length of all ScrollView content along the scrolling axis.
|
|
103
|
-
*/
|
|
104
|
-
getContentLength(): number;
|
|
105
|
-
/**
|
|
106
|
-
* Whether a content length has been observed
|
|
107
|
-
*/
|
|
108
|
-
hasContentLength(): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Finds the flow-relative offset (e.g. starting from the left in LTR, but
|
|
111
|
-
* right in RTL) from a layout box.
|
|
112
|
-
*/
|
|
113
|
-
flowRelativeOffset(layout: LayoutRectangle, referenceContentLength?: null | undefined | number): number;
|
|
114
|
-
/**
|
|
115
|
-
* Converts a flow-relative offset to a cartesian offset
|
|
116
|
-
*/
|
|
117
|
-
cartesianOffset(flowRelativeOffset: number): number;
|
|
118
|
-
}
|
|
119
|
-
export default ListMetricsAggregator;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<fb3d702a36fcffc782ea82ce81cf27bd>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/StateSafePureComponent.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
/**
|
|
15
|
-
* `setState` is called asynchronously, and should not rely on the value of
|
|
16
|
-
* `this.props` or `this.state`:
|
|
17
|
-
* https://react.dev/docs/state-and-lifecycle.html#state-updates-may-be-asynchronous
|
|
18
|
-
*
|
|
19
|
-
* SafePureComponent adds runtime enforcement, to catch cases where these
|
|
20
|
-
* variables are read in a state updater function, instead of the ones passed
|
|
21
|
-
* in.
|
|
22
|
-
*/
|
|
23
|
-
declare class StateSafePureComponent<Props, State extends {}> extends React.PureComponent<Props, State> {
|
|
24
|
-
constructor(props: Props);
|
|
25
|
-
setState<K extends keyof State>(partialState: null | undefined | (Pick<State, K> | (($$PARAM_0$$: State, $$PARAM_1$$: Props) => null | undefined | Pick<State, K>)), callback?: () => unknown): void;
|
|
26
|
-
}
|
|
27
|
-
export default StateSafePureComponent;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<c71c6155a6c1167093da67c32c306d07>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/ViewabilityHelper.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { CellMetricProps } from "./ListMetricsAggregator";
|
|
14
|
-
import ListMetricsAggregator from "./ListMetricsAggregator";
|
|
15
|
-
export type ViewToken = {
|
|
16
|
-
item: any;
|
|
17
|
-
key: string;
|
|
18
|
-
index: number | undefined;
|
|
19
|
-
isViewable: boolean;
|
|
20
|
-
section?: any;
|
|
21
|
-
};
|
|
22
|
-
export type ViewabilityConfigCallbackPair = {
|
|
23
|
-
viewabilityConfig: ViewabilityConfig;
|
|
24
|
-
onViewableItemsChanged: (info: {
|
|
25
|
-
viewableItems: Array<ViewToken>;
|
|
26
|
-
changed: Array<ViewToken>;
|
|
27
|
-
}) => void;
|
|
28
|
-
};
|
|
29
|
-
export type ViewabilityConfigCallbackPairs = Array<ViewabilityConfigCallbackPair>;
|
|
30
|
-
export type ViewabilityConfig = Readonly<{
|
|
31
|
-
/**
|
|
32
|
-
* Minimum amount of time (in milliseconds) that an item must be physically viewable before the
|
|
33
|
-
* viewability callback will be fired. A high number means that scrolling through content without
|
|
34
|
-
* stopping will not mark the content as viewable.
|
|
35
|
-
*/
|
|
36
|
-
minimumViewTime?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Percent of viewport that must be covered for a partially occluded item to count as
|
|
39
|
-
* "viewable", 0-100. Fully visible items are always considered viewable. A value of 0 means
|
|
40
|
-
* that a single pixel in the viewport makes the item viewable, and a value of 100 means that
|
|
41
|
-
* an item must be either entirely visible or cover the entire viewport to count as viewable.
|
|
42
|
-
*/
|
|
43
|
-
viewAreaCoveragePercentThreshold?: number;
|
|
44
|
-
/**
|
|
45
|
-
* Similar to `viewAreaPercentThreshold`, but considers the percent of the item that is visible,
|
|
46
|
-
* rather than the fraction of the viewable area it covers.
|
|
47
|
-
*/
|
|
48
|
-
itemVisiblePercentThreshold?: number;
|
|
49
|
-
/**
|
|
50
|
-
* Nothing is considered viewable until the user scrolls or `recordInteraction` is called after
|
|
51
|
-
* render.
|
|
52
|
-
*/
|
|
53
|
-
waitForInteraction?: boolean;
|
|
54
|
-
}>;
|
|
55
|
-
/**
|
|
56
|
-
* A Utility class for calculating viewable items based on current metrics like scroll position and
|
|
57
|
-
* layout.
|
|
58
|
-
*
|
|
59
|
-
* An item is said to be in a "viewable" state when any of the following
|
|
60
|
-
* is true for longer than `minimumViewTime` milliseconds (after an interaction if `waitForInteraction`
|
|
61
|
-
* is true):
|
|
62
|
-
*
|
|
63
|
-
* - Occupying >= `viewAreaCoveragePercentThreshold` of the view area XOR fraction of the item
|
|
64
|
-
* visible in the view area >= `itemVisiblePercentThreshold`.
|
|
65
|
-
* - Entirely visible on screen
|
|
66
|
-
*/
|
|
67
|
-
declare class ViewabilityHelper {
|
|
68
|
-
constructor(config?: ViewabilityConfig);
|
|
69
|
-
/**
|
|
70
|
-
* Cleanup, e.g. on unmount. Clears any pending timers.
|
|
71
|
-
*/
|
|
72
|
-
dispose(): void;
|
|
73
|
-
/**
|
|
74
|
-
* Determines which items are viewable based on the current metrics and config.
|
|
75
|
-
*/
|
|
76
|
-
computeViewableItems(props: CellMetricProps, scrollOffset: number, viewportHeight: number, listMetrics: ListMetricsAggregator, renderRange?: {
|
|
77
|
-
first: number;
|
|
78
|
-
last: number;
|
|
79
|
-
}): Array<number>;
|
|
80
|
-
/**
|
|
81
|
-
* Figures out which items are viewable and how that has changed from before and calls
|
|
82
|
-
* `onViewableItemsChanged` as appropriate.
|
|
83
|
-
*/
|
|
84
|
-
onUpdate(props: CellMetricProps, scrollOffset: number, viewportHeight: number, listMetrics: ListMetricsAggregator, createViewToken: (index: number, isViewable: boolean, props: CellMetricProps) => ViewToken, onViewableItemsChanged: ($$PARAM_0$$: {
|
|
85
|
-
viewableItems: Array<ViewToken>;
|
|
86
|
-
changed: Array<ViewToken>;
|
|
87
|
-
}) => void, renderRange?: {
|
|
88
|
-
first: number;
|
|
89
|
-
last: number;
|
|
90
|
-
}): void;
|
|
91
|
-
/**
|
|
92
|
-
* clean-up cached _viewableIndices to evaluate changed items on next update
|
|
93
|
-
*/
|
|
94
|
-
resetViewableIndices(): void;
|
|
95
|
-
/**
|
|
96
|
-
* Records that an interaction has happened even if there has been no scroll.
|
|
97
|
-
*/
|
|
98
|
-
recordInteraction(): void;
|
|
99
|
-
}
|
|
100
|
-
export default ViewabilityHelper;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<c677afc34af685572670d7d4065a70dc>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/VirtualizeUtils.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type ListMetricsAggregator from "./ListMetricsAggregator";
|
|
14
|
-
import type { CellMetricProps } from "./ListMetricsAggregator";
|
|
15
|
-
/**
|
|
16
|
-
* Used to find the indices of the frames that overlap the given offsets. Useful for finding the
|
|
17
|
-
* items that bound different windows of content, such as the visible area or the buffered overscan
|
|
18
|
-
* area.
|
|
19
|
-
*/
|
|
20
|
-
export declare function elementsThatOverlapOffsets(offsets: Array<number>, props: CellMetricProps, listMetrics: ListMetricsAggregator, zoomScale?: number): Array<number>;
|
|
21
|
-
/**
|
|
22
|
-
* Computes the number of elements in the `next` range that are new compared to the `prev` range.
|
|
23
|
-
* Handy for calculating how many new items will be rendered when the render window changes so we
|
|
24
|
-
* can restrict the number of new items render at once so that content can appear on the screen
|
|
25
|
-
* faster.
|
|
26
|
-
*/
|
|
27
|
-
export declare function newRangeCount(prev: {
|
|
28
|
-
first: number;
|
|
29
|
-
last: number;
|
|
30
|
-
}, next: {
|
|
31
|
-
first: number;
|
|
32
|
-
last: number;
|
|
33
|
-
}): number;
|
|
34
|
-
/**
|
|
35
|
-
* Custom logic for determining which items should be rendered given the current frame and scroll
|
|
36
|
-
* metrics, as well as the previous render state. The algorithm may evolve over time, but generally
|
|
37
|
-
* prioritizes the visible area first, then expands that with overscan regions ahead and behind,
|
|
38
|
-
* biased in the direction of scroll.
|
|
39
|
-
*/
|
|
40
|
-
export declare function computeWindowedRenderLimits(props: CellMetricProps, maxToRenderPerBatch: number, windowSize: number, prev: {
|
|
41
|
-
first: number;
|
|
42
|
-
last: number;
|
|
43
|
-
}, listMetrics: ListMetricsAggregator, scrollMetrics: {
|
|
44
|
-
dt: number;
|
|
45
|
-
offset: number;
|
|
46
|
-
velocity: number;
|
|
47
|
-
visibleLength: number;
|
|
48
|
-
zoomScale: number;
|
|
49
|
-
}): {
|
|
50
|
-
first: number;
|
|
51
|
-
last: number;
|
|
52
|
-
};
|
|
53
|
-
export declare function keyExtractor(item: any, index: number): string;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<8997e25a6b501ab434c0037b6347705b>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/VirtualizedList.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { Item, ListRenderItem, ListRenderItemInfo, Separators, VirtualizedListProps } from "./VirtualizedListProps";
|
|
14
|
-
import type { ScrollEvent, ScrollResponderType } from "react-native";
|
|
15
|
-
import { CellRenderMask } from "./CellRenderMask";
|
|
16
|
-
import StateSafePureComponent from "./StateSafePureComponent";
|
|
17
|
-
import { VirtualizedListContext } from "./VirtualizedListContext.js";
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
import { ScrollView } from "react-native";
|
|
20
|
-
export type { ListRenderItemInfo, ListRenderItem, Separators };
|
|
21
|
-
type State = {
|
|
22
|
-
renderMask: CellRenderMask;
|
|
23
|
-
cellsAroundViewport: {
|
|
24
|
-
first: number;
|
|
25
|
-
last: number;
|
|
26
|
-
};
|
|
27
|
-
firstVisibleItemKey: string | undefined;
|
|
28
|
-
pendingScrollUpdateCount: number;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Base implementation for the more convenient [`<FlatList>`](https://reactnative.dev/docs/flatlist)
|
|
32
|
-
* and [`<SectionList>`](https://reactnative.dev/docs/sectionlist) components, which are also better
|
|
33
|
-
* documented. In general, this should only really be used if you need more flexibility than
|
|
34
|
-
* `FlatList` provides, e.g. for use with immutable data instead of plain arrays.
|
|
35
|
-
*
|
|
36
|
-
* Virtualization massively improves memory consumption and performance of large lists by
|
|
37
|
-
* maintaining a finite render window of active items and replacing all items outside of the render
|
|
38
|
-
* window with appropriately sized blank space. The window adapts to scrolling behavior, and items
|
|
39
|
-
* are rendered incrementally with low-pri (after any running interactions) if they are far from the
|
|
40
|
-
* visible area, or with hi-pri otherwise to minimize the potential of seeing blank space.
|
|
41
|
-
*
|
|
42
|
-
* Some caveats:
|
|
43
|
-
*
|
|
44
|
-
* - Internal state is not preserved when content scrolls out of the render window. Make sure all
|
|
45
|
-
* your data is captured in the item data or external stores like Flux, Redux, or Relay.
|
|
46
|
-
* - This is a `PureComponent` which means that it will not re-render if `props` remain shallow-
|
|
47
|
-
* equal. Make sure that everything your `renderItem` function depends on is passed as a prop
|
|
48
|
-
* (e.g. `extraData`) that is not `===` after updates, otherwise your UI may not update on
|
|
49
|
-
* changes. This includes the `data` prop and parent component state.
|
|
50
|
-
* - In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
|
51
|
-
* offscreen. This means it's possible to scroll faster than the fill rate ands momentarily see
|
|
52
|
-
* blank content. This is a tradeoff that can be adjusted to suit the needs of each application,
|
|
53
|
-
* and we are working on improving it behind the scenes.
|
|
54
|
-
* - By default, the list looks for a `key` or `id` prop on each item and uses that for the React key.
|
|
55
|
-
* Alternatively, you can provide a custom `keyExtractor` prop.
|
|
56
|
-
* - As an effort to remove defaultProps, use helper functions when referencing certain props
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
|
-
declare class VirtualizedList extends StateSafePureComponent<VirtualizedListProps, State> {
|
|
60
|
-
static contextType: typeof VirtualizedListContext;
|
|
61
|
-
scrollToEnd(params?: null | undefined | {
|
|
62
|
-
animated?: boolean | undefined;
|
|
63
|
-
}): void;
|
|
64
|
-
scrollToIndex(params: {
|
|
65
|
-
animated?: boolean | undefined;
|
|
66
|
-
index: number;
|
|
67
|
-
viewOffset?: number;
|
|
68
|
-
viewPosition?: number;
|
|
69
|
-
}): any;
|
|
70
|
-
scrollToItem(params: {
|
|
71
|
-
animated?: boolean | undefined;
|
|
72
|
-
item: Item;
|
|
73
|
-
viewOffset?: number;
|
|
74
|
-
viewPosition?: number;
|
|
75
|
-
}): void;
|
|
76
|
-
/**
|
|
77
|
-
* Scroll to a specific content pixel offset in the list.
|
|
78
|
-
*
|
|
79
|
-
* Param `offset` expects the offset to scroll to.
|
|
80
|
-
* In case of `horizontal` is true, the offset is the x-value,
|
|
81
|
-
* in any other case the offset is the y-value.
|
|
82
|
-
*
|
|
83
|
-
* Param `animated` (`true` by default) defines whether the list
|
|
84
|
-
* should do an animation while scrolling.
|
|
85
|
-
*/
|
|
86
|
-
scrollToOffset(params: {
|
|
87
|
-
animated?: boolean | undefined;
|
|
88
|
-
offset: number;
|
|
89
|
-
}): void;
|
|
90
|
-
recordInteraction(): void;
|
|
91
|
-
flashScrollIndicators(): void;
|
|
92
|
-
/**
|
|
93
|
-
* Provides a handle to the underlying scroll responder.
|
|
94
|
-
* Note that `this._scrollRef` might not be a `ScrollView`, so we
|
|
95
|
-
* need to check that it responds to `getScrollResponder` before calling it.
|
|
96
|
-
*/
|
|
97
|
-
getScrollResponder(): null | undefined | ScrollResponderType;
|
|
98
|
-
getScrollableNode(): null | undefined | number;
|
|
99
|
-
getScrollRef(): null | undefined | React.ComponentRef<typeof ScrollView>;
|
|
100
|
-
setNativeProps(props: Object): void;
|
|
101
|
-
hasMore(): boolean;
|
|
102
|
-
state: State;
|
|
103
|
-
constructor(props: VirtualizedListProps);
|
|
104
|
-
componentDidMount(): void;
|
|
105
|
-
componentWillUnmount(): void;
|
|
106
|
-
static getDerivedStateFromProps(newProps: VirtualizedListProps, prevState: State): State;
|
|
107
|
-
render(): React.ReactNode;
|
|
108
|
-
componentDidUpdate(prevProps: VirtualizedListProps): void;
|
|
109
|
-
measureLayoutRelativeToContainingList(): void;
|
|
110
|
-
unstable_onScroll(e: Object): void;
|
|
111
|
-
unstable_onScrollBeginDrag(e: ScrollEvent): void;
|
|
112
|
-
unstable_onScrollEndDrag(e: ScrollEvent): void;
|
|
113
|
-
unstable_onMomentumScrollBegin(e: ScrollEvent): void;
|
|
114
|
-
unstable_onMomentumScrollEnd(e: ScrollEvent): void;
|
|
115
|
-
}
|
|
116
|
-
export default VirtualizedList;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<55bd8debf6bc6068e4368f5b7905b017>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/VirtualizedListContext.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type $$IMPORT_TYPEOF_1$$ from "./VirtualizedList";
|
|
14
|
-
type VirtualizedListT = typeof $$IMPORT_TYPEOF_1$$;
|
|
15
|
-
import * as React from "react";
|
|
16
|
-
type Context = Readonly<{
|
|
17
|
-
cellKey: string | undefined;
|
|
18
|
-
getScrollMetrics: () => {
|
|
19
|
-
contentLength: number;
|
|
20
|
-
dOffset: number;
|
|
21
|
-
dt: number;
|
|
22
|
-
offset: number;
|
|
23
|
-
timestamp: number;
|
|
24
|
-
velocity: number;
|
|
25
|
-
visibleLength: number;
|
|
26
|
-
zoomScale: number;
|
|
27
|
-
};
|
|
28
|
-
horizontal: boolean | undefined;
|
|
29
|
-
getOutermostParentListRef: () => React.ComponentRef<VirtualizedListT>;
|
|
30
|
-
registerAsNestedChild: ($$PARAM_0$$: {
|
|
31
|
-
cellKey: string;
|
|
32
|
-
ref: React.ComponentRef<VirtualizedListT>;
|
|
33
|
-
}) => void;
|
|
34
|
-
unregisterAsNestedChild: ($$PARAM_0$$: {
|
|
35
|
-
ref: React.ComponentRef<VirtualizedListT>;
|
|
36
|
-
}) => void;
|
|
37
|
-
}>;
|
|
38
|
-
export declare const VirtualizedListContext: React.Context<null | undefined | Context>;
|
|
39
|
-
export declare type VirtualizedListContext = typeof VirtualizedListContext;
|
|
40
|
-
/**
|
|
41
|
-
* Resets the context. Intended for use by portal-like components (e.g. Modal).
|
|
42
|
-
*/
|
|
43
|
-
export declare function VirtualizedListContextResetter($$PARAM_0$$: {
|
|
44
|
-
children: React.ReactNode;
|
|
45
|
-
}): React.ReactNode;
|
|
46
|
-
/**
|
|
47
|
-
* Sets the context with memoization. Intended to be used by `VirtualizedList`.
|
|
48
|
-
*/
|
|
49
|
-
export declare function VirtualizedListContextProvider($$PARAM_0$$: {
|
|
50
|
-
children: React.ReactNode;
|
|
51
|
-
value: Context;
|
|
52
|
-
}): React.ReactNode;
|
|
53
|
-
/**
|
|
54
|
-
* Sets the `cellKey`. Intended to be used by `VirtualizedList` for each cell.
|
|
55
|
-
*/
|
|
56
|
-
export declare function VirtualizedListCellContextProvider($$PARAM_0$$: {
|
|
57
|
-
cellKey: string;
|
|
58
|
-
children: React.ReactNode;
|
|
59
|
-
}): React.ReactNode;
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<fcf224b18f3315e5b84e224781b4eeb1>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/VirtualizedListProps.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { ViewabilityConfig, ViewabilityConfigCallbackPair, ViewToken } from "./ViewabilityHelper";
|
|
14
|
-
import type { FocusEvent, LayoutChangeEvent, ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
15
|
-
import * as React from "react";
|
|
16
|
-
export type Item = any;
|
|
17
|
-
export type Separators = {
|
|
18
|
-
highlight: () => void;
|
|
19
|
-
unhighlight: () => void;
|
|
20
|
-
updateProps: (select: "leading" | "trailing", newProps: Object) => void;
|
|
21
|
-
};
|
|
22
|
-
export type ListRenderItemInfo<ItemT> = {
|
|
23
|
-
item: ItemT;
|
|
24
|
-
index: number;
|
|
25
|
-
separators: Separators;
|
|
26
|
-
};
|
|
27
|
-
export type CellRendererProps<ItemT> = Readonly<{
|
|
28
|
-
cellKey: string;
|
|
29
|
-
children: React.ReactNode;
|
|
30
|
-
index: number;
|
|
31
|
-
item: ItemT;
|
|
32
|
-
onFocusCapture?: (event: FocusEvent) => void;
|
|
33
|
-
onLayout?: (event: LayoutChangeEvent) => void;
|
|
34
|
-
style: StyleProp<ViewStyle>;
|
|
35
|
-
}>;
|
|
36
|
-
export type ListRenderItem<ItemT> = (info: ListRenderItemInfo<ItemT>) => React.ReactNode;
|
|
37
|
-
type RequiredVirtualizedListProps = {
|
|
38
|
-
/**
|
|
39
|
-
* The default accessor functions assume this is an Array<{key: string} | {id: string}> but you can override
|
|
40
|
-
* getItem, getItemCount, and keyExtractor to handle any type of index-based data.
|
|
41
|
-
*/
|
|
42
|
-
data?: any;
|
|
43
|
-
/**
|
|
44
|
-
* A generic accessor for extracting an item from any sort of data blob.
|
|
45
|
-
*/
|
|
46
|
-
getItem: (data: any, index: number) => Item | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Determines how many items are in the data blob.
|
|
49
|
-
*/
|
|
50
|
-
getItemCount: (data: any) => number;
|
|
51
|
-
};
|
|
52
|
-
type OptionalVirtualizedListProps = {
|
|
53
|
-
renderItem?: ListRenderItem<Item> | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* `debug` will turn on extra logging and visual overlays to aid with debugging both usage and
|
|
56
|
-
* implementation, but with a significant perf hit.
|
|
57
|
-
*/
|
|
58
|
-
debug?: boolean | undefined;
|
|
59
|
-
/**
|
|
60
|
-
* DEPRECATED: Virtualization provides significant performance and memory optimizations, but fully
|
|
61
|
-
* unmounts react instances that are outside of the render window. You should only need to disable
|
|
62
|
-
* this for debugging purposes. Defaults to false.
|
|
63
|
-
*/
|
|
64
|
-
disableVirtualization?: boolean | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* A marker property for telling the list to re-render (since it implements `PureComponent`). If
|
|
67
|
-
* any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the
|
|
68
|
-
* `data` prop, stick it here and treat it immutably.
|
|
69
|
-
*/
|
|
70
|
-
extraData?: any;
|
|
71
|
-
getItemLayout?: (data: any, index: number) => {
|
|
72
|
-
length: number;
|
|
73
|
-
offset: number;
|
|
74
|
-
index: number;
|
|
75
|
-
};
|
|
76
|
-
horizontal?: boolean | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* How many items to render in the initial batch. This should be enough to fill the screen but not
|
|
79
|
-
* much more. Note these items will never be unmounted as part of the windowed rendering in order
|
|
80
|
-
* to improve perceived performance of scroll-to-top actions.
|
|
81
|
-
*/
|
|
82
|
-
initialNumToRender?: number | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* Instead of starting at the top with the first item, start at `initialScrollIndex`. This
|
|
85
|
-
* disables the "scroll to top" optimization that keeps the first `initialNumToRender` items
|
|
86
|
-
* always rendered and immediately renders the items starting at this initial index. Requires
|
|
87
|
-
* `getItemLayout` to be implemented.
|
|
88
|
-
*/
|
|
89
|
-
initialScrollIndex?: number | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* Reverses the direction of scroll. Uses scale transforms of -1.
|
|
92
|
-
*/
|
|
93
|
-
inverted?: boolean | undefined;
|
|
94
|
-
keyExtractor?: ((item: Item, index: number) => string) | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* CellRendererComponent allows customizing how cells rendered by
|
|
97
|
-
* `renderItem`/`ListItemComponent` are wrapped when placed into the
|
|
98
|
-
* underlying ScrollView. This component must accept event handlers which
|
|
99
|
-
* notify VirtualizedList of changes within the cell.
|
|
100
|
-
*/
|
|
101
|
-
CellRendererComponent?: React.ComponentType<CellRendererProps<Item>> | undefined;
|
|
102
|
-
/**
|
|
103
|
-
* Rendered in between each item, but not at the top or bottom. By default, `highlighted` and
|
|
104
|
-
* `leadingItem` props are provided. `renderItem` provides `separators.highlight`/`unhighlight`
|
|
105
|
-
* which will update the `highlighted` prop, but you can also add custom props with
|
|
106
|
-
* `separators.updateProps`.
|
|
107
|
-
*/
|
|
108
|
-
ItemSeparatorComponent?: React.ComponentType<any> | undefined;
|
|
109
|
-
/**
|
|
110
|
-
* Takes an item from `data` and renders it into the list. Example usage:
|
|
111
|
-
*
|
|
112
|
-
* <FlatList
|
|
113
|
-
* ItemSeparatorComponent={Platform.OS !== 'android' && ({highlighted}) => (
|
|
114
|
-
* <View style={[style.separator, highlighted && {marginLeft: 0}]} />
|
|
115
|
-
* )}
|
|
116
|
-
* data={[{title: 'Title Text', key: 'item1'}]}
|
|
117
|
-
* ListItemComponent={({item, separators}) => (
|
|
118
|
-
* <TouchableHighlight
|
|
119
|
-
* onPress={() => this._onPress(item)}
|
|
120
|
-
* onShowUnderlay={separators.highlight}
|
|
121
|
-
* onHideUnderlay={separators.unhighlight}>
|
|
122
|
-
* <View style={{backgroundColor: 'white'}}>
|
|
123
|
-
* <Text>{item.title}</Text>
|
|
124
|
-
* </View>
|
|
125
|
-
* </TouchableHighlight>
|
|
126
|
-
* )}
|
|
127
|
-
* />
|
|
128
|
-
*
|
|
129
|
-
* Provides additional metadata like `index` if you need it, as well as a more generic
|
|
130
|
-
* `separators.updateProps` function which let's you set whatever props you want to change the
|
|
131
|
-
* rendering of either the leading separator or trailing separator in case the more common
|
|
132
|
-
* `highlight` and `unhighlight` (which set the `highlighted: boolean` prop) are insufficient for
|
|
133
|
-
* your use-case.
|
|
134
|
-
*/
|
|
135
|
-
ListItemComponent?: (React.ComponentType<any> | React.JSX.Element) | undefined;
|
|
136
|
-
/**
|
|
137
|
-
* Rendered when the list is empty. Can be a React Component Class, a render function, or
|
|
138
|
-
* a rendered element.
|
|
139
|
-
*/
|
|
140
|
-
ListEmptyComponent?: (React.ComponentType<any> | React.JSX.Element) | undefined;
|
|
141
|
-
/**
|
|
142
|
-
* Rendered at the bottom of all the items. Can be a React Component Class, a render function, or
|
|
143
|
-
* a rendered element.
|
|
144
|
-
*/
|
|
145
|
-
ListFooterComponent?: (React.ComponentType<any> | React.JSX.Element) | undefined;
|
|
146
|
-
/**
|
|
147
|
-
* Styling for internal View for ListFooterComponent
|
|
148
|
-
*/
|
|
149
|
-
ListFooterComponentStyle?: StyleProp<ViewStyle>;
|
|
150
|
-
/**
|
|
151
|
-
* Rendered at the top of all the items. Can be a React Component Class, a render function, or
|
|
152
|
-
* a rendered element.
|
|
153
|
-
*/
|
|
154
|
-
ListHeaderComponent?: (React.ComponentType<any> | React.JSX.Element) | undefined;
|
|
155
|
-
/**
|
|
156
|
-
* Styling for internal View for ListHeaderComponent
|
|
157
|
-
*/
|
|
158
|
-
ListHeaderComponentStyle?: StyleProp<ViewStyle>;
|
|
159
|
-
/**
|
|
160
|
-
* The maximum number of items to render in each incremental render batch. The more rendered at
|
|
161
|
-
* once, the better the fill rate, but responsiveness may suffer because rendering content may
|
|
162
|
-
* interfere with responding to button taps or other interactions.
|
|
163
|
-
*/
|
|
164
|
-
maxToRenderPerBatch?: number | undefined;
|
|
165
|
-
/**
|
|
166
|
-
* Called once when the scroll position gets within within `onEndReachedThreshold`
|
|
167
|
-
* from the logical end of the list.
|
|
168
|
-
*/
|
|
169
|
-
onEndReached?: ((info: {
|
|
170
|
-
distanceFromEnd: number;
|
|
171
|
-
}) => void) | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* How far from the end (in units of visible length of the list) the trailing edge of the
|
|
174
|
-
* list must be from the end of the content to trigger the `onEndReached` callback.
|
|
175
|
-
* Thus, a value of 0.5 will trigger `onEndReached` when the end of the content is
|
|
176
|
-
* within half the visible length of the list.
|
|
177
|
-
*/
|
|
178
|
-
onEndReachedThreshold?: number | undefined;
|
|
179
|
-
/**
|
|
180
|
-
* If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make
|
|
181
|
-
* sure to also set the `refreshing` prop correctly.
|
|
182
|
-
*/
|
|
183
|
-
onRefresh?: (() => void) | undefined;
|
|
184
|
-
/**
|
|
185
|
-
* Used to handle failures when scrolling to an index that has not been measured yet. Recommended
|
|
186
|
-
* action is to either compute your own offset and `scrollTo` it, or scroll as far as possible and
|
|
187
|
-
* then try again after more items have been rendered.
|
|
188
|
-
*/
|
|
189
|
-
onScrollToIndexFailed?: ((info: {
|
|
190
|
-
index: number;
|
|
191
|
-
highestMeasuredFrameIndex: number;
|
|
192
|
-
averageItemLength: number;
|
|
193
|
-
}) => void) | undefined;
|
|
194
|
-
/**
|
|
195
|
-
* Called once when the scroll position gets within within `onStartReachedThreshold`
|
|
196
|
-
* from the logical start of the list.
|
|
197
|
-
*/
|
|
198
|
-
onStartReached?: ((info: {
|
|
199
|
-
distanceFromStart: number;
|
|
200
|
-
}) => void) | undefined;
|
|
201
|
-
/**
|
|
202
|
-
* How far from the start (in units of visible length of the list) the leading edge of the
|
|
203
|
-
* list must be from the start of the content to trigger the `onStartReached` callback.
|
|
204
|
-
* Thus, a value of 0.5 will trigger `onStartReached` when the start of the content is
|
|
205
|
-
* within half the visible length of the list.
|
|
206
|
-
*/
|
|
207
|
-
onStartReachedThreshold?: number | undefined;
|
|
208
|
-
/**
|
|
209
|
-
* Called when the viewability of rows changes, as defined by the
|
|
210
|
-
* `viewabilityConfig` prop.
|
|
211
|
-
*/
|
|
212
|
-
onViewableItemsChanged?: ((info: {
|
|
213
|
-
viewableItems: Array<ViewToken>;
|
|
214
|
-
changed: Array<ViewToken>;
|
|
215
|
-
}) => void) | undefined;
|
|
216
|
-
persistentScrollbar?: boolean | undefined;
|
|
217
|
-
/**
|
|
218
|
-
* Set this when offset is needed for the loading indicator to show correctly.
|
|
219
|
-
*/
|
|
220
|
-
progressViewOffset?: number;
|
|
221
|
-
/**
|
|
222
|
-
* A custom refresh control element. When set, it overrides the default
|
|
223
|
-
* <RefreshControl> component built internally. The onRefresh and refreshing
|
|
224
|
-
* props are also ignored. Only works for vertical VirtualizedList.
|
|
225
|
-
*/
|
|
226
|
-
refreshControl?: React.JSX.Element | undefined;
|
|
227
|
-
/**
|
|
228
|
-
* Set this true while waiting for new data from a refresh.
|
|
229
|
-
*/
|
|
230
|
-
refreshing?: boolean | undefined;
|
|
231
|
-
/**
|
|
232
|
-
* Note: may have bugs (missing content) in some circumstances - use at your own risk.
|
|
233
|
-
*
|
|
234
|
-
* This may improve scroll performance for large lists.
|
|
235
|
-
*/
|
|
236
|
-
removeClippedSubviews?: boolean;
|
|
237
|
-
/**
|
|
238
|
-
* Render a custom scroll component, e.g. with a differently styled `RefreshControl`.
|
|
239
|
-
*/
|
|
240
|
-
renderScrollComponent?: (props: ScrollViewProps) => React.JSX.Element;
|
|
241
|
-
/**
|
|
242
|
-
* Amount of time between low-pri item render batches, e.g. for rendering items quite a ways off
|
|
243
|
-
* screen. Similar fill rate/responsiveness tradeoff as `maxToRenderPerBatch`.
|
|
244
|
-
*/
|
|
245
|
-
updateCellsBatchingPeriod?: number | undefined;
|
|
246
|
-
/**
|
|
247
|
-
* See `ViewabilityHelper` for flow type and further documentation.
|
|
248
|
-
*/
|
|
249
|
-
viewabilityConfig?: ViewabilityConfig;
|
|
250
|
-
/**
|
|
251
|
-
* List of ViewabilityConfig/onViewableItemsChanged pairs. A specific onViewableItemsChanged
|
|
252
|
-
* will be called when its corresponding ViewabilityConfig's conditions are met.
|
|
253
|
-
*/
|
|
254
|
-
viewabilityConfigCallbackPairs?: Array<ViewabilityConfigCallbackPair>;
|
|
255
|
-
/**
|
|
256
|
-
* Determines the maximum number of items rendered outside of the visible area, in units of
|
|
257
|
-
* visible lengths. So if your list fills the screen, then `windowSize={21}` (the default) will
|
|
258
|
-
* render the visible screen area plus up to 10 screens above and 10 below the viewport. Reducing
|
|
259
|
-
* this number will reduce memory consumption and may improve performance, but will increase the
|
|
260
|
-
* chance that fast scrolling may reveal momentary blank areas of unrendered content.
|
|
261
|
-
*/
|
|
262
|
-
windowSize?: number | undefined;
|
|
263
|
-
};
|
|
264
|
-
export type VirtualizedListProps = Omit<ScrollViewProps, keyof RequiredVirtualizedListProps | keyof OptionalVirtualizedListProps | keyof {}> & Omit<RequiredVirtualizedListProps, keyof OptionalVirtualizedListProps | keyof {}> & Omit<OptionalVirtualizedListProps, keyof {}> & {};
|
|
265
|
-
/**
|
|
266
|
-
* Default Props Helper Functions
|
|
267
|
-
* Use the following helper functions for default values
|
|
268
|
-
*/
|
|
269
|
-
|
|
270
|
-
export declare function horizontalOrDefault(horizontal: null | undefined | boolean): boolean;
|
|
271
|
-
export declare function initialNumToRenderOrDefault(initialNumToRender: null | undefined | number): number;
|
|
272
|
-
export declare function maxToRenderPerBatchOrDefault(maxToRenderPerBatch: null | undefined | number): number;
|
|
273
|
-
export declare function onStartReachedThresholdOrDefault(onStartReachedThreshold: null | undefined | number): number;
|
|
274
|
-
export declare function onEndReachedThresholdOrDefault(onEndReachedThreshold: null | undefined | number): number;
|
|
275
|
-
export declare function windowSizeOrDefault(windowSize: null | undefined | number): number;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<ecb7038cddedf7d6444387409ad985d5>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/Lists/VirtualizedSectionList.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type { VirtualizedListProps } from "./VirtualizedListProps";
|
|
14
|
-
import VirtualizedList from "./VirtualizedList";
|
|
15
|
-
import * as React from "react";
|
|
16
|
-
type DefaultVirtualizedSectionT = {
|
|
17
|
-
data: any;
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
};
|
|
20
|
-
export type SectionData<SectionItemT, SectionT = DefaultVirtualizedSectionT> = (Readonly<SectionBase<SectionItemT, SectionT>> & SectionT) | (SectionBase<SectionItemT, SectionT> & SectionT) | SectionT;
|
|
21
|
-
export type SectionBase<SectionItemT, SectionT = DefaultVirtualizedSectionT> = {
|
|
22
|
-
/**
|
|
23
|
-
* The data for rendering items in this section.
|
|
24
|
-
*/
|
|
25
|
-
data: ReadonlyArray<SectionItemT>;
|
|
26
|
-
/**
|
|
27
|
-
* Optional key to keep track of section re-ordering. If you don't plan on re-ordering sections,
|
|
28
|
-
* the array index will be used by default.
|
|
29
|
-
*/
|
|
30
|
-
key?: string;
|
|
31
|
-
renderItem?: ((info: {
|
|
32
|
-
item: SectionItemT;
|
|
33
|
-
index: number;
|
|
34
|
-
section: SectionData<SectionItemT, SectionT>;
|
|
35
|
-
separators: {
|
|
36
|
-
highlight: () => void;
|
|
37
|
-
unhighlight: () => void;
|
|
38
|
-
updateProps: (select: "leading" | "trailing", newProps: Object) => void;
|
|
39
|
-
};
|
|
40
|
-
}) => null | React.JSX.Element) | undefined;
|
|
41
|
-
ItemSeparatorComponent?: React.ComponentType<any> | undefined;
|
|
42
|
-
keyExtractor?: (item: SectionItemT | undefined, index?: number | undefined) => string;
|
|
43
|
-
};
|
|
44
|
-
type RequiredVirtualizedSectionListProps<ItemT, SectionT = DefaultVirtualizedSectionT> = {
|
|
45
|
-
sections: ReadonlyArray<SectionData<ItemT, SectionT>>;
|
|
46
|
-
};
|
|
47
|
-
type OptionalVirtualizedSectionListProps<ItemT, SectionT = DefaultVirtualizedSectionT> = {
|
|
48
|
-
/**
|
|
49
|
-
* Default renderer for every item in every section.
|
|
50
|
-
*/
|
|
51
|
-
renderItem?: (info: {
|
|
52
|
-
item: ItemT;
|
|
53
|
-
index: number;
|
|
54
|
-
section: SectionT;
|
|
55
|
-
separators: {
|
|
56
|
-
highlight: () => void;
|
|
57
|
-
unhighlight: () => void;
|
|
58
|
-
updateProps: (select: "leading" | "trailing", newProps: Object) => void;
|
|
59
|
-
};
|
|
60
|
-
}) => null | React.ReactNode;
|
|
61
|
-
/**
|
|
62
|
-
* Rendered at the top of each section. These stick to the top of the `ScrollView` by default on
|
|
63
|
-
* iOS. See `stickySectionHeadersEnabled`.
|
|
64
|
-
*/
|
|
65
|
-
renderSectionHeader?: ((info: {
|
|
66
|
-
section: SectionT;
|
|
67
|
-
}) => null | React.ReactNode) | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Rendered at the bottom of each section.
|
|
70
|
-
*/
|
|
71
|
-
renderSectionFooter?: ((info: {
|
|
72
|
-
section: SectionT;
|
|
73
|
-
}) => null | React.ReactNode) | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* Rendered at the top and bottom of each section (note this is different from
|
|
76
|
-
* `ItemSeparatorComponent` which is only rendered between items). These are intended to separate
|
|
77
|
-
* sections from the headers above and below and typically have the same highlight response as
|
|
78
|
-
* `ItemSeparatorComponent`. Also receives `highlighted`, `[leading/trailing][Item/Separator]`,
|
|
79
|
-
* and any custom props from `separators.updateProps`.
|
|
80
|
-
*/
|
|
81
|
-
SectionSeparatorComponent?: React.ComponentType<any> | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Makes section headers stick to the top of the screen until the next one pushes it off. Only
|
|
84
|
-
* enabled by default on iOS because that is the platform standard there.
|
|
85
|
-
*/
|
|
86
|
-
stickySectionHeadersEnabled?: boolean;
|
|
87
|
-
onEndReached?: (($$PARAM_0$$: {
|
|
88
|
-
distanceFromEnd: number;
|
|
89
|
-
}) => void) | undefined;
|
|
90
|
-
};
|
|
91
|
-
export type VirtualizedSectionListProps<ItemT, SectionT = DefaultVirtualizedSectionT> = Omit<RequiredVirtualizedSectionListProps<ItemT, SectionT>, keyof OptionalVirtualizedSectionListProps<ItemT, SectionT> | keyof Omit<VirtualizedListProps, "data" | "renderItem"> | keyof {}> & Omit<OptionalVirtualizedSectionListProps<ItemT, SectionT>, keyof Omit<VirtualizedListProps, "data" | "renderItem"> | keyof {}> & Omit<Omit<VirtualizedListProps, "data" | "renderItem">, keyof {}> & {};
|
|
92
|
-
export type ScrollToLocationParamsType = {
|
|
93
|
-
animated?: boolean | undefined;
|
|
94
|
-
itemIndex: number;
|
|
95
|
-
sectionIndex: number;
|
|
96
|
-
viewOffset?: number;
|
|
97
|
-
viewPosition?: number;
|
|
98
|
-
};
|
|
99
|
-
declare const VirtualizedSectionListComponent: <ItemT, SectionT extends SectionBase<ItemT, DefaultVirtualizedSectionT> = DefaultVirtualizedSectionT>(props: Omit<VirtualizedSectionListProps<ItemT, SectionT>, keyof {
|
|
100
|
-
ref: React.Ref<{
|
|
101
|
-
getListRef(): VirtualizedList | undefined;
|
|
102
|
-
scrollToLocation(params: ScrollToLocationParamsType): void;
|
|
103
|
-
}>;
|
|
104
|
-
}> & {
|
|
105
|
-
ref: React.Ref<{
|
|
106
|
-
getListRef(): VirtualizedList | undefined;
|
|
107
|
-
scrollToLocation(params: ScrollToLocationParamsType): void;
|
|
108
|
-
}>;
|
|
109
|
-
}) => React.ReactNode;
|
|
110
|
-
declare const $$VirtualizedSectionList: typeof VirtualizedSectionListComponent;
|
|
111
|
-
declare type $$VirtualizedSectionList = typeof $$VirtualizedSectionList;
|
|
112
|
-
export default $$VirtualizedSectionList;
|
|
113
|
-
export type AnyVirtualizedSectionList = typeof VirtualizedSectionListComponent;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @generated SignedSource<<7cfaaf81455a1bf0b07801c4ebd5200c>>
|
|
8
|
-
*
|
|
9
|
-
* This file was translated from Flow by scripts/build-types/index.js.
|
|
10
|
-
* Original file: packages/virtualized-lists/index.js
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import type $$IMPORT_TYPEOF_1$$ from "./Lists/FillRateHelper";
|
|
14
|
-
type FillRateHelperT = typeof $$IMPORT_TYPEOF_1$$;
|
|
15
|
-
import type $$IMPORT_TYPEOF_2$$ from "./Lists/ViewabilityHelper";
|
|
16
|
-
type ViewabilityHelperT = typeof $$IMPORT_TYPEOF_2$$;
|
|
17
|
-
import type $$IMPORT_TYPEOF_3$$ from "./Lists/VirtualizedList";
|
|
18
|
-
type VirtualizedListT = typeof $$IMPORT_TYPEOF_3$$;
|
|
19
|
-
import type { AnyVirtualizedSectionList as AnyVirtualizedSectionListT } from "./Lists/VirtualizedSectionList";
|
|
20
|
-
import { type VirtualizedListContextResetter as $$IMPORT_TYPEOF_4$$ } from "./Lists/VirtualizedListContext";
|
|
21
|
-
type VirtualizedListContextResetterT = typeof $$IMPORT_TYPEOF_4$$;
|
|
22
|
-
import { keyExtractor } from "./Lists/VirtualizeUtils";
|
|
23
|
-
export type { ViewToken, ViewabilityConfig, ViewabilityConfigCallbackPair, ViewabilityConfigCallbackPairs } from "./Lists/ViewabilityHelper";
|
|
24
|
-
export type { CellRendererProps, ListRenderItemInfo, ListRenderItem, Separators, VirtualizedListProps } from "./Lists/VirtualizedListProps";
|
|
25
|
-
export type { VirtualizedSectionListProps, ScrollToLocationParamsType, SectionBase, SectionData } from "./Lists/VirtualizedSectionList";
|
|
26
|
-
export type { FillRateInfo } from "./Lists/FillRateHelper";
|
|
27
|
-
declare const $$index: {
|
|
28
|
-
keyExtractor: typeof keyExtractor;
|
|
29
|
-
get VirtualizedList(): VirtualizedListT;
|
|
30
|
-
get VirtualizedSectionList(): AnyVirtualizedSectionListT;
|
|
31
|
-
get VirtualizedListContextResetter(): VirtualizedListContextResetterT;
|
|
32
|
-
get ViewabilityHelper(): ViewabilityHelperT;
|
|
33
|
-
get FillRateHelper(): FillRateHelperT;
|
|
34
|
-
};
|
|
35
|
-
declare type $$index = typeof $$index;
|
|
36
|
-
export default $$index;
|