@react-native-ohos/flash-list 1.8.3-rc.2 → 1.8.3-rc.4
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/LICENSE +6 -6
- package/README.OpenSource +10 -10
- package/README.md +9 -9
- package/dist/AnimatedFlashList.d.ts +28 -25
- package/dist/AnimatedFlashList.d.ts.map +1 -1
- package/dist/AnimatedFlashList.js +30 -30
- package/dist/FlashList.d.ts +179 -179
- package/dist/FlashList.d.ts.map +1 -1
- package/dist/FlashList.js +599 -598
- package/dist/FlashList.js.map +1 -1
- package/dist/FlashListProps.d.ts +278 -278
- package/dist/FlashListProps.js +31 -31
- package/dist/GridLayoutProviderWithProps.d.ts +64 -64
- package/dist/GridLayoutProviderWithProps.js +137 -136
- package/dist/GridLayoutProviderWithProps.js.map +1 -1
- package/dist/MasonryFlashList.d.ts +73 -73
- package/dist/MasonryFlashList.d.ts.map +1 -1
- package/dist/MasonryFlashList.js +274 -274
- package/dist/MasonryFlashList.js.map +1 -1
- package/dist/PureComponentWrapper.d.ts +44 -44
- package/dist/PureComponentWrapper.js +59 -59
- package/dist/PureComponentWrapper.js.map +1 -1
- package/dist/benchmark/AutoScrollHelper.d.ts +40 -40
- package/dist/benchmark/AutoScrollHelper.js +90 -90
- package/dist/benchmark/AutoScrollHelper.js.map +1 -1
- package/dist/benchmark/JSFPSMonitor.d.ts +45 -45
- package/dist/benchmark/JSFPSMonitor.js +87 -87
- package/dist/benchmark/JSFPSMonitor.js.map +1 -1
- package/dist/benchmark/roundToDecimalPlaces.d.ts +24 -24
- package/dist/benchmark/roundToDecimalPlaces.js +31 -30
- package/dist/benchmark/roundToDecimalPlaces.js.map +1 -1
- package/dist/benchmark/useBenchmark.d.ts +57 -57
- package/dist/benchmark/useBenchmark.js +189 -188
- package/dist/benchmark/useBenchmark.js.map +1 -1
- package/dist/benchmark/useBlankAreaTracker.d.ts +56 -56
- package/dist/benchmark/useBlankAreaTracker.js +89 -88
- package/dist/benchmark/useBlankAreaTracker.js.map +1 -1
- package/dist/benchmark/useDataMultiplier.d.ts +31 -31
- package/dist/benchmark/useDataMultiplier.js +47 -46
- package/dist/benchmark/useDataMultiplier.js.map +1 -1
- package/dist/benchmark/useFlatListBenchmark.d.ts +35 -34
- package/dist/benchmark/useFlatListBenchmark.d.ts.map +1 -1
- package/dist/benchmark/useFlatListBenchmark.js +122 -121
- package/dist/benchmark/useFlatListBenchmark.js.map +1 -1
- package/dist/errors/CustomError.d.ts +30 -30
- package/dist/errors/CustomError.js +36 -36
- package/dist/errors/CustomError.js.map +1 -1
- package/dist/errors/ExceptionList.d.ts +46 -46
- package/dist/errors/ExceptionList.js +48 -48
- package/dist/errors/Warnings.d.ts +31 -31
- package/dist/errors/Warnings.js +35 -35
- package/dist/fabric/AutoLayoutNativeComponent.d.ts +41 -41
- package/dist/fabric/AutoLayoutNativeComponent.d.ts.map +1 -1
- package/dist/fabric/AutoLayoutNativeComponent.js +28 -28
- package/dist/fabric/CellContainerNativeComponent.d.ts +30 -30
- package/dist/fabric/CellContainerNativeComponent.d.ts.map +1 -1
- package/dist/fabric/CellContainerNativeComponent.js +28 -28
- package/dist/index.d.ts +36 -36
- package/dist/index.js +54 -52
- package/dist/index.js.map +1 -1
- package/dist/native/auto-layout/AutoLayoutView.d.ts +44 -44
- package/dist/native/auto-layout/AutoLayoutView.d.ts.map +1 -1
- package/dist/native/auto-layout/AutoLayoutView.js +70 -70
- package/dist/native/auto-layout/AutoLayoutView.js.map +1 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts +26 -25
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts.map +1 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js +28 -28
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts +27 -27
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +1 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.d.ts +26 -25
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.d.ts.map +1 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.js +28 -28
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts +26 -25
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts.map +1 -1
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js +28 -28
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js +28 -28
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts +38 -38
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js +25 -25
- package/dist/native/cell-container/CellContainer.android.d.ts +28 -28
- package/dist/native/cell-container/CellContainer.android.d.ts.map +1 -1
- package/dist/native/cell-container/CellContainer.android.js +31 -31
- package/dist/native/cell-container/CellContainer.d.ts +30 -29
- package/dist/native/cell-container/CellContainer.d.ts.map +1 -1
- package/dist/native/cell-container/CellContainer.harmony.d.ts +28 -28
- package/dist/native/cell-container/CellContainer.harmony.d.ts.map +1 -1
- package/dist/native/cell-container/CellContainer.harmony.js +31 -31
- package/dist/native/cell-container/CellContainer.ios.d.ts +28 -28
- package/dist/native/cell-container/CellContainer.ios.d.ts.map +1 -1
- package/dist/native/cell-container/CellContainer.ios.js +31 -31
- package/dist/native/cell-container/CellContainer.js +33 -33
- package/dist/native/cell-container/CellContainer.web.d.ts +29 -28
- package/dist/native/cell-container/CellContainer.web.d.ts.map +1 -1
- package/dist/native/cell-container/CellContainer.web.js +35 -35
- package/dist/native/config/PlatformHelper.android.d.ts +48 -48
- package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.android.js +45 -45
- package/dist/native/config/PlatformHelper.d.ts +48 -48
- package/dist/native/config/PlatformHelper.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.harmony.d.ts +48 -48
- package/dist/native/config/PlatformHelper.harmony.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.harmony.js +44 -44
- package/dist/native/config/PlatformHelper.ios.d.ts +48 -48
- package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.ios.js +44 -44
- package/dist/native/config/PlatformHelper.js +45 -45
- package/dist/native/config/PlatformHelper.web.d.ts +49 -49
- package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.web.js +47 -47
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/AverageWindow.d.ts +43 -43
- package/dist/utils/AverageWindow.js +71 -71
- package/dist/utils/ContentContainerUtils.d.ts +49 -49
- package/dist/utils/ContentContainerUtils.d.ts.map +1 -1
- package/dist/utils/ContentContainerUtils.js +70 -70
- package/dist/utils/ContentContainerUtils.js.map +1 -1
- package/dist/viewability/ViewToken.d.ts +30 -30
- package/dist/viewability/ViewToken.js +25 -25
- package/dist/viewability/ViewabilityHelper.d.ts +48 -48
- package/dist/viewability/ViewabilityHelper.js +129 -129
- package/dist/viewability/ViewabilityHelper.js.map +1 -1
- package/dist/viewability/ViewabilityManager.d.ts +47 -47
- package/dist/viewability/ViewabilityManager.d.ts.map +1 -1
- package/dist/viewability/ViewabilityManager.js +130 -130
- package/dist/viewability/ViewabilityManager.js.map +1 -1
- package/harmony/flash_list/BuildProfile.ets +16 -16
- package/harmony/flash_list/LICENSE +7 -7
- package/harmony/flash_list/build-profile.json5 +7 -7
- package/harmony/flash_list/hvigorfile.ts +1 -1
- package/harmony/flash_list/index.ets +27 -27
- package/harmony/flash_list/obfuscation-rules.txt +17 -17
- package/harmony/flash_list/oh-package.json5 +23 -23
- package/harmony/flash_list/src/main/cpp/AutoLayoutNode.cpp +63 -140
- package/harmony/flash_list/src/main/cpp/AutoLayoutNode.h +53 -53
- package/harmony/flash_list/src/main/cpp/AutoLayoutShadow.cpp +31 -24
- package/harmony/flash_list/src/main/cpp/AutoLayoutShadow.h +66 -66
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewComponentInstance.cpp +208 -208
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewComponentInstance.h +78 -78
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewEventEmitRequestHandler.h +53 -53
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewJSIBinder.h +50 -50
- package/harmony/flash_list/src/main/cpp/CMakeLists.txt +6 -6
- package/harmony/flash_list/src/main/cpp/CellContainerComponentInstance.cpp +79 -79
- package/harmony/flash_list/src/main/cpp/CellContainerComponentInstance.h +63 -63
- package/harmony/flash_list/src/main/cpp/CellContainerJSIBinder.h +38 -38
- package/harmony/flash_list/src/main/cpp/ComponentDescriptors.h +40 -40
- package/harmony/flash_list/src/main/cpp/EventEmitters.cpp +39 -39
- package/harmony/flash_list/src/main/cpp/EventEmitters.h +48 -48
- package/harmony/flash_list/src/main/cpp/FlashListPackage.h +77 -77
- package/harmony/flash_list/src/main/cpp/FlashListStackNode.cpp +87 -87
- package/harmony/flash_list/src/main/cpp/FlashListStackNode.h +56 -56
- package/harmony/flash_list/src/main/cpp/Props.cpp +51 -51
- package/harmony/flash_list/src/main/cpp/Props.h +64 -64
- package/harmony/flash_list/src/main/cpp/ShadowNodes.cpp +33 -33
- package/harmony/flash_list/src/main/cpp/ShadowNodes.h +48 -48
- package/harmony/flash_list/src/main/ets/Logger.ets +63 -63
- package/harmony/flash_list/src/main/ets/RNAutoLayoutShadow.ets +153 -153
- package/harmony/flash_list/src/main/ets/RNAutoLayoutView.ets +276 -276
- package/harmony/flash_list/src/main/ets/RNCellContainer.ets +113 -113
- package/harmony/flash_list/src/main/module.json5 +9 -9
- package/harmony/flash_list/src/main/resources/base/element/color.json +7 -7
- package/harmony/flash_list/src/main/resources/base/element/string.json +15 -15
- package/harmony/flash_list/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/flash_list/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/flash_list/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/flash_list.har +0 -0
- package/jestSetup.js +40 -40
- package/package.json +82 -82
- package/src/AnimatedFlashList.ts +35 -35
- package/src/FlashList.tsx +949 -949
- package/src/FlashListProps.ts +359 -359
- package/src/GridLayoutProviderWithProps.ts +204 -204
- package/src/MasonryFlashList.tsx +499 -499
- package/src/PureComponentWrapper.tsx +65 -65
- package/src/benchmark/AutoScrollHelper.ts +94 -94
- package/src/benchmark/JSFPSMonitor.ts +98 -98
- package/src/benchmark/roundToDecimalPlaces.ts +28 -28
- package/src/benchmark/useBenchmark.ts +264 -264
- package/src/benchmark/useBlankAreaTracker.ts +141 -141
- package/src/benchmark/useDataMultiplier.ts +43 -43
- package/src/benchmark/useFlatListBenchmark.ts +131 -131
- package/src/errors/CustomError.ts +34 -34
- package/src/errors/ExceptionList.ts +52 -52
- package/src/errors/Warnings.ts +39 -39
- package/src/fabric/AutoLayoutNativeComponent.ts +52 -52
- package/src/fabric/CellContainerNativeComponent.ts +35 -35
- package/src/index.ts +67 -67
- package/src/native/auto-layout/AutoLayoutView.tsx +97 -97
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.android.ts +31 -31
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.harmony.ts +31 -31
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.ios.ts +31 -31
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.ts +31 -31
- package/src/native/auto-layout/AutoLayoutViewNativeComponentProps.ts +41 -41
- package/src/native/cell-container/CellContainer.android.ts +31 -31
- package/src/native/cell-container/CellContainer.harmony.ts +31 -31
- package/src/native/cell-container/CellContainer.ios.ts +31 -31
- package/src/native/cell-container/CellContainer.tsx +38 -38
- package/src/native/cell-container/CellContainer.web.tsx +33 -33
- package/src/native/config/PlatformHelper.android.ts +53 -53
- package/src/native/config/PlatformHelper.harmony.ts +52 -52
- package/src/native/config/PlatformHelper.ios.ts +52 -52
- package/src/native/config/PlatformHelper.ts +53 -53
- package/src/native/config/PlatformHelper.web.ts +58 -58
- package/src/utils/AverageWindow.ts +73 -73
- package/src/utils/ContentContainerUtils.ts +116 -116
- package/src/viewability/ViewToken.ts +31 -31
- package/src/viewability/ViewabilityHelper.ts +190 -190
- package/src/viewability/ViewabilityManager.ts +169 -169
package/dist/FlashList.js
CHANGED
|
@@ -1,599 +1,600 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* MIT License
|
|
4
|
-
*
|
|
5
|
-
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
var tslib_1 = require("tslib");
|
|
27
|
-
var react_1 = tslib_1.__importDefault(require("react"));
|
|
28
|
-
var react_native_1 = require("react-native");
|
|
29
|
-
var recyclerlistview_1 = require("recyclerlistview");
|
|
30
|
-
var sticky_1 = tslib_1.__importDefault(require("recyclerlistview/sticky"));
|
|
31
|
-
var AutoLayoutView_1 = tslib_1.__importDefault(require("./native/auto-layout/AutoLayoutView"));
|
|
32
|
-
var CellContainer_1 = tslib_1.__importDefault(require("./native/cell-container/CellContainer"));
|
|
33
|
-
var PureComponentWrapper_1 = require("./PureComponentWrapper");
|
|
34
|
-
var GridLayoutProviderWithProps_1 = tslib_1.__importDefault(require("./GridLayoutProviderWithProps"));
|
|
35
|
-
var CustomError_1 = tslib_1.__importDefault(require("./errors/CustomError"));
|
|
36
|
-
var ExceptionList_1 = tslib_1.__importDefault(require("./errors/ExceptionList"));
|
|
37
|
-
var Warnings_1 = tslib_1.__importDefault(require("./errors/Warnings"));
|
|
38
|
-
var ViewabilityManager_1 = tslib_1.__importDefault(require("./viewability/ViewabilityManager"));
|
|
39
|
-
var FlashListProps_1 = require("./FlashListProps");
|
|
40
|
-
var PlatformHelper_1 = require("./native/config/PlatformHelper");
|
|
41
|
-
var ContentContainerUtils_1 = require("./utils/ContentContainerUtils");
|
|
42
|
-
var StickyHeaderContainer = sticky_1.default;
|
|
43
|
-
var FlashList = /** @class */ (function (_super) {
|
|
44
|
-
tslib_1.__extends(FlashList, _super);
|
|
45
|
-
function FlashList(props) {
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
_this
|
|
49
|
-
_this.
|
|
50
|
-
_this.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
_this.
|
|
58
|
-
_this.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
_this.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
_this.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
_this.listFixedDimensionSize
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
react_1.default.createElement(
|
|
109
|
-
_this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
_this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
_this.
|
|
128
|
-
_this.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
//
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
react_1.default.createElement(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
!_this.
|
|
174
|
-
_this.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
_this.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
//
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
_this.postLoadTimeoutId
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
_this.renderedSizeWarningTimeoutId
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
*
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
_this.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
_this.
|
|
292
|
-
_this.
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
// `
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
var
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
newState.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
//
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
: nextProps.data
|
|
335
|
-
|
|
336
|
-
newState.
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
newState.
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
//
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
this.
|
|
398
|
-
this.
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
//
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
//
|
|
429
|
-
//
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
null)
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
var
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
var
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
var
|
|
499
|
-
(
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
var
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
var
|
|
512
|
-
var
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
*
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
*
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
*
|
|
558
|
-
* @
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
var
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
*
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
*
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
*
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
var tslib_1 = require("tslib");
|
|
27
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
28
|
+
var react_native_1 = require("react-native");
|
|
29
|
+
var recyclerlistview_1 = require("recyclerlistview");
|
|
30
|
+
var sticky_1 = tslib_1.__importDefault(require("recyclerlistview/sticky"));
|
|
31
|
+
var AutoLayoutView_1 = tslib_1.__importDefault(require("./native/auto-layout/AutoLayoutView"));
|
|
32
|
+
var CellContainer_1 = tslib_1.__importDefault(require("./native/cell-container/CellContainer"));
|
|
33
|
+
var PureComponentWrapper_1 = require("./PureComponentWrapper");
|
|
34
|
+
var GridLayoutProviderWithProps_1 = tslib_1.__importDefault(require("./GridLayoutProviderWithProps"));
|
|
35
|
+
var CustomError_1 = tslib_1.__importDefault(require("./errors/CustomError"));
|
|
36
|
+
var ExceptionList_1 = tslib_1.__importDefault(require("./errors/ExceptionList"));
|
|
37
|
+
var Warnings_1 = tslib_1.__importDefault(require("./errors/Warnings"));
|
|
38
|
+
var ViewabilityManager_1 = tslib_1.__importDefault(require("./viewability/ViewabilityManager"));
|
|
39
|
+
var FlashListProps_1 = require("./FlashListProps");
|
|
40
|
+
var PlatformHelper_1 = require("./native/config/PlatformHelper");
|
|
41
|
+
var ContentContainerUtils_1 = require("./utils/ContentContainerUtils");
|
|
42
|
+
var StickyHeaderContainer = sticky_1.default;
|
|
43
|
+
var FlashList = /** @class */ (function (_super) {
|
|
44
|
+
tslib_1.__extends(FlashList, _super);
|
|
45
|
+
function FlashList(props) {
|
|
46
|
+
var _this = this;
|
|
47
|
+
var _a;
|
|
48
|
+
_this = _super.call(this, props) || this;
|
|
49
|
+
_this.listFixedDimensionSize = 0;
|
|
50
|
+
_this.distanceFromWindow = 0;
|
|
51
|
+
_this.contentStyle = {
|
|
52
|
+
paddingBottom: 0,
|
|
53
|
+
paddingTop: 0,
|
|
54
|
+
paddingLeft: 0,
|
|
55
|
+
paddingRight: 0,
|
|
56
|
+
};
|
|
57
|
+
_this.loadStartTime = 0;
|
|
58
|
+
_this.isListLoaded = false;
|
|
59
|
+
_this.windowCorrectionConfig = {
|
|
60
|
+
value: {
|
|
61
|
+
windowShift: 0,
|
|
62
|
+
startCorrection: 0,
|
|
63
|
+
endCorrection: 0,
|
|
64
|
+
},
|
|
65
|
+
applyToItemScroll: true,
|
|
66
|
+
applyToInitialOffset: true,
|
|
67
|
+
};
|
|
68
|
+
_this.isEmptyList = false;
|
|
69
|
+
_this.onEndReached = function () {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
(_b = (_a = _this.props).onEndReached) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
72
|
+
};
|
|
73
|
+
_this.getRefreshControl = function () {
|
|
74
|
+
if (_this.props.onRefresh) {
|
|
75
|
+
return (react_1.default.createElement(react_native_1.RefreshControl, { refreshing: Boolean(_this.props.refreshing), progressViewOffset: _this.props.progressViewOffset, onRefresh: _this.props.onRefresh }));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
_this.onScrollBeginDrag = function (event) {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
_this.recordInteraction();
|
|
81
|
+
(_b = (_a = _this.props).onScrollBeginDrag) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
82
|
+
};
|
|
83
|
+
_this.onScroll = function (event) {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
_this.recordInteraction();
|
|
86
|
+
_this.viewabilityManager.updateViewableItems();
|
|
87
|
+
(_b = (_a = _this.props).onScroll) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
88
|
+
};
|
|
89
|
+
_this.handleSizeChange = function (event) {
|
|
90
|
+
var _a;
|
|
91
|
+
_this.validateListSize(event);
|
|
92
|
+
var newSize = _this.props.horizontal
|
|
93
|
+
? event.nativeEvent.layout.height
|
|
94
|
+
: event.nativeEvent.layout.width;
|
|
95
|
+
var oldSize = _this.listFixedDimensionSize;
|
|
96
|
+
_this.listFixedDimensionSize = newSize;
|
|
97
|
+
// >0 check is to avoid rerender on mount where it would be redundant
|
|
98
|
+
if (oldSize > 0 && oldSize !== newSize) {
|
|
99
|
+
(_a = _this.rlvRef) === null || _a === void 0 ? void 0 : _a.forceRerender();
|
|
100
|
+
}
|
|
101
|
+
if (_this.props.onLayout) {
|
|
102
|
+
_this.props.onLayout(event);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
_this.container = function (props, children) {
|
|
106
|
+
_this.clearPostLoadTimeout();
|
|
107
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
108
|
+
react_1.default.createElement(PureComponentWrapper_1.PureComponentWrapper, { enabled: _this.isListLoaded || children.length > 0 || _this.isEmptyList, contentStyle: _this.props.contentContainerStyle, horizontal: _this.props.horizontal, header: _this.props.ListHeaderComponent, extraData: _this.state.extraData, headerStyle: _this.props.ListHeaderComponentStyle, inverted: _this.props.inverted, renderer: _this.header }),
|
|
109
|
+
react_1.default.createElement(AutoLayoutView_1.default, tslib_1.__assign({}, props, { onBlankAreaEvent: _this.props.onBlankArea, onLayout: _this.updateDistanceFromWindow, disableAutoLayout: _this.props.disableAutoLayout }), children),
|
|
110
|
+
_this.isEmptyList
|
|
111
|
+
? _this.getValidComponent(_this.props.ListEmptyComponent)
|
|
112
|
+
: null,
|
|
113
|
+
react_1.default.createElement(PureComponentWrapper_1.PureComponentWrapper, { enabled: _this.isListLoaded || children.length > 0 || _this.isEmptyList, contentStyle: _this.props.contentContainerStyle, horizontal: _this.props.horizontal, header: _this.props.ListFooterComponent, extraData: _this.state.extraData, headerStyle: _this.props.ListFooterComponentStyle, inverted: _this.props.inverted, renderer: _this.footer }),
|
|
114
|
+
_this.getComponentForHeightMeasurement()));
|
|
115
|
+
};
|
|
116
|
+
_this.itemContainer = function (props, parentProps) {
|
|
117
|
+
var _a;
|
|
118
|
+
var CellRendererComponent = (_a = _this.props.CellRendererComponent) !== null && _a !== void 0 ? _a : CellContainer_1.default;
|
|
119
|
+
return (react_1.default.createElement(CellRendererComponent, tslib_1.__assign({}, props, { style: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, props.style), { flexDirection: _this.props.horizontal ? "row" : "column", alignItems: "stretch" }), (0, PlatformHelper_1.getCellContainerPlatformStyles)(_this.props.inverted, parentProps)), index: parentProps.index }),
|
|
120
|
+
react_1.default.createElement(PureComponentWrapper_1.PureComponentWrapper, { extendedState: parentProps.extendedState, internalSnapshot: parentProps.internalSnapshot, data: parentProps.data, arg: parentProps.index, renderer: _this.getCellContainerChild })));
|
|
121
|
+
};
|
|
122
|
+
_this.updateDistanceFromWindow = function (event) {
|
|
123
|
+
var newDistanceFromWindow = _this.props.horizontal
|
|
124
|
+
? event.nativeEvent.layout.x
|
|
125
|
+
: event.nativeEvent.layout.y;
|
|
126
|
+
if (_this.distanceFromWindow !== newDistanceFromWindow) {
|
|
127
|
+
_this.distanceFromWindow = newDistanceFromWindow;
|
|
128
|
+
_this.windowCorrectionConfig.value.windowShift = -_this.distanceFromWindow;
|
|
129
|
+
_this.viewabilityManager.updateViewableItems();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
_this.separator = function (index) {
|
|
133
|
+
// Make sure we have data and don't read out of bounds
|
|
134
|
+
if (_this.props.data === null ||
|
|
135
|
+
_this.props.data === undefined ||
|
|
136
|
+
index + 1 >= _this.props.data.length) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
var leadingItem = _this.props.data[index];
|
|
140
|
+
var trailingItem = _this.props.data[index + 1];
|
|
141
|
+
var props = {
|
|
142
|
+
leadingItem: leadingItem,
|
|
143
|
+
trailingItem: trailingItem,
|
|
144
|
+
// TODO: Missing sections as we don't have this feature implemented yet. Implement section, leadingSection and trailingSection.
|
|
145
|
+
// https://github.com/facebook/react-native/blob/8bd3edec88148d0ab1f225d2119435681fbbba33/Libraries/Lists/VirtualizedSectionList.js#L285-L294
|
|
146
|
+
};
|
|
147
|
+
var Separator = _this.props.ItemSeparatorComponent;
|
|
148
|
+
return Separator && react_1.default.createElement(Separator, tslib_1.__assign({}, props));
|
|
149
|
+
};
|
|
150
|
+
_this.header = function () {
|
|
151
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
152
|
+
react_1.default.createElement(react_native_1.View, { style: {
|
|
153
|
+
paddingTop: _this.contentStyle.paddingTop,
|
|
154
|
+
paddingLeft: _this.contentStyle.paddingLeft,
|
|
155
|
+
} }),
|
|
156
|
+
react_1.default.createElement(react_native_1.View, { style: [_this.props.ListHeaderComponentStyle] }, _this.getValidComponent(_this.props.ListHeaderComponent))));
|
|
157
|
+
};
|
|
158
|
+
_this.footer = function () {
|
|
159
|
+
var _a;
|
|
160
|
+
/** The web version of CellContainer uses a div directly which doesn't compose styles the way a View does.
|
|
161
|
+
* We will skip using CellContainer on web to avoid this issue. `getFooterContainer` on web will
|
|
162
|
+
* return a View. */
|
|
163
|
+
var FooterContainer = (_a = (0, PlatformHelper_1.getFooterContainer)()) !== null && _a !== void 0 ? _a : CellContainer_1.default;
|
|
164
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
165
|
+
react_1.default.createElement(FooterContainer, { index: -1, style: [_this.props.ListFooterComponentStyle] }, _this.getValidComponent(_this.props.ListFooterComponent)),
|
|
166
|
+
react_1.default.createElement(react_native_1.View, { style: {
|
|
167
|
+
paddingBottom: _this.contentStyle.paddingBottom,
|
|
168
|
+
paddingRight: _this.contentStyle.paddingRight,
|
|
169
|
+
} })));
|
|
170
|
+
};
|
|
171
|
+
_this.getComponentForHeightMeasurement = function () {
|
|
172
|
+
return _this.props.horizontal &&
|
|
173
|
+
!_this.props.disableHorizontalListHeightMeasurement &&
|
|
174
|
+
!_this.isListLoaded &&
|
|
175
|
+
_this.state.dataProvider.getSize() > 0 ? (react_1.default.createElement(react_native_1.View, { style: { opacity: 0 }, pointerEvents: "none" }, _this.rowRendererWithIndex(Math.min(_this.state.dataProvider.getSize() - 1, 1), FlashListProps_1.RenderTargetOptions.Measurement))) : null;
|
|
176
|
+
};
|
|
177
|
+
_this.applyWindowCorrection = function (_, __, correctionObject) {
|
|
178
|
+
var _a;
|
|
179
|
+
correctionObject.windowShift = -_this.distanceFromWindow;
|
|
180
|
+
(_a = _this.stickyContentContainerRef) === null || _a === void 0 ? void 0 : _a.setEnabled(_this.isStickyEnabled);
|
|
181
|
+
};
|
|
182
|
+
_this.rowRendererSticky = function (index) {
|
|
183
|
+
return _this.rowRendererWithIndex(index, FlashListProps_1.RenderTargetOptions.StickyHeader);
|
|
184
|
+
};
|
|
185
|
+
_this.rowRendererWithIndex = function (index, target) {
|
|
186
|
+
var _a, _b, _c;
|
|
187
|
+
// known issue: expected to pass separators which isn't available in RLV
|
|
188
|
+
return (_b = (_a = _this.props).renderItem) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
189
|
+
item: _this.state.data[index],
|
|
190
|
+
index: index,
|
|
191
|
+
target: target,
|
|
192
|
+
extraData: (_c = _this.state.extraData) === null || _c === void 0 ? void 0 : _c.value,
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* This will prevent render item calls unless data changes.
|
|
197
|
+
* Output of this method is received as children object so returning null here is no issue as long as we handle it inside our child container.
|
|
198
|
+
* @module getCellContainerChild acts as the new rowRenderer and is called directly from our child container.
|
|
199
|
+
*/
|
|
200
|
+
_this.emptyRowRenderer = function () {
|
|
201
|
+
return null;
|
|
202
|
+
};
|
|
203
|
+
_this.getCellContainerChild = function (index) {
|
|
204
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
205
|
+
react_1.default.createElement(react_native_1.View, { style: {
|
|
206
|
+
flexDirection: _this.props.horizontal || _this.props.numColumns === 1
|
|
207
|
+
? "column"
|
|
208
|
+
: "row",
|
|
209
|
+
} }, _this.rowRendererWithIndex(index, FlashListProps_1.RenderTargetOptions.Cell)),
|
|
210
|
+
_this.separator(index)));
|
|
211
|
+
};
|
|
212
|
+
_this.recyclerRef = function (ref) {
|
|
213
|
+
_this.rlvRef = ref;
|
|
214
|
+
};
|
|
215
|
+
_this.stickyContentRef = function (ref) {
|
|
216
|
+
_this.stickyContentContainerRef = ref;
|
|
217
|
+
};
|
|
218
|
+
_this.stickyOverrideRowRenderer = function (_, rowData, index, ___) {
|
|
219
|
+
return (react_1.default.createElement(PureComponentWrapper_1.PureComponentWrapper, { ref: _this.stickyContentRef, enabled: _this.isStickyEnabled,
|
|
220
|
+
// We're passing rowData to ensure that sticky headers are updated when data changes
|
|
221
|
+
rowData: rowData, arg: index, renderer: _this.rowRendererSticky }));
|
|
222
|
+
};
|
|
223
|
+
_this.onItemLayout = function (index) {
|
|
224
|
+
// Informing the layout provider about change to an item's layout. It already knows the dimensions so there's not need to pass them.
|
|
225
|
+
_this.state.layoutProvider.reportItemLayout(index);
|
|
226
|
+
_this.raiseOnLoadEventIfNeeded();
|
|
227
|
+
};
|
|
228
|
+
_this.raiseOnLoadEventIfNeeded = function () {
|
|
229
|
+
var _a, _b;
|
|
230
|
+
if (!_this.isListLoaded) {
|
|
231
|
+
_this.isListLoaded = true;
|
|
232
|
+
(_b = (_a = _this.props).onLoad) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
233
|
+
elapsedTimeInMs: Date.now() - _this.loadStartTime,
|
|
234
|
+
});
|
|
235
|
+
_this.runAfterOnLoad();
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
_this.runAfterOnLoad = function () {
|
|
239
|
+
if (_this.props.estimatedItemSize === undefined) {
|
|
240
|
+
_this.itemSizeWarningTimeoutId = setTimeout(function () {
|
|
241
|
+
var averageItemSize = Math.floor(_this.state.layoutProvider.averageItemSize);
|
|
242
|
+
console.warn(Warnings_1.default.estimatedItemSizeMissingWarning.replace("@size", averageItemSize.toString()));
|
|
243
|
+
}, 1000);
|
|
244
|
+
}
|
|
245
|
+
_this.postLoadTimeoutId = setTimeout(function () {
|
|
246
|
+
// This force update is required to remove dummy element rendered to measure horizontal list height when the list doesn't update on its own.
|
|
247
|
+
// In most cases this timeout will never be triggered because list usually updates atleast once and this timeout is cleared on update.
|
|
248
|
+
if (_this.props.horizontal) {
|
|
249
|
+
_this.forceUpdate();
|
|
250
|
+
}
|
|
251
|
+
}, 500);
|
|
252
|
+
};
|
|
253
|
+
_this.clearPostLoadTimeout = function () {
|
|
254
|
+
if (_this.postLoadTimeoutId !== undefined) {
|
|
255
|
+
clearTimeout(_this.postLoadTimeoutId);
|
|
256
|
+
_this.postLoadTimeoutId = undefined;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
_this.clearRenderSizeWarningTimeout = function () {
|
|
260
|
+
if (_this.renderedSizeWarningTimeoutId !== undefined) {
|
|
261
|
+
clearTimeout(_this.renderedSizeWarningTimeoutId);
|
|
262
|
+
_this.renderedSizeWarningTimeoutId = undefined;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Tells the list an interaction has occurred, which should trigger viewability calculations, e.g. if waitForInteractions is true and the user has not scrolled.
|
|
267
|
+
* This is typically called by taps on items or by navigation actions.
|
|
268
|
+
*/
|
|
269
|
+
_this.recordInteraction = function () {
|
|
270
|
+
_this.viewabilityManager.recordInteraction();
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Retriggers viewability calculations. Useful to imperatively trigger viewability calculations.
|
|
274
|
+
*/
|
|
275
|
+
_this.recomputeViewableItems = function () {
|
|
276
|
+
_this.viewabilityManager.recomputeViewableItems();
|
|
277
|
+
};
|
|
278
|
+
_this.loadStartTime = Date.now();
|
|
279
|
+
_this.validateProps();
|
|
280
|
+
if (props.estimatedListSize) {
|
|
281
|
+
if (props.horizontal) {
|
|
282
|
+
_this.listFixedDimensionSize = props.estimatedListSize.height;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
_this.listFixedDimensionSize = props.estimatedListSize.width;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
_this.distanceFromWindow =
|
|
289
|
+
(_a = props.estimatedFirstItemOffset) !== null && _a !== void 0 ? _a : ((props.ListHeaderComponent && 1) || 0);
|
|
290
|
+
// eslint-disable-next-line react/state-in-constructor
|
|
291
|
+
_this.state = FlashList.getInitialMutableState(_this);
|
|
292
|
+
_this.viewabilityManager = new ViewabilityManager_1.default(_this);
|
|
293
|
+
_this.itemAnimator = (0, PlatformHelper_1.getItemAnimator)();
|
|
294
|
+
return _this;
|
|
295
|
+
}
|
|
296
|
+
FlashList.prototype.validateProps = function () {
|
|
297
|
+
var _a, _b;
|
|
298
|
+
if (this.props.onRefresh && typeof this.props.refreshing !== "boolean") {
|
|
299
|
+
throw new CustomError_1.default(ExceptionList_1.default.refreshBooleanMissing);
|
|
300
|
+
}
|
|
301
|
+
if (Number((_a = this.props.stickyHeaderIndices) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
302
|
+
this.props.horizontal) {
|
|
303
|
+
throw new CustomError_1.default(ExceptionList_1.default.stickyWhileHorizontalNotSupported);
|
|
304
|
+
}
|
|
305
|
+
if (Number(this.props.numColumns) > 1 && this.props.horizontal) {
|
|
306
|
+
throw new CustomError_1.default(ExceptionList_1.default.columnsWhileHorizontalNotSupported);
|
|
307
|
+
}
|
|
308
|
+
// `createAnimatedComponent` always passes a blank style object. To avoid warning while using AnimatedFlashList we've modified the check
|
|
309
|
+
// `style` prop can be an array. So we need to validate every object in array. Check: https://github.com/Shopify/flash-list/issues/651
|
|
310
|
+
if (__DEV__ &&
|
|
311
|
+
Object.keys(react_native_1.StyleSheet.flatten((_b = this.props.style) !== null && _b !== void 0 ? _b : {})).length > 0) {
|
|
312
|
+
console.warn(Warnings_1.default.styleUnsupported);
|
|
313
|
+
}
|
|
314
|
+
if ((0, ContentContainerUtils_1.hasUnsupportedKeysInContentContainerStyle)(this.props.contentContainerStyle)) {
|
|
315
|
+
console.warn(Warnings_1.default.styleContentContainerUnsupported);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
// Some of the state variables need to update when props change
|
|
319
|
+
FlashList.getDerivedStateFromProps = function (nextProps, prevState) {
|
|
320
|
+
var _a, _b, _c;
|
|
321
|
+
var newState = tslib_1.__assign({}, prevState);
|
|
322
|
+
if (prevState.numColumns !== nextProps.numColumns) {
|
|
323
|
+
newState.numColumns = nextProps.numColumns || 1;
|
|
324
|
+
newState.layoutProvider = FlashList.getLayoutProvider(newState.numColumns, nextProps);
|
|
325
|
+
}
|
|
326
|
+
else if (prevState.layoutProvider.updateProps(nextProps).hasExpired) {
|
|
327
|
+
newState.layoutProvider = FlashList.getLayoutProvider(newState.numColumns, nextProps);
|
|
328
|
+
}
|
|
329
|
+
// RLV retries to reposition the first visible item on layout provider change.
|
|
330
|
+
// It's not required in our case so we're disabling it
|
|
331
|
+
newState.layoutProvider.shouldRefreshWithAnchoring = Boolean(!((_a = prevState.layoutProvider) === null || _a === void 0 ? void 0 : _a.hasExpired));
|
|
332
|
+
if (nextProps.data !== prevState.data || prevState.lastInverted !== nextProps.inverted) {
|
|
333
|
+
var processedData = nextProps.inverted
|
|
334
|
+
? (nextProps.data ? tslib_1.__spreadArray([], tslib_1.__read(nextProps.data), false).reverse() : nextProps.data)
|
|
335
|
+
: nextProps.data;
|
|
336
|
+
newState.data = processedData;
|
|
337
|
+
newState.dataProvider = prevState.dataProvider.cloneWithRows(processedData);
|
|
338
|
+
if (nextProps.renderItem !== prevState.renderItem) {
|
|
339
|
+
newState.extraData = tslib_1.__assign({}, prevState.extraData);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (nextProps.extraData !== ((_b = prevState.extraData) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
343
|
+
newState.extraData = { value: nextProps.extraData };
|
|
344
|
+
}
|
|
345
|
+
newState.renderItem = nextProps.renderItem;
|
|
346
|
+
newState.lastInverted = (_c = nextProps.inverted) !== null && _c !== void 0 ? _c : undefined;
|
|
347
|
+
return newState;
|
|
348
|
+
};
|
|
349
|
+
FlashList.getInitialMutableState = function (flashList) {
|
|
350
|
+
var getStableId;
|
|
351
|
+
if (flashList.props.keyExtractor !== null &&
|
|
352
|
+
flashList.props.keyExtractor !== undefined) {
|
|
353
|
+
getStableId = function (index) {
|
|
354
|
+
// We assume `keyExtractor` function will never change from being `null | undefined` to defined and vice versa.
|
|
355
|
+
// Similarly, data should never be `null | undefined` when `getStableId` is called.
|
|
356
|
+
return flashList.props.keyExtractor(flashList.props.data[index], index).toString();
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
data: null,
|
|
361
|
+
layoutProvider: null,
|
|
362
|
+
dataProvider: new recyclerlistview_1.DataProvider(function (r1, r2) {
|
|
363
|
+
return r1 !== r2;
|
|
364
|
+
}, getStableId),
|
|
365
|
+
numColumns: 0,
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
// Using only grid layout provider as it can also act as a listview, sizeProvider is a function to support future overrides
|
|
369
|
+
FlashList.getLayoutProvider = function (numColumns, flashListProps) {
|
|
370
|
+
return new GridLayoutProviderWithProps_1.default(
|
|
371
|
+
// max span or, total columns
|
|
372
|
+
numColumns, function (index, props) {
|
|
373
|
+
var _a;
|
|
374
|
+
// type of the item for given index
|
|
375
|
+
var type = (_a = props.getItemType) === null || _a === void 0 ? void 0 : _a.call(props, props.data[index], index, props.extraData);
|
|
376
|
+
return type || 0;
|
|
377
|
+
}, function (index, props, mutableLayout) {
|
|
378
|
+
var _a, _b;
|
|
379
|
+
// span of the item at given index, item can choose to span more than one column
|
|
380
|
+
(_a = props.overrideItemLayout) === null || _a === void 0 ? void 0 : _a.call(props, mutableLayout, props.data[index], index, numColumns, props.extraData);
|
|
381
|
+
return (_b = mutableLayout === null || mutableLayout === void 0 ? void 0 : mutableLayout.span) !== null && _b !== void 0 ? _b : 1;
|
|
382
|
+
}, function (index, props, mutableLayout) {
|
|
383
|
+
var _a;
|
|
384
|
+
// estimated size of the item an given index
|
|
385
|
+
(_a = props.overrideItemLayout) === null || _a === void 0 ? void 0 : _a.call(props, mutableLayout, props.data[index], index, numColumns, props.extraData);
|
|
386
|
+
console.log('mutableLayout:', mutableLayout);
|
|
387
|
+
return mutableLayout === null || mutableLayout === void 0 ? void 0 : mutableLayout.size;
|
|
388
|
+
}, flashListProps);
|
|
389
|
+
};
|
|
390
|
+
FlashList.prototype.componentDidMount = function () {
|
|
391
|
+
var _a;
|
|
392
|
+
if (((_a = this.props.data) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
393
|
+
this.raiseOnLoadEventIfNeeded();
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
FlashList.prototype.componentWillUnmount = function () {
|
|
397
|
+
this.viewabilityManager.dispose();
|
|
398
|
+
this.clearPostLoadTimeout();
|
|
399
|
+
this.clearRenderSizeWarningTimeout();
|
|
400
|
+
if (this.itemSizeWarningTimeoutId !== undefined) {
|
|
401
|
+
clearTimeout(this.itemSizeWarningTimeoutId);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
FlashList.prototype.render = function () {
|
|
405
|
+
this.isEmptyList = this.state.dataProvider.getSize() === 0;
|
|
406
|
+
(0, ContentContainerUtils_1.updateContentStyle)(this.contentStyle, this.props.contentContainerStyle);
|
|
407
|
+
var _a = this.props, drawDistance = _a.drawDistance, removeClippedSubviews = _a.removeClippedSubviews, stickyHeaderIndices = _a.stickyHeaderIndices, horizontal = _a.horizontal, onEndReachedThreshold = _a.onEndReachedThreshold, estimatedListSize = _a.estimatedListSize, initialScrollIndex = _a.initialScrollIndex, style = _a.style, contentContainerStyle = _a.contentContainerStyle, renderScrollComponent = _a.renderScrollComponent, restProps = tslib_1.__rest(_a, ["drawDistance", "removeClippedSubviews", "stickyHeaderIndices", "horizontal", "onEndReachedThreshold", "estimatedListSize", "initialScrollIndex", "style", "contentContainerStyle", "renderScrollComponent"]);
|
|
408
|
+
// RecyclerListView simply ignores if initialScrollIndex is set to 0 because it doesn't understand headers
|
|
409
|
+
// Using initialOffset to force RLV to scroll to the right place
|
|
410
|
+
var initialOffset = (this.isInitialScrollIndexInFirstRow() && this.distanceFromWindow) ||
|
|
411
|
+
undefined;
|
|
412
|
+
var finalDrawDistance = drawDistance === undefined
|
|
413
|
+
? PlatformHelper_1.PlatformConfig.defaultDrawDistance
|
|
414
|
+
: drawDistance;
|
|
415
|
+
return (react_1.default.createElement(StickyHeaderContainer, { overrideRowRenderer: this.stickyOverrideRowRenderer, applyWindowCorrection: this.applyWindowCorrection, stickyHeaderIndices: stickyHeaderIndices, style: this.props.horizontal
|
|
416
|
+
? {}
|
|
417
|
+
: { flex: 1, overflow: "hidden" } },
|
|
418
|
+
react_1.default.createElement(recyclerlistview_1.ProgressiveListView, tslib_1.__assign({}, restProps, { ref: this.recyclerRef, layoutProvider: this.state.layoutProvider, dataProvider: this.state.dataProvider, rowRenderer: this.emptyRowRenderer, canChangeSize: true, isHorizontal: Boolean(horizontal), scrollViewProps: tslib_1.__assign({ onScrollBeginDrag: this.onScrollBeginDrag, onLayout: this.handleSizeChange, refreshControl: this.props.refreshControl || this.getRefreshControl(),
|
|
419
|
+
// Min values are being used to suppress RLV's bounded exception
|
|
420
|
+
style: { minHeight: 1, minWidth: 1 }, contentContainerStyle: tslib_1.__assign({ backgroundColor: this.contentStyle.backgroundColor,
|
|
421
|
+
// Required to handle a scrollview bug. Check: https://github.com/Shopify/flash-list/pull/187
|
|
422
|
+
minHeight: 1, minWidth: 1 }, (0, ContentContainerUtils_1.getContentContainerPadding)(this.contentStyle, horizontal)) }, this.props.overrideProps), forceNonDeterministicRendering: true, renderItemContainer: this.itemContainer, renderContentContainer: this.container, onEndReached: this.onEndReached, onEndReachedThresholdRelative: onEndReachedThreshold || undefined, extendedState: this.state.extraData, layoutSize: estimatedListSize, maxRenderAhead: 3 * finalDrawDistance, finalRenderAheadOffset: finalDrawDistance, renderAheadStep: finalDrawDistance, initialRenderIndex: (!this.isInitialScrollIndexInFirstRow() && initialScrollIndex) ||
|
|
423
|
+
undefined, initialOffset: initialOffset, onItemLayout: this.onItemLayout, onScroll: this.onScroll, onVisibleIndicesChanged: this.viewabilityManager.shouldListenToVisibleIndices
|
|
424
|
+
? this.viewabilityManager.onVisibleIndicesChanged
|
|
425
|
+
: undefined, windowCorrectionConfig: this.getUpdatedWindowCorrectionConfig(), itemAnimator: this.itemAnimator, suppressBoundedSizeException: true, externalScrollView: renderScrollComponent }))));
|
|
426
|
+
};
|
|
427
|
+
FlashList.prototype.getUpdatedWindowCorrectionConfig = function () {
|
|
428
|
+
// If the initial scroll index is in the first row then we're forcing RLV to use initialOffset and thus we need to disable window correction
|
|
429
|
+
// This isn't clean but it's the only way to get RLV to scroll to the right place
|
|
430
|
+
// TODO: Remove this when RLV fixes this. Current implementation will also fail if column span is overridden in the first row.
|
|
431
|
+
if (this.isInitialScrollIndexInFirstRow()) {
|
|
432
|
+
this.windowCorrectionConfig.applyToInitialOffset = false;
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
this.windowCorrectionConfig.applyToInitialOffset = true;
|
|
436
|
+
}
|
|
437
|
+
this.windowCorrectionConfig.value.windowShift = -this.distanceFromWindow;
|
|
438
|
+
return this.windowCorrectionConfig;
|
|
439
|
+
};
|
|
440
|
+
FlashList.prototype.isInitialScrollIndexInFirstRow = function () {
|
|
441
|
+
var _a;
|
|
442
|
+
return (((_a = this.props.initialScrollIndex) !== null && _a !== void 0 ? _a : this.state.numColumns) <
|
|
443
|
+
this.state.numColumns);
|
|
444
|
+
};
|
|
445
|
+
FlashList.prototype.validateListSize = function (event) {
|
|
446
|
+
var _a = event.nativeEvent.layout, height = _a.height, width = _a.width;
|
|
447
|
+
this.clearRenderSizeWarningTimeout();
|
|
448
|
+
if (Math.floor(height) <= 1 || Math.floor(width) <= 1) {
|
|
449
|
+
this.renderedSizeWarningTimeoutId = setTimeout(function () {
|
|
450
|
+
console.warn(Warnings_1.default.unusableRenderedSize);
|
|
451
|
+
}, 1000);
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
FlashList.prototype.getValidComponent = function (component) {
|
|
455
|
+
var PassedComponent = component;
|
|
456
|
+
return ((react_1.default.isValidElement(PassedComponent) && PassedComponent) ||
|
|
457
|
+
(PassedComponent && react_1.default.createElement(PassedComponent, null)) ||
|
|
458
|
+
null);
|
|
459
|
+
};
|
|
460
|
+
Object.defineProperty(FlashList.prototype, "isStickyEnabled", {
|
|
461
|
+
get: function () {
|
|
462
|
+
var _a;
|
|
463
|
+
var currentOffset = ((_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.getCurrentScrollOffset()) || 0;
|
|
464
|
+
return currentOffset >= this.distanceFromWindow;
|
|
465
|
+
},
|
|
466
|
+
enumerable: false,
|
|
467
|
+
configurable: true
|
|
468
|
+
});
|
|
469
|
+
/**
|
|
470
|
+
* Disables recycling for the next frame so that layout animations run well.
|
|
471
|
+
* Warning: Avoid this when making large changes to the data as the list might draw too much to run animations. Single item insertions/deletions
|
|
472
|
+
* should be good. With recycling paused the list cannot do much optimization.
|
|
473
|
+
* The next render will run as normal and reuse items.
|
|
474
|
+
*/
|
|
475
|
+
FlashList.prototype.prepareForLayoutAnimationRender = function () {
|
|
476
|
+
var _a;
|
|
477
|
+
if (this.props.keyExtractor === null ||
|
|
478
|
+
this.props.keyExtractor === undefined) {
|
|
479
|
+
console.warn(Warnings_1.default.missingKeyExtractor);
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
(_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.prepareForLayoutAnimationRender();
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
FlashList.prototype.scrollToEnd = function (params) {
|
|
486
|
+
var _a;
|
|
487
|
+
(_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.scrollToEnd(Boolean(params === null || params === void 0 ? void 0 : params.animated));
|
|
488
|
+
};
|
|
489
|
+
FlashList.prototype.scrollToIndex = function (params) {
|
|
490
|
+
var _a, _b, _c, _d, _e;
|
|
491
|
+
var layout = (_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.getLayout(params.index);
|
|
492
|
+
var listSize = (_b = this.rlvRef) === null || _b === void 0 ? void 0 : _b.getRenderedSize();
|
|
493
|
+
if (layout && listSize) {
|
|
494
|
+
var itemOffset = this.props.horizontal ? layout.x : layout.y;
|
|
495
|
+
var fixedDimension = this.props.horizontal
|
|
496
|
+
? listSize.width
|
|
497
|
+
: listSize.height;
|
|
498
|
+
var itemSize = this.props.horizontal ? layout.width : layout.height;
|
|
499
|
+
var scrollOffset = Math.max(0, itemOffset - ((_c = params.viewPosition) !== null && _c !== void 0 ? _c : 0) * (fixedDimension - itemSize)) - ((_d = params.viewOffset) !== null && _d !== void 0 ? _d : 0);
|
|
500
|
+
(_e = this.rlvRef) === null || _e === void 0 ? void 0 : _e.scrollToOffset(scrollOffset, scrollOffset, Boolean(params.animated), true);
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
FlashList.prototype.scrollToItem = function (params) {
|
|
504
|
+
var _a, _b;
|
|
505
|
+
var index = (_b = (_a = this.props.data) === null || _a === void 0 ? void 0 : _a.indexOf(params.item)) !== null && _b !== void 0 ? _b : -1;
|
|
506
|
+
if (index >= 0) {
|
|
507
|
+
this.scrollToIndex(tslib_1.__assign(tslib_1.__assign({}, params), { index: index }));
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
FlashList.prototype.scrollToOffset = function (params) {
|
|
511
|
+
var _a;
|
|
512
|
+
var x = this.props.horizontal ? params.offset : 0;
|
|
513
|
+
var y = this.props.horizontal ? 0 : params.offset;
|
|
514
|
+
(_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.scrollToOffset(x, y, Boolean(params.animated));
|
|
515
|
+
};
|
|
516
|
+
FlashList.prototype.getScrollableNode = function () {
|
|
517
|
+
var _a, _b;
|
|
518
|
+
return ((_b = (_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.getScrollableNode) === null || _b === void 0 ? void 0 : _b.call(_a)) || null;
|
|
519
|
+
};
|
|
520
|
+
Object.defineProperty(FlashList.prototype, "recyclerlistview_unsafe", {
|
|
521
|
+
/**
|
|
522
|
+
* Allows access to internal recyclerlistview. This is useful for enabling access to its public APIs.
|
|
523
|
+
* Warning: We may swap recyclerlistview for something else in the future. Use with caution.
|
|
524
|
+
*/
|
|
525
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
526
|
+
get: function () {
|
|
527
|
+
return this.rlvRef;
|
|
528
|
+
},
|
|
529
|
+
enumerable: false,
|
|
530
|
+
configurable: true
|
|
531
|
+
});
|
|
532
|
+
Object.defineProperty(FlashList.prototype, "firstItemOffset", {
|
|
533
|
+
/**
|
|
534
|
+
* Specifies how far the first item is from top of the list. This would normally be a sum of header size and top/left padding applied to the list.
|
|
535
|
+
*/
|
|
536
|
+
get: function () {
|
|
537
|
+
return this.distanceFromWindow;
|
|
538
|
+
},
|
|
539
|
+
enumerable: false,
|
|
540
|
+
configurable: true
|
|
541
|
+
});
|
|
542
|
+
/**
|
|
543
|
+
* FlashList will skip using layout cache on next update. Can be useful when you know the layout will change drastically for example, orientation change when used as a carousel.
|
|
544
|
+
*/
|
|
545
|
+
FlashList.prototype.clearLayoutCacheOnUpdate = function () {
|
|
546
|
+
this.state.layoutProvider.markExpired();
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* Returns the dimensions of the child container.
|
|
550
|
+
* @returns {Object} The dimensions of the child container.
|
|
551
|
+
*/
|
|
552
|
+
FlashList.prototype.getChildContainerDimensions = function () {
|
|
553
|
+
var _a;
|
|
554
|
+
return (_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.getContentDimension();
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* Returns the layout of the item at the given index.
|
|
558
|
+
* @param index - The index of the item to get the layout for.
|
|
559
|
+
* @returns {Object} The layout of the item at the given index.
|
|
560
|
+
*/
|
|
561
|
+
FlashList.prototype.getLayout = function (index) {
|
|
562
|
+
var _a;
|
|
563
|
+
var l = (_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.getLayout(index);
|
|
564
|
+
return l;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Returns the size of the list.
|
|
568
|
+
* @returns {Object} The size of the list.
|
|
569
|
+
*/
|
|
570
|
+
FlashList.prototype.getWindowSize = function () {
|
|
571
|
+
var _a;
|
|
572
|
+
return (_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.getRenderedSize();
|
|
573
|
+
};
|
|
574
|
+
/**
|
|
575
|
+
* Returns the absolute last scroll offset of the list.
|
|
576
|
+
* @returns {number} The absolute last scroll offset of the list.
|
|
577
|
+
*/
|
|
578
|
+
FlashList.prototype.getAbsoluteLastScrollOffset = function () {
|
|
579
|
+
var _a, _b;
|
|
580
|
+
return (_b = (_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.getCurrentScrollOffset()) !== null && _b !== void 0 ? _b : 0;
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* Returns the first item offset of the list.
|
|
584
|
+
* @returns {number} The first item offset of the list.
|
|
585
|
+
*/
|
|
586
|
+
FlashList.prototype.getFirstItemOffset = function () {
|
|
587
|
+
return this.firstItemOffset;
|
|
588
|
+
};
|
|
589
|
+
FlashList.prototype.getFirstVisibleIndex = function () {
|
|
590
|
+
var _a, _b;
|
|
591
|
+
return (_b = (_a = this.rlvRef) === null || _a === void 0 ? void 0 : _a.findApproxFirstVisibleIndex()) !== null && _b !== void 0 ? _b : -1;
|
|
592
|
+
};
|
|
593
|
+
FlashList.defaultProps = {
|
|
594
|
+
data: [],
|
|
595
|
+
numColumns: 1,
|
|
596
|
+
};
|
|
597
|
+
return FlashList;
|
|
598
|
+
}(react_1.default.PureComponent));
|
|
599
|
+
exports.default = FlashList;
|
|
599
600
|
//# sourceMappingURL=FlashList.js.map
|