@tamagui/react-native-web-lite 1.116.2 → 1.116.3
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/dist/cjs/Batchinator/index.cjs +68 -0
- package/dist/cjs/Batchinator/index.js +57 -0
- package/dist/cjs/Batchinator/index.js.map +6 -0
- package/dist/cjs/Batchinator/index.native.js +92 -0
- package/dist/cjs/Batchinator/index.native.js.map +6 -0
- package/dist/cjs/FlatList.cjs +196 -0
- package/dist/cjs/FlatList.js +193 -0
- package/dist/cjs/FlatList.js.map +6 -0
- package/dist/cjs/FlatList.native.js +256 -0
- package/dist/cjs/FlatList.native.js.map +6 -0
- package/dist/cjs/InteractionManager/TaskQueue.cjs +88 -0
- package/dist/cjs/InteractionManager/TaskQueue.js +76 -0
- package/dist/cjs/InteractionManager/TaskQueue.js.map +6 -0
- package/dist/cjs/InteractionManager/TaskQueue.native.js +134 -0
- package/dist/cjs/InteractionManager/TaskQueue.native.js.map +6 -0
- package/dist/cjs/InteractionManager/index.cjs +114 -0
- package/dist/cjs/InteractionManager/index.js +95 -0
- package/dist/cjs/InteractionManager/index.js.map +6 -0
- package/dist/cjs/InteractionManager/index.native.js +99 -0
- package/dist/cjs/InteractionManager/index.native.js.map +6 -0
- package/dist/cjs/index.cjs +7 -7
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +6 -6
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/vendor/react-native/FillRateHelper/index.cjs +138 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.js +124 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.js.map +6 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.native.js +158 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.cjs +29 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.js +24 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.js.map +6 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.native.js +25 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.cjs +133 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.js +144 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.js.map +6 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.native.js +199 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.cjs +106 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.js +86 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.native.js +95 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.cjs +81 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.js +84 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.native.js +125 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.cjs +56 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.js +59 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.native.js +153 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.cjs +80 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.js +74 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js +163 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.cjs +164 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js +149 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js +245 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.cjs +84 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.js +72 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js +85 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.cjs +16 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.js +14 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js +15 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.cjs +1003 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.js +1021 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.native.js +1075 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.cjs +41 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.js +47 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.js.map +6 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.native.js +48 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.native.js.map +6 -0
- package/dist/esm/Batchinator/index.js +33 -0
- package/dist/esm/Batchinator/index.js.map +6 -0
- package/dist/esm/Batchinator/index.mjs +34 -0
- package/dist/esm/Batchinator/index.mjs.map +1 -0
- package/dist/esm/Batchinator/index.native.js +67 -0
- package/dist/esm/Batchinator/index.native.js.map +6 -0
- package/dist/esm/FlatList.js +176 -0
- package/dist/esm/FlatList.js.map +6 -0
- package/dist/esm/FlatList.mjs +162 -0
- package/dist/esm/FlatList.mjs.map +1 -0
- package/dist/esm/FlatList.native.js +238 -0
- package/dist/esm/FlatList.native.js.map +6 -0
- package/dist/esm/InteractionManager/TaskQueue.js +60 -0
- package/dist/esm/InteractionManager/TaskQueue.js.map +6 -0
- package/dist/esm/InteractionManager/TaskQueue.mjs +65 -0
- package/dist/esm/InteractionManager/TaskQueue.mjs.map +1 -0
- package/dist/esm/InteractionManager/TaskQueue.native.js +117 -0
- package/dist/esm/InteractionManager/TaskQueue.native.js.map +6 -0
- package/dist/esm/InteractionManager/index.js +73 -0
- package/dist/esm/InteractionManager/index.js.map +6 -0
- package/dist/esm/InteractionManager/index.mjs +80 -0
- package/dist/esm/InteractionManager/index.mjs.map +1 -0
- package/dist/esm/InteractionManager/index.native.js +77 -0
- package/dist/esm/InteractionManager/index.native.js.map +6 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.native.js +2 -2
- package/dist/esm/vendor/react-native/FillRateHelper/index.js +108 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.js.map +6 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.mjs +115 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.mjs.map +1 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.native.js +141 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.native.js.map +6 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.js +8 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.js.map +6 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.mjs +6 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.mjs.map +1 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.native.js +8 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.native.js.map +6 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.js +128 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.js.map +6 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.mjs +110 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.mjs.map +1 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.native.js +182 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.js +70 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.mjs +80 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.native.js +71 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.js +68 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.mjs +58 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.native.js +104 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.js +43 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.mjs +33 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.native.js +136 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.js +51 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.mjs +46 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js +139 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js +132 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.mjs +130 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js +224 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.js +50 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.mjs +47 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js +56 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.js +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.mjs +2 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.js +1016 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.mjs +969 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.native.js +1065 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.native.js.map +6 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.js +31 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.js.map +6 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.mjs +18 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.mjs.map +1 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.native.js +31 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.native.js.map +6 -0
- package/package.json +6 -6
- package/src/Batchinator/index.tsx +78 -0
- package/src/FlatList.tsx +330 -0
- package/src/InteractionManager/TaskQueue.tsx +114 -0
- package/src/InteractionManager/index.tsx +139 -0
- package/src/index.tsx +2 -2
- package/src/vendor/react-native/FillRateHelper/index.tsx +218 -0
- package/src/vendor/react-native/Utilities/clamp.ts +21 -0
- package/src/vendor/react-native/ViewabilityHelper.ts +291 -0
- package/src/vendor/react-native/VirtualizeUtils/index.tsx +212 -0
- package/src/vendor/react-native/VirtualizedList/CellRenderMask.ts +147 -0
- package/src/vendor/react-native/VirtualizedList/ChildListCollection.tsx +73 -0
- package/src/vendor/react-native/VirtualizedList/StateSafePureComponent.tsx +79 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.tsx +210 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListContext.tsx +116 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListProps.ts +130 -0
- package/src/vendor/react-native/VirtualizedList/index.tsx +1797 -0
- package/src/vendor/react-native/deepDiffer/index.tsx +56 -0
|
@@ -0,0 +1,1075 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
+
var VirtualizedList_exports = {};
|
|
25
|
+
__export(VirtualizedList_exports, {
|
|
26
|
+
default: () => VirtualizedList_default
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(VirtualizedList_exports);
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_react_native_web_internals = require("@tamagui/react-native-web-internals"), import_ViewabilityHelper = __toESM(require("../ViewabilityHelper")), import_CellRenderMask = require("./CellRenderMask"), import_StateSafePureComponent = __toESM(require("./StateSafePureComponent")), import_VirtualizedListContext = require("./VirtualizedListContext"), import_ScrollViewBase = __toESM(require("../../../ScrollView/ScrollViewBase")), import_View = __toESM(require("../../../View")), import_VirtualizedListCellRenderer = __toESM(require("./VirtualizedListCellRenderer")), import_FillRateHelper = __toESM(require("../FillRateHelper")), import_ChildListCollection = __toESM(require("./ChildListCollection")), import_react = __toESM(require("react")), import_clamp = __toESM(require("../Utilities/clamp")), import_VirtualizeUtils = require("../VirtualizeUtils"), import_Batchinator = __toESM(require("../../../Batchinator")), import_RefreshControl = __toESM(require("../../../RefreshControl"));
|
|
30
|
+
function _assert_this_initialized(self) {
|
|
31
|
+
if (self === void 0)
|
|
32
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
33
|
+
return self;
|
|
34
|
+
}
|
|
35
|
+
function _call_super(_this, derived, args) {
|
|
36
|
+
return derived = _get_prototype_of(derived), _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
37
|
+
}
|
|
38
|
+
function _class_call_check(instance, Constructor) {
|
|
39
|
+
if (!(instance instanceof Constructor))
|
|
40
|
+
throw new TypeError("Cannot call a class as a function");
|
|
41
|
+
}
|
|
42
|
+
function _defineProperties(target, props) {
|
|
43
|
+
for (var i = 0; i < props.length; i++) {
|
|
44
|
+
var descriptor = props[i];
|
|
45
|
+
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
49
|
+
return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;
|
|
50
|
+
}
|
|
51
|
+
function _define_property(obj, key, value) {
|
|
52
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
53
|
+
value,
|
|
54
|
+
enumerable: !0,
|
|
55
|
+
configurable: !0,
|
|
56
|
+
writable: !0
|
|
57
|
+
}) : obj[key] = value, obj;
|
|
58
|
+
}
|
|
59
|
+
function _get_prototype_of(o) {
|
|
60
|
+
return _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function(o2) {
|
|
61
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
62
|
+
}, _get_prototype_of(o);
|
|
63
|
+
}
|
|
64
|
+
function _inherits(subClass, superClass) {
|
|
65
|
+
if (typeof superClass != "function" && superClass !== null)
|
|
66
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
67
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
68
|
+
constructor: {
|
|
69
|
+
value: subClass,
|
|
70
|
+
writable: !0,
|
|
71
|
+
configurable: !0
|
|
72
|
+
}
|
|
73
|
+
}), superClass && _set_prototype_of(subClass, superClass);
|
|
74
|
+
}
|
|
75
|
+
function _possible_constructor_return(self, call) {
|
|
76
|
+
return call && (_type_of(call) === "object" || typeof call == "function") ? call : _assert_this_initialized(self);
|
|
77
|
+
}
|
|
78
|
+
function _set_prototype_of(o, p) {
|
|
79
|
+
return _set_prototype_of = Object.setPrototypeOf || function(o2, p2) {
|
|
80
|
+
return o2.__proto__ = p2, o2;
|
|
81
|
+
}, _set_prototype_of(o, p);
|
|
82
|
+
}
|
|
83
|
+
function _type_of(obj) {
|
|
84
|
+
"@swc/helpers - typeof";
|
|
85
|
+
return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
86
|
+
}
|
|
87
|
+
function _is_native_reflect_construct() {
|
|
88
|
+
try {
|
|
89
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
90
|
+
}));
|
|
91
|
+
} catch {
|
|
92
|
+
}
|
|
93
|
+
return (_is_native_reflect_construct = function() {
|
|
94
|
+
return !!result;
|
|
95
|
+
})();
|
|
96
|
+
}
|
|
97
|
+
var __DEV__ = process.env.NODE_ENV !== "production", ON_EDGE_REACHED_EPSILON = 1e-3, _usedIndexForKey = !1, _keylessItemComponentName = "";
|
|
98
|
+
function horizontalOrDefault(horizontal) {
|
|
99
|
+
return horizontal ?? !1;
|
|
100
|
+
}
|
|
101
|
+
function initialNumToRenderOrDefault(initialNumToRender) {
|
|
102
|
+
return initialNumToRender ?? 10;
|
|
103
|
+
}
|
|
104
|
+
function maxToRenderPerBatchOrDefault(maxToRenderPerBatch) {
|
|
105
|
+
return maxToRenderPerBatch ?? 10;
|
|
106
|
+
}
|
|
107
|
+
function onStartReachedThresholdOrDefault(onStartReachedThreshold) {
|
|
108
|
+
return onStartReachedThreshold ?? 2;
|
|
109
|
+
}
|
|
110
|
+
function onEndReachedThresholdOrDefault(onEndReachedThreshold) {
|
|
111
|
+
return onEndReachedThreshold ?? 2;
|
|
112
|
+
}
|
|
113
|
+
function getScrollingThreshold(threshold, visibleLength) {
|
|
114
|
+
return threshold * visibleLength / 2;
|
|
115
|
+
}
|
|
116
|
+
function scrollEventThrottleOrDefault(scrollEventThrottle) {
|
|
117
|
+
return scrollEventThrottle ?? 50;
|
|
118
|
+
}
|
|
119
|
+
function windowSizeOrDefault(windowSize) {
|
|
120
|
+
return windowSize ?? 21;
|
|
121
|
+
}
|
|
122
|
+
function findLastWhere(arr, predicate) {
|
|
123
|
+
for (var i = arr.length - 1; i >= 0; i--)
|
|
124
|
+
if (predicate(arr[i]))
|
|
125
|
+
return arr[i];
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
|
|
129
|
+
"use strict";
|
|
130
|
+
_inherits(VirtualizedList2, StateSafePureComponent2);
|
|
131
|
+
function VirtualizedList2(props) {
|
|
132
|
+
_class_call_check(this, VirtualizedList2);
|
|
133
|
+
var _this;
|
|
134
|
+
_this = _call_super(this, VirtualizedList2, [
|
|
135
|
+
props
|
|
136
|
+
]), _define_property(_this, "_getScrollMetrics", function() {
|
|
137
|
+
return _this._scrollMetrics;
|
|
138
|
+
}), _define_property(_this, "_getOutermostParentListRef", function() {
|
|
139
|
+
return _this._isNestedWithSameOrientation() ? _this.context.getOutermostParentListRef() : _this;
|
|
140
|
+
}), _define_property(_this, "_registerAsNestedChild", function(childList) {
|
|
141
|
+
_this._nestedChildLists.add(childList.ref, childList.cellKey), _this._hasInteracted && childList.ref.recordInteraction();
|
|
142
|
+
}), _define_property(_this, "_unregisterAsNestedChild", function(childList) {
|
|
143
|
+
_this._nestedChildLists.remove(childList.ref);
|
|
144
|
+
}), _define_property(_this, "invertedWheelEventHandler", void 0), _define_property(_this, "_onUpdateSeparators", function(keys, newProps) {
|
|
145
|
+
keys.forEach(function(key) {
|
|
146
|
+
var ref = key != null && _this._cellRefs[key];
|
|
147
|
+
ref && ref.updateSeparatorProps(newProps);
|
|
148
|
+
});
|
|
149
|
+
}), _define_property(_this, "_getSpacerKey", function(isVertical) {
|
|
150
|
+
return isVertical ? "height" : "width";
|
|
151
|
+
}), _define_property(_this, "_averageCellLength", 0), _define_property(_this, "_cellRefs", {}), _define_property(_this, "_fillRateHelper", void 0), _define_property(_this, "_frames", {}), _define_property(_this, "_footerLength", 0), _define_property(_this, "_hasTriggeredInitialScrollToIndex", !1), _define_property(_this, "_hasInteracted", !1), _define_property(_this, "_hasMore", !1), _define_property(_this, "_hasWarned", {}), _define_property(_this, "_headerLength", 0), _define_property(_this, "_hiPriInProgress", !1), _define_property(_this, "_highestMeasuredFrameIndex", 0), _define_property(_this, "_indicesToKeys", /* @__PURE__ */ new Map()), _define_property(_this, "_lastFocusedCellKey", null), _define_property(_this, "_nestedChildLists", new import_ChildListCollection.default()), _define_property(_this, "_offsetFromParentVirtualizedList", 0), _define_property(_this, "_prevParentOffset", 0), _define_property(_this, "_scrollMetrics", {
|
|
152
|
+
contentLength: 0,
|
|
153
|
+
dOffset: 0,
|
|
154
|
+
dt: 10,
|
|
155
|
+
offset: 0,
|
|
156
|
+
timestamp: 0,
|
|
157
|
+
velocity: 0,
|
|
158
|
+
visibleLength: 0,
|
|
159
|
+
zoomScale: 1
|
|
160
|
+
}), _define_property(_this, "_scrollRef", null), _define_property(_this, "_sentStartForContentLength", 0), _define_property(_this, "_sentEndForContentLength", 0), _define_property(_this, "_totalCellLength", 0), _define_property(_this, "_totalCellsMeasured", 0), _define_property(_this, "_updateCellsToRenderBatcher", void 0), _define_property(_this, "_viewabilityTuples", []), _define_property(_this, "_captureScrollRef", function(ref) {
|
|
161
|
+
_this._scrollRef = ref;
|
|
162
|
+
}), _define_property(_this, "_defaultRenderScrollComponent", function(props2) {
|
|
163
|
+
var onRefresh = props2.onRefresh;
|
|
164
|
+
if (_this._isNestedWithSameOrientation())
|
|
165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_View.default, {
|
|
166
|
+
...props2
|
|
167
|
+
});
|
|
168
|
+
if (onRefresh) {
|
|
169
|
+
var _props_refreshing;
|
|
170
|
+
return (0, import_react_native_web_internals.invariant)(typeof props2.refreshing == "boolean", "`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `" + JSON.stringify((_props_refreshing = props2.refreshing) !== null && _props_refreshing !== void 0 ? _props_refreshing : "undefined") + "`"), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ScrollViewBase.default, {
|
|
171
|
+
...props2,
|
|
172
|
+
refreshControl: props2.refreshControl == null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_RefreshControl.default, {
|
|
173
|
+
refreshing: props2.refreshing,
|
|
174
|
+
onRefresh,
|
|
175
|
+
progressViewOffset: props2.progressViewOffset
|
|
176
|
+
}) : props2.refreshControl
|
|
177
|
+
});
|
|
178
|
+
} else
|
|
179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ScrollViewBase.default, {
|
|
180
|
+
...props2
|
|
181
|
+
});
|
|
182
|
+
}), _define_property(_this, "_onCellLayout", function(e, cellKey, index) {
|
|
183
|
+
var layout = e.nativeEvent.layout, next = {
|
|
184
|
+
offset: _this._selectOffset(layout),
|
|
185
|
+
length: _this._selectLength(layout),
|
|
186
|
+
index,
|
|
187
|
+
inLayout: !0
|
|
188
|
+
}, curr = _this._frames[cellKey];
|
|
189
|
+
!curr || next.offset !== curr.offset || next.length !== curr.length || index !== curr.index ? (_this._totalCellLength += next.length - (curr ? curr.length : 0), _this._totalCellsMeasured += curr ? 0 : 1, _this._averageCellLength = _this._totalCellLength / _this._totalCellsMeasured, _this._frames[cellKey] = next, _this._highestMeasuredFrameIndex = Math.max(_this._highestMeasuredFrameIndex, index), _this._scheduleCellsToRenderUpdate()) : _this._frames[cellKey].inLayout = !0, _this._triggerRemeasureForChildListsInCell(cellKey), _this._computeBlankness(), _this._updateViewableItems(
|
|
190
|
+
// @ts-ignore
|
|
191
|
+
_this.props,
|
|
192
|
+
_this.state.cellsAroundViewport
|
|
193
|
+
);
|
|
194
|
+
}), _define_property(_this, "_onCellUnmount", function(cellKey) {
|
|
195
|
+
delete _this._cellRefs[cellKey];
|
|
196
|
+
var curr = _this._frames[cellKey];
|
|
197
|
+
curr && (_this._frames[cellKey] = {
|
|
198
|
+
...curr,
|
|
199
|
+
inLayout: !1
|
|
200
|
+
});
|
|
201
|
+
}), _define_property(_this, "_onLayout", function(e) {
|
|
202
|
+
_this._isNestedWithSameOrientation() ? _this.measureLayoutRelativeToContainingList() : _this._scrollMetrics.visibleLength = _this._selectLength(e.nativeEvent.layout), _this.props.onLayout && _this.props.onLayout(e), _this._scheduleCellsToRenderUpdate(), _this._maybeCallOnEdgeReached();
|
|
203
|
+
}), _define_property(_this, "_onLayoutEmpty", function(e) {
|
|
204
|
+
_this.props.onLayout && _this.props.onLayout(e);
|
|
205
|
+
}), _define_property(_this, "_onLayoutFooter", function(e) {
|
|
206
|
+
_this._triggerRemeasureForChildListsInCell(_this._getFooterCellKey()), _this._footerLength = _this._selectLength(e.nativeEvent.layout);
|
|
207
|
+
}), _define_property(_this, "_onLayoutHeader", function(e) {
|
|
208
|
+
_this._headerLength = _this._selectLength(e.nativeEvent.layout);
|
|
209
|
+
}), _define_property(_this, "_onContentSizeChange", function(width, height) {
|
|
210
|
+
width > 0 && height > 0 && _this.props.initialScrollIndex != null && _this.props.initialScrollIndex > 0 && !_this._hasTriggeredInitialScrollToIndex && (_this.props.contentOffset == null && (_this.props.initialScrollIndex < _this.props.getItemCount(_this.props.data) ? _this.scrollToIndex({
|
|
211
|
+
animated: !1,
|
|
212
|
+
index: nullthrows(_this.props.initialScrollIndex)
|
|
213
|
+
}) : _this.scrollToEnd({
|
|
214
|
+
animated: !1
|
|
215
|
+
})), _this._hasTriggeredInitialScrollToIndex = !0), _this.props.onContentSizeChange && _this.props.onContentSizeChange(width, height), _this._scrollMetrics.contentLength = _this._selectLength({
|
|
216
|
+
height,
|
|
217
|
+
width
|
|
218
|
+
}), _this._scheduleCellsToRenderUpdate(), _this._maybeCallOnEdgeReached();
|
|
219
|
+
}), _define_property(_this, "_convertParentScrollMetrics", function(metrics) {
|
|
220
|
+
var offset = metrics.offset - _this._offsetFromParentVirtualizedList, visibleLength = metrics.visibleLength, dOffset = offset - _this._scrollMetrics.offset, contentLength = _this._scrollMetrics.contentLength;
|
|
221
|
+
return {
|
|
222
|
+
visibleLength,
|
|
223
|
+
contentLength,
|
|
224
|
+
offset,
|
|
225
|
+
dOffset
|
|
226
|
+
};
|
|
227
|
+
}), _define_property(_this, "_onScroll", function(e) {
|
|
228
|
+
_this._nestedChildLists.forEach(function(childList) {
|
|
229
|
+
childList._onScroll(e);
|
|
230
|
+
}), _this.props.onScroll && _this.props.onScroll(e);
|
|
231
|
+
var timestamp = e.timeStamp, visibleLength = _this._selectLength(e.nativeEvent.layoutMeasurement), contentLength = _this._selectLength(e.nativeEvent.contentSize), offset = _this._selectOffset(e.nativeEvent.contentOffset), dOffset = offset - _this._scrollMetrics.offset;
|
|
232
|
+
if (_this._isNestedWithSameOrientation()) {
|
|
233
|
+
if (_this._scrollMetrics.contentLength === 0)
|
|
234
|
+
return;
|
|
235
|
+
({ visibleLength, contentLength, offset, dOffset } = _this._convertParentScrollMetrics({
|
|
236
|
+
visibleLength,
|
|
237
|
+
offset
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
var dt = _this._scrollMetrics.timestamp ? Math.max(1, timestamp - _this._scrollMetrics.timestamp) : 1, velocity = dOffset / dt;
|
|
241
|
+
dt > 500 && _this._scrollMetrics.dt > 500 && contentLength > 5 * visibleLength && !_this._hasWarned.perf && (infoLog("VirtualizedList: You have a large list that is slow to update - make sure your renderItem function renders components that follow React performance best practices like PureComponent, shouldComponentUpdate, etc.", {
|
|
242
|
+
dt,
|
|
243
|
+
prevDt: _this._scrollMetrics.dt,
|
|
244
|
+
contentLength
|
|
245
|
+
}), _this._hasWarned.perf = !0);
|
|
246
|
+
var zoomScale = e.nativeEvent.zoomScale < 0 ? 1 : e.nativeEvent.zoomScale;
|
|
247
|
+
_this._scrollMetrics = {
|
|
248
|
+
contentLength,
|
|
249
|
+
dt,
|
|
250
|
+
dOffset,
|
|
251
|
+
offset,
|
|
252
|
+
timestamp,
|
|
253
|
+
velocity,
|
|
254
|
+
visibleLength,
|
|
255
|
+
zoomScale
|
|
256
|
+
}, _this._updateViewableItems(_this.props, _this.state.cellsAroundViewport), _this.props && (_this._maybeCallOnEdgeReached(), velocity !== 0 && _this._fillRateHelper.activate(), _this._computeBlankness(), _this._scheduleCellsToRenderUpdate());
|
|
257
|
+
}), _define_property(_this, "_onScrollBeginDrag", function(e) {
|
|
258
|
+
_this._nestedChildLists.forEach(function(childList) {
|
|
259
|
+
childList._onScrollBeginDrag(e);
|
|
260
|
+
}), _this._viewabilityTuples.forEach(function(tuple) {
|
|
261
|
+
tuple.viewabilityHelper.recordInteraction();
|
|
262
|
+
}), _this._hasInteracted = !0, _this.props.onScrollBeginDrag && _this.props.onScrollBeginDrag(e);
|
|
263
|
+
}), _define_property(_this, "_onScrollEndDrag", function(e) {
|
|
264
|
+
_this._nestedChildLists.forEach(function(childList) {
|
|
265
|
+
childList._onScrollEndDrag(e);
|
|
266
|
+
});
|
|
267
|
+
var { velocity } = e.nativeEvent;
|
|
268
|
+
velocity && (_this._scrollMetrics.velocity = _this._selectOffset(velocity)), _this._computeBlankness(), _this.props.onScrollEndDrag && _this.props.onScrollEndDrag(e);
|
|
269
|
+
}), _define_property(_this, "_onMomentumScrollBegin", function(e) {
|
|
270
|
+
_this._nestedChildLists.forEach(function(childList) {
|
|
271
|
+
childList._onMomentumScrollBegin(e);
|
|
272
|
+
}), _this.props.onMomentumScrollBegin && _this.props.onMomentumScrollBegin(e);
|
|
273
|
+
}), _define_property(_this, "_onMomentumScrollEnd", function(e) {
|
|
274
|
+
_this._nestedChildLists.forEach(function(childList) {
|
|
275
|
+
childList._onMomentumScrollEnd(e);
|
|
276
|
+
}), _this._scrollMetrics.velocity = 0, _this._computeBlankness(), _this.props.onMomentumScrollEnd && _this.props.onMomentumScrollEnd(e);
|
|
277
|
+
}), _define_property(_this, "_updateCellsToRender", function() {
|
|
278
|
+
_this._updateViewableItems(_this.props, _this.state.cellsAroundViewport), _this.setState(function(state, props2) {
|
|
279
|
+
var cellsAroundViewport = _this._adjustCellsAroundViewport(props2, state.cellsAroundViewport), renderMask = VirtualizedList2._createRenderMask(props2, cellsAroundViewport, _this._getNonViewportRenderRegions(props2));
|
|
280
|
+
return cellsAroundViewport.first === state.cellsAroundViewport.first && cellsAroundViewport.last === state.cellsAroundViewport.last && renderMask.equals(state.renderMask) ? null : {
|
|
281
|
+
cellsAroundViewport,
|
|
282
|
+
renderMask
|
|
283
|
+
};
|
|
284
|
+
});
|
|
285
|
+
}), _define_property(_this, "_createViewToken", function(index, isViewable, props2) {
|
|
286
|
+
var { data, getItem } = props2, item = getItem(data, index);
|
|
287
|
+
return {
|
|
288
|
+
index,
|
|
289
|
+
item,
|
|
290
|
+
key: _this._keyExtractor(item, index, props2),
|
|
291
|
+
isViewable
|
|
292
|
+
};
|
|
293
|
+
}), _define_property(_this, "_getOffsetApprox", function(index, props2) {
|
|
294
|
+
if (Number.isInteger(index))
|
|
295
|
+
return _this.__getFrameMetricsApprox(index, props2).offset;
|
|
296
|
+
var frameMetrics = _this.__getFrameMetricsApprox(Math.floor(index), props2), remainder = index - Math.floor(index);
|
|
297
|
+
return frameMetrics.offset + remainder * frameMetrics.length;
|
|
298
|
+
}), _define_property(_this, "__getFrameMetricsApprox", function(index, props2) {
|
|
299
|
+
var frame = _this._getFrameMetrics(index, props2);
|
|
300
|
+
if (frame && frame.index === index)
|
|
301
|
+
return frame;
|
|
302
|
+
var { data, getItemCount, getItemLayout } = props2;
|
|
303
|
+
return (0, import_react_native_web_internals.invariant)(index >= 0 && index < getItemCount(data), "Tried to get frame for out of range index " + index), (0, import_react_native_web_internals.invariant)(!getItemLayout, "Should not have to estimate frames when a measurement metrics function is provided"), {
|
|
304
|
+
length: _this._averageCellLength,
|
|
305
|
+
offset: _this._averageCellLength * index
|
|
306
|
+
};
|
|
307
|
+
}), _define_property(_this, "_getFrameMetrics", function(index, props2) {
|
|
308
|
+
var { data, getItem, getItemCount, getItemLayout } = props2;
|
|
309
|
+
(0, import_react_native_web_internals.invariant)(index >= 0 && index < getItemCount(data), "Tried to get frame for out of range index " + index);
|
|
310
|
+
var item = getItem(data, index), frame = _this._frames[_this._keyExtractor(item, index, props2)];
|
|
311
|
+
return (!frame || frame.index !== index) && getItemLayout ? getItemLayout(data, index) : frame;
|
|
312
|
+
}), _define_property(_this, "_getNonViewportRenderRegions", function(props2) {
|
|
313
|
+
if (!(_this._lastFocusedCellKey && _this._cellRefs[_this._lastFocusedCellKey]))
|
|
314
|
+
return [];
|
|
315
|
+
var lastFocusedCellRenderer = _this._cellRefs[_this._lastFocusedCellKey], focusedCellIndex = lastFocusedCellRenderer.props.index, itemCount = props2.getItemCount(props2.data);
|
|
316
|
+
if (focusedCellIndex >= itemCount || _this._keyExtractor(props2.getItem(props2.data, focusedCellIndex), focusedCellIndex, props2) !== _this._lastFocusedCellKey)
|
|
317
|
+
return [];
|
|
318
|
+
for (var first = focusedCellIndex, heightOfCellsBeforeFocused = 0, i = first - 1; i >= 0 && heightOfCellsBeforeFocused < _this._scrollMetrics.visibleLength; i--)
|
|
319
|
+
first--, heightOfCellsBeforeFocused += _this.__getFrameMetricsApprox(i, props2).length;
|
|
320
|
+
for (var last = focusedCellIndex, heightOfCellsAfterFocused = 0, i1 = last + 1; i1 < itemCount && heightOfCellsAfterFocused < _this._scrollMetrics.visibleLength; i1++)
|
|
321
|
+
last++, heightOfCellsAfterFocused += _this.__getFrameMetricsApprox(i1, props2).length;
|
|
322
|
+
return [
|
|
323
|
+
{
|
|
324
|
+
first,
|
|
325
|
+
last
|
|
326
|
+
}
|
|
327
|
+
];
|
|
328
|
+
}), _this._checkProps(props), _this._fillRateHelper = new import_FillRateHelper.default(_this._getFrameMetrics);
|
|
329
|
+
var _this_props_updateCellsBatchingPeriod;
|
|
330
|
+
if (_this._updateCellsToRenderBatcher = new import_Batchinator.default(_this._updateCellsToRender, (_this_props_updateCellsBatchingPeriod = _this.props.updateCellsBatchingPeriod) !== null && _this_props_updateCellsBatchingPeriod !== void 0 ? _this_props_updateCellsBatchingPeriod : 50), _this.props.viewabilityConfigCallbackPairs)
|
|
331
|
+
_this._viewabilityTuples = _this.props.viewabilityConfigCallbackPairs.map(function(pair) {
|
|
332
|
+
return {
|
|
333
|
+
viewabilityHelper: new import_ViewabilityHelper.default(pair.viewabilityConfig),
|
|
334
|
+
onViewableItemsChanged: pair.onViewableItemsChanged
|
|
335
|
+
};
|
|
336
|
+
});
|
|
337
|
+
else {
|
|
338
|
+
var { onViewableItemsChanged, viewabilityConfig } = _this.props;
|
|
339
|
+
onViewableItemsChanged && _this._viewabilityTuples.push({
|
|
340
|
+
viewabilityHelper: new import_ViewabilityHelper.default(viewabilityConfig),
|
|
341
|
+
onViewableItemsChanged
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
var initialRenderRegion = VirtualizedList2._initialRenderRegion(props);
|
|
345
|
+
return _this.state = {
|
|
346
|
+
cellsAroundViewport: initialRenderRegion,
|
|
347
|
+
renderMask: VirtualizedList2._createRenderMask(props, initialRenderRegion)
|
|
348
|
+
}, _this.invertedWheelEventHandler = function(ev) {
|
|
349
|
+
var scrollOffset = _this.props.horizontal ? ev.target.scrollLeft : ev.target.scrollTop, scrollLength = _this.props.horizontal ? ev.target.scrollWidth : ev.target.scrollHeight, clientLength = _this.props.horizontal ? ev.target.clientWidth : ev.target.clientHeight, isEventTargetScrollable = scrollLength > clientLength, delta = _this.props.horizontal ? ev.deltaX || ev.wheelDeltaX : ev.deltaY || ev.wheelDeltaY, leftoverDelta = delta;
|
|
350
|
+
isEventTargetScrollable && (leftoverDelta = delta < 0 ? Math.min(delta + scrollOffset, 0) : Math.max(delta - (scrollLength - clientLength - scrollOffset), 0));
|
|
351
|
+
var targetDelta = delta - leftoverDelta;
|
|
352
|
+
if (_this.props.inverted && _this._scrollRef && _this._scrollRef.getScrollableNode) {
|
|
353
|
+
var node = _this._scrollRef.getScrollableNode();
|
|
354
|
+
if (_this.props.horizontal) {
|
|
355
|
+
ev.target.scrollLeft += targetDelta;
|
|
356
|
+
var nextScrollLeft = node.scrollLeft - leftoverDelta;
|
|
357
|
+
node.scrollLeft = _this.props.getItemLayout ? nextScrollLeft : Math.min(nextScrollLeft, _this._totalCellLength);
|
|
358
|
+
} else {
|
|
359
|
+
ev.target.scrollTop += targetDelta;
|
|
360
|
+
var nextScrollTop = node.scrollTop - leftoverDelta;
|
|
361
|
+
node.scrollTop = _this.props.getItemLayout ? nextScrollTop : Math.min(nextScrollTop, _this._totalCellLength);
|
|
362
|
+
}
|
|
363
|
+
ev.preventDefault();
|
|
364
|
+
}
|
|
365
|
+
}, _this;
|
|
366
|
+
}
|
|
367
|
+
return _create_class(VirtualizedList2, [
|
|
368
|
+
{
|
|
369
|
+
// scrollToEnd may be janky without getItemLayout prop
|
|
370
|
+
key: "scrollToEnd",
|
|
371
|
+
value: function(params) {
|
|
372
|
+
var animated = params ? params.animated : !0, veryLast = this.props.getItemCount(this.props.data) - 1;
|
|
373
|
+
if (!(veryLast < 0)) {
|
|
374
|
+
var frame = this.__getFrameMetricsApprox(veryLast, this.props), offset = Math.max(0, frame.offset + frame.length + this._footerLength - this._scrollMetrics.visibleLength);
|
|
375
|
+
if (this._scrollRef != null) {
|
|
376
|
+
if (this._scrollRef.scrollTo == null) {
|
|
377
|
+
console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo.");
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
this._scrollRef.scrollTo(horizontalOrDefault(this.props.horizontal) ? {
|
|
381
|
+
x: offset,
|
|
382
|
+
animated
|
|
383
|
+
} : {
|
|
384
|
+
y: offset,
|
|
385
|
+
animated
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
// scrollToIndex may be janky without getItemLayout prop
|
|
393
|
+
key: "scrollToIndex",
|
|
394
|
+
value: function(params) {
|
|
395
|
+
var { data, horizontal, getItemCount, getItemLayout, onScrollToIndexFailed } = this.props, { animated, index, viewOffset, viewPosition } = params;
|
|
396
|
+
if ((0, import_react_native_web_internals.invariant)(index >= 0, `scrollToIndex out of range: requested index ${index} but minimum is 0`), (0, import_react_native_web_internals.invariant)(getItemCount(data) >= 1, `scrollToIndex out of range: item length ${getItemCount(data)} but minimum is 1`), (0, import_react_native_web_internals.invariant)(index < getItemCount(data), `scrollToIndex out of range: requested index ${index} is out of 0 to ${getItemCount(data) - 1}`), !getItemLayout && index > this._highestMeasuredFrameIndex) {
|
|
397
|
+
(0, import_react_native_web_internals.invariant)(!!onScrollToIndexFailed, "scrollToIndex should be used in conjunction with getItemLayout or onScrollToIndexFailed, otherwise there is no way to know the location of offscreen indices or handle failures."), onScrollToIndexFailed({
|
|
398
|
+
averageItemLength: this._averageCellLength,
|
|
399
|
+
highestMeasuredFrameIndex: this._highestMeasuredFrameIndex,
|
|
400
|
+
index
|
|
401
|
+
});
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
var frame = this.__getFrameMetricsApprox(Math.floor(index), this.props), offset = Math.max(
|
|
405
|
+
0,
|
|
406
|
+
// @ts-ignore
|
|
407
|
+
this._getOffsetApprox(index, this.props) - (viewPosition || 0) * (this._scrollMetrics.visibleLength - frame.length)
|
|
408
|
+
) - (viewOffset || 0);
|
|
409
|
+
if (this._scrollRef != null) {
|
|
410
|
+
if (this._scrollRef.scrollTo == null) {
|
|
411
|
+
console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo.");
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
this._scrollRef.scrollTo(horizontal ? {
|
|
415
|
+
x: offset,
|
|
416
|
+
animated
|
|
417
|
+
} : {
|
|
418
|
+
y: offset,
|
|
419
|
+
animated
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
// scrollToItem may be janky without getItemLayout prop. Required linear scan through items -
|
|
426
|
+
// use scrollToIndex instead if possible.
|
|
427
|
+
key: "scrollToItem",
|
|
428
|
+
value: function(params) {
|
|
429
|
+
for (var { item } = params, { data, getItem, getItemCount } = this.props, itemCount = getItemCount(data), index = 0; index < itemCount; index++)
|
|
430
|
+
if (getItem(data, index) === item) {
|
|
431
|
+
this.scrollToIndex({
|
|
432
|
+
...params,
|
|
433
|
+
index
|
|
434
|
+
});
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
/**
|
|
441
|
+
* Scroll to a specific content pixel offset in the list.
|
|
442
|
+
*
|
|
443
|
+
* Param `offset` expects the offset to scroll to.
|
|
444
|
+
* In case of `horizontal` is true, the offset is the x-value,
|
|
445
|
+
* in any other case the offset is the y-value.
|
|
446
|
+
*
|
|
447
|
+
* Param `animated` (`true` by default) defines whether the list
|
|
448
|
+
* should do an animation while scrolling.
|
|
449
|
+
*/
|
|
450
|
+
key: "scrollToOffset",
|
|
451
|
+
value: function(params) {
|
|
452
|
+
var { animated, offset } = params;
|
|
453
|
+
if (this._scrollRef != null) {
|
|
454
|
+
if (this._scrollRef.scrollTo == null) {
|
|
455
|
+
console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo.");
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
this._scrollRef.scrollTo(horizontalOrDefault(this.props.horizontal) ? {
|
|
459
|
+
x: offset,
|
|
460
|
+
animated
|
|
461
|
+
} : {
|
|
462
|
+
y: offset,
|
|
463
|
+
animated
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
key: "recordInteraction",
|
|
470
|
+
value: function() {
|
|
471
|
+
this._nestedChildLists.forEach(function(childList) {
|
|
472
|
+
childList.recordInteraction();
|
|
473
|
+
}), this._viewabilityTuples.forEach(function(t) {
|
|
474
|
+
t.viewabilityHelper.recordInteraction();
|
|
475
|
+
}), this._updateViewableItems(this.props, this.state.cellsAroundViewport);
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
key: "flashScrollIndicators",
|
|
480
|
+
value: function() {
|
|
481
|
+
this._scrollRef != null && this._scrollRef.flashScrollIndicators();
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
/**
|
|
486
|
+
* Provides a handle to the underlying scroll responder.
|
|
487
|
+
* Note that `this._scrollRef` might not be a `ScrollView`, so we
|
|
488
|
+
* need to check that it responds to `getScrollResponder` before calling it.
|
|
489
|
+
*/
|
|
490
|
+
key: "getScrollResponder",
|
|
491
|
+
value: function() {
|
|
492
|
+
return this._scrollRef && this._scrollRef.getScrollResponder ? this._scrollRef.getScrollResponder() : null;
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
key: "getScrollableNode",
|
|
497
|
+
value: function() {
|
|
498
|
+
return this._scrollRef && this._scrollRef.getScrollableNode ? this._scrollRef.getScrollableNode() : this._scrollRef;
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
key: "getScrollRef",
|
|
503
|
+
value: function() {
|
|
504
|
+
return this._scrollRef && this._scrollRef.getScrollRef ? this._scrollRef.getScrollRef() : this._scrollRef;
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
key: "_getCellKey",
|
|
509
|
+
value: function() {
|
|
510
|
+
var _this_context;
|
|
511
|
+
return ((_this_context = this.context) === null || _this_context === void 0 ? void 0 : _this_context.cellKey) || "rootList";
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
key: "hasMore",
|
|
516
|
+
value: function() {
|
|
517
|
+
return this._hasMore;
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
key: "_checkProps",
|
|
522
|
+
value: function(props) {
|
|
523
|
+
var { onScroll, windowSize, getItemCount, data, initialScrollIndex } = props;
|
|
524
|
+
(0, import_react_native_web_internals.invariant)(!(onScroll && onScroll.__isNative), "Components based on VirtualizedList must be wrapped with Animated.createAnimatedComponent to support native onScroll events with useNativeDriver"), (0, import_react_native_web_internals.invariant)(windowSizeOrDefault(windowSize) > 0, "VirtualizedList: The windowSize prop must be present and set to a value greater than 0."), (0, import_react_native_web_internals.invariant)(getItemCount, 'VirtualizedList: The "getItemCount" prop must be provided');
|
|
525
|
+
var itemCount = getItemCount(data);
|
|
526
|
+
if (initialScrollIndex != null && !this._hasTriggeredInitialScrollToIndex && (initialScrollIndex < 0 || itemCount > 0 && initialScrollIndex >= itemCount) && !this._hasWarned.initialScrollIndex && (console.warn(`initialScrollIndex "${initialScrollIndex}" is not valid (list has ${itemCount} items)`), this._hasWarned.initialScrollIndex = !0), __DEV__ && !this._hasWarned.flexWrap) {
|
|
527
|
+
var flatStyles = import_react_native_web_internals.StyleSheet.flatten(this.props.contentContainerStyle);
|
|
528
|
+
flatStyles != null && flatStyles.flexWrap === "wrap" && (console.warn("`flexWrap: `wrap`` is not supported with the `VirtualizedList` components.Consider using `numColumns` with `FlatList` instead."), this._hasWarned.flexWrap = !0);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
key: "_adjustCellsAroundViewport",
|
|
534
|
+
value: function(props, cellsAroundViewport) {
|
|
535
|
+
var { data, getItemCount } = props, onEndReachedThreshold = onEndReachedThresholdOrDefault(props.onEndReachedThreshold), { contentLength, offset, visibleLength } = this._scrollMetrics, distanceFromEnd = contentLength - visibleLength - offset;
|
|
536
|
+
if (visibleLength <= 0 || contentLength <= 0)
|
|
537
|
+
return cellsAroundViewport.last >= getItemCount(data) ? VirtualizedList2._constrainToItemCount(cellsAroundViewport, props) : cellsAroundViewport;
|
|
538
|
+
var newCellsAroundViewport;
|
|
539
|
+
if (props.disableVirtualization) {
|
|
540
|
+
var renderAhead = distanceFromEnd < onEndReachedThreshold * visibleLength ? maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch) : 0;
|
|
541
|
+
newCellsAroundViewport = {
|
|
542
|
+
first: 0,
|
|
543
|
+
last: Math.min(cellsAroundViewport.last + renderAhead, getItemCount(data) - 1)
|
|
544
|
+
};
|
|
545
|
+
} else {
|
|
546
|
+
if (props.initialScrollIndex && !this._scrollMetrics.offset && Math.abs(distanceFromEnd) >= Number.EPSILON)
|
|
547
|
+
return cellsAroundViewport.last >= getItemCount(data) ? VirtualizedList2._constrainToItemCount(cellsAroundViewport, props) : cellsAroundViewport;
|
|
548
|
+
newCellsAroundViewport = computeWindowedRenderLimits(props, maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch), windowSizeOrDefault(props.windowSize), cellsAroundViewport, this.__getFrameMetricsApprox, this._scrollMetrics), (0, import_react_native_web_internals.invariant)(newCellsAroundViewport.last < getItemCount(data), "computeWindowedRenderLimits() should return range in-bounds");
|
|
549
|
+
}
|
|
550
|
+
if (this._nestedChildLists.size() > 0) {
|
|
551
|
+
var childIdx = this._findFirstChildWithMore(newCellsAroundViewport.first, newCellsAroundViewport.last);
|
|
552
|
+
newCellsAroundViewport.last = childIdx ?? newCellsAroundViewport.last;
|
|
553
|
+
}
|
|
554
|
+
return newCellsAroundViewport;
|
|
555
|
+
}
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
key: "_findFirstChildWithMore",
|
|
559
|
+
value: function(first, last) {
|
|
560
|
+
for (var ii = first; ii <= last; ii++) {
|
|
561
|
+
var cellKeyForIndex = this._indicesToKeys.get(ii);
|
|
562
|
+
if (cellKeyForIndex != null && this._nestedChildLists.anyInCell(cellKeyForIndex, function(childList) {
|
|
563
|
+
return childList.hasMore();
|
|
564
|
+
}))
|
|
565
|
+
return ii;
|
|
566
|
+
}
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
key: "componentDidMount",
|
|
572
|
+
value: function() {
|
|
573
|
+
this._isNestedWithSameOrientation() && this.context.registerAsNestedChild({
|
|
574
|
+
ref: this,
|
|
575
|
+
cellKey: this.context.cellKey
|
|
576
|
+
}), this.setupWebWheelHandler();
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
key: "componentWillUnmount",
|
|
581
|
+
value: function() {
|
|
582
|
+
this._isNestedWithSameOrientation() && this.context.unregisterAsNestedChild({
|
|
583
|
+
ref: this
|
|
584
|
+
}), this._updateCellsToRenderBatcher.dispose({
|
|
585
|
+
abort: !0
|
|
586
|
+
}), this._viewabilityTuples.forEach(function(tuple) {
|
|
587
|
+
tuple.viewabilityHelper.dispose();
|
|
588
|
+
}), this._fillRateHelper.deactivateAndFlush(), this.teardownWebWheelHandler();
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
key: "setupWebWheelHandler",
|
|
593
|
+
value: function() {
|
|
594
|
+
var _this = this;
|
|
595
|
+
if (this._scrollRef && this._scrollRef.getScrollableNode)
|
|
596
|
+
this._scrollRef.getScrollableNode().addEventListener("wheel", this.invertedWheelEventHandler);
|
|
597
|
+
else {
|
|
598
|
+
setTimeout(function() {
|
|
599
|
+
return _this.setupWebWheelHandler();
|
|
600
|
+
}, 50);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
key: "teardownWebWheelHandler",
|
|
607
|
+
value: function() {
|
|
608
|
+
this._scrollRef && this._scrollRef.getScrollableNode && this._scrollRef.getScrollableNode().removeEventListener("wheel", this.invertedWheelEventHandler);
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
key: "_pushCells",
|
|
613
|
+
value: function(cells, stickyHeaderIndices, stickyIndicesFromProps, first, last, inversionStyle) {
|
|
614
|
+
var _this, _loop = function(ii2) {
|
|
615
|
+
var item = getItem(data, ii2), key = _this._keyExtractor(item, ii2, _this.props);
|
|
616
|
+
_this._indicesToKeys.set(ii2, key), stickyIndicesFromProps.has(ii2 + stickyOffset) && stickyHeaderIndices.push(cells.length);
|
|
617
|
+
var shouldListenForLayout = getItemLayout == null || debug || _this._fillRateHelper.enabled();
|
|
618
|
+
cells.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VirtualizedListCellRenderer.default, {
|
|
619
|
+
CellRendererComponent,
|
|
620
|
+
ItemSeparatorComponent: ii2 < end ? ItemSeparatorComponent : void 0,
|
|
621
|
+
ListItemComponent,
|
|
622
|
+
cellKey: key,
|
|
623
|
+
horizontal,
|
|
624
|
+
index: ii2,
|
|
625
|
+
inversionStyle,
|
|
626
|
+
item,
|
|
627
|
+
prevCellKey,
|
|
628
|
+
onUpdateSeparators: _this._onUpdateSeparators,
|
|
629
|
+
onCellFocusCapture: function(e) {
|
|
630
|
+
return _this1._onCellFocusCapture(key);
|
|
631
|
+
},
|
|
632
|
+
onUnmount: _this._onCellUnmount,
|
|
633
|
+
ref: function(ref) {
|
|
634
|
+
_this1._cellRefs[key] = ref;
|
|
635
|
+
},
|
|
636
|
+
renderItem,
|
|
637
|
+
...shouldListenForLayout && {
|
|
638
|
+
onCellLayout: _this._onCellLayout
|
|
639
|
+
}
|
|
640
|
+
}, key)), prevCellKey = key;
|
|
641
|
+
}, _this1 = this, { CellRendererComponent, ItemSeparatorComponent, ListHeaderComponent, ListItemComponent, data, debug, getItem, getItemCount, getItemLayout, horizontal, renderItem } = this.props, stickyOffset = ListHeaderComponent ? 1 : 0, end = getItemCount(data) - 1, prevCellKey;
|
|
642
|
+
last = Math.min(end, last);
|
|
643
|
+
for (var ii = first; ii <= last; ii++) _this = this, _loop(ii);
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
key: "_isNestedWithSameOrientation",
|
|
648
|
+
value: function() {
|
|
649
|
+
var nestedContext = this.context;
|
|
650
|
+
return !!(nestedContext && !!nestedContext.horizontal === horizontalOrDefault(this.props.horizontal));
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
key: "_keyExtractor",
|
|
655
|
+
value: function(item, index, props) {
|
|
656
|
+
if (props.keyExtractor != null)
|
|
657
|
+
return props.keyExtractor(item, index);
|
|
658
|
+
var key = (0, import_VirtualizeUtils.keyExtractor)(item, index);
|
|
659
|
+
return key === String(index) && (_usedIndexForKey = !0, item.type && item.type.displayName && (_keylessItemComponentName = item.type.displayName)), key;
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
key: "render",
|
|
664
|
+
value: function() {
|
|
665
|
+
var _this = this;
|
|
666
|
+
this._checkProps(this.props);
|
|
667
|
+
var { ListEmptyComponent, ListFooterComponent, ListHeaderComponent } = this.props, { data, horizontal } = this.props, inversionStyle = this.props.inverted ? horizontalOrDefault(this.props.horizontal) ? styles.horizontallyInverted : styles.verticallyInverted : null, cells = [], stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices), stickyHeaderIndices = [];
|
|
668
|
+
if (ListHeaderComponent) {
|
|
669
|
+
stickyIndicesFromProps.has(0) && stickyHeaderIndices.push(0);
|
|
670
|
+
var element = /* @__PURE__ */ import_react.default.isValidElement(ListHeaderComponent) ? ListHeaderComponent : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListHeaderComponent, {});
|
|
671
|
+
cells.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VirtualizedListContext.VirtualizedListCellContextProvider, {
|
|
672
|
+
cellKey: this._getCellKey() + "-header",
|
|
673
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_View.default, {
|
|
674
|
+
onLayout: this._onLayoutHeader,
|
|
675
|
+
style: [
|
|
676
|
+
inversionStyle,
|
|
677
|
+
this.props.ListHeaderComponentStyle
|
|
678
|
+
],
|
|
679
|
+
children: element
|
|
680
|
+
})
|
|
681
|
+
}, "$header"));
|
|
682
|
+
}
|
|
683
|
+
var itemCount = this.props.getItemCount(data);
|
|
684
|
+
if (itemCount === 0 && ListEmptyComponent) {
|
|
685
|
+
var element1 = /* @__PURE__ */ import_react.default.isValidElement(ListEmptyComponent) ? ListEmptyComponent : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListEmptyComponent, {});
|
|
686
|
+
cells.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VirtualizedListContext.VirtualizedListCellContextProvider, {
|
|
687
|
+
cellKey: this._getCellKey() + "-empty",
|
|
688
|
+
children: /* @__PURE__ */ import_react.default.cloneElement(element1, {
|
|
689
|
+
onLayout: function(event) {
|
|
690
|
+
_this._onLayoutEmpty(event), element1.props.onLayout && element1.props.onLayout(event);
|
|
691
|
+
},
|
|
692
|
+
style: [
|
|
693
|
+
inversionStyle,
|
|
694
|
+
element1.props.style
|
|
695
|
+
]
|
|
696
|
+
})
|
|
697
|
+
}, "$empty"));
|
|
698
|
+
}
|
|
699
|
+
if (itemCount > 0) {
|
|
700
|
+
_usedIndexForKey = !1, _keylessItemComponentName = "";
|
|
701
|
+
var spacerKey = this._getSpacerKey(!horizontal), renderRegions = this.state.renderMask.enumerateRegions(), lastSpacer = findLastWhere(renderRegions, function(r) {
|
|
702
|
+
return r.isSpacer;
|
|
703
|
+
}), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
704
|
+
try {
|
|
705
|
+
for (var _iterator = renderRegions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
706
|
+
var section = _step.value;
|
|
707
|
+
if (section.isSpacer) {
|
|
708
|
+
if (this.props.disableVirtualization)
|
|
709
|
+
continue;
|
|
710
|
+
var isLastSpacer = section === lastSpacer, constrainToMeasured = isLastSpacer && !this.props.getItemLayout, last = constrainToMeasured ? (0, import_clamp.default)(section.first - 1, section.last, this._highestMeasuredFrameIndex) : section.last, firstMetrics = this.__getFrameMetricsApprox(section.first, this.props), lastMetrics = this.__getFrameMetricsApprox(last, this.props), spacerSize = lastMetrics.offset + lastMetrics.length - firstMetrics.offset;
|
|
711
|
+
cells.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_View.default, {
|
|
712
|
+
style: {
|
|
713
|
+
[spacerKey]: spacerSize
|
|
714
|
+
}
|
|
715
|
+
}, `$spacer-${section.first}`));
|
|
716
|
+
} else
|
|
717
|
+
this._pushCells(cells, stickyHeaderIndices, stickyIndicesFromProps, section.first, section.last, inversionStyle);
|
|
718
|
+
}
|
|
719
|
+
} catch (err) {
|
|
720
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
721
|
+
} finally {
|
|
722
|
+
try {
|
|
723
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
724
|
+
} finally {
|
|
725
|
+
if (_didIteratorError)
|
|
726
|
+
throw _iteratorError;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
!this._hasWarned.keys && _usedIndexForKey && (console.warn("VirtualizedList: missing keys for items, make sure to specify a key or id property on each item or provide a custom keyExtractor.", _keylessItemComponentName), this._hasWarned.keys = !0);
|
|
730
|
+
}
|
|
731
|
+
if (ListFooterComponent) {
|
|
732
|
+
var element2 = /* @__PURE__ */ import_react.default.isValidElement(ListFooterComponent) ? ListFooterComponent : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListFooterComponent, {});
|
|
733
|
+
cells.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VirtualizedListContext.VirtualizedListCellContextProvider, {
|
|
734
|
+
cellKey: this._getFooterCellKey(),
|
|
735
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_View.default, {
|
|
736
|
+
onLayout: this._onLayoutFooter,
|
|
737
|
+
style: [
|
|
738
|
+
inversionStyle,
|
|
739
|
+
this.props.ListFooterComponentStyle
|
|
740
|
+
],
|
|
741
|
+
children: element2
|
|
742
|
+
})
|
|
743
|
+
}, "$footer"));
|
|
744
|
+
}
|
|
745
|
+
var scrollProps = {
|
|
746
|
+
...this.props,
|
|
747
|
+
onContentSizeChange: this._onContentSizeChange,
|
|
748
|
+
onLayout: this._onLayout,
|
|
749
|
+
onScroll: this._onScroll,
|
|
750
|
+
onScrollBeginDrag: this._onScrollBeginDrag,
|
|
751
|
+
onScrollEndDrag: this._onScrollEndDrag,
|
|
752
|
+
onMomentumScrollBegin: this._onMomentumScrollBegin,
|
|
753
|
+
onMomentumScrollEnd: this._onMomentumScrollEnd,
|
|
754
|
+
scrollEventThrottle: scrollEventThrottleOrDefault(this.props.scrollEventThrottle),
|
|
755
|
+
invertStickyHeaders: this.props.invertStickyHeaders !== void 0 ? this.props.invertStickyHeaders : this.props.inverted,
|
|
756
|
+
stickyHeaderIndices,
|
|
757
|
+
style: inversionStyle ? [
|
|
758
|
+
inversionStyle,
|
|
759
|
+
this.props.style
|
|
760
|
+
] : this.props.style
|
|
761
|
+
};
|
|
762
|
+
this._hasMore = this.state.cellsAroundViewport.last < itemCount - 1;
|
|
763
|
+
var innerRet = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VirtualizedListContext.VirtualizedListContextProvider, {
|
|
764
|
+
value: {
|
|
765
|
+
cellKey: null,
|
|
766
|
+
getScrollMetrics: this._getScrollMetrics,
|
|
767
|
+
horizontal: horizontalOrDefault(this.props.horizontal),
|
|
768
|
+
getOutermostParentListRef: this._getOutermostParentListRef,
|
|
769
|
+
registerAsNestedChild: this._registerAsNestedChild,
|
|
770
|
+
unregisterAsNestedChild: this._unregisterAsNestedChild
|
|
771
|
+
},
|
|
772
|
+
children: /* @__PURE__ */ import_react.default.cloneElement((this.props.renderScrollComponent || this._defaultRenderScrollComponent)(scrollProps), {
|
|
773
|
+
ref: this._captureScrollRef
|
|
774
|
+
}, cells)
|
|
775
|
+
}), ret = innerRet;
|
|
776
|
+
return ret;
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
key: "componentDidUpdate",
|
|
781
|
+
value: function(prevProps) {
|
|
782
|
+
var { data, extraData } = this.props;
|
|
783
|
+
(data !== prevProps.data || extraData !== prevProps.extraData) && this._viewabilityTuples.forEach(function(tuple) {
|
|
784
|
+
tuple.viewabilityHelper.resetViewableIndices();
|
|
785
|
+
});
|
|
786
|
+
var hiPriInProgress = this._hiPriInProgress;
|
|
787
|
+
this._scheduleCellsToRenderUpdate(), hiPriInProgress && (this._hiPriInProgress = !1);
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
key: "_computeBlankness",
|
|
792
|
+
value: function() {
|
|
793
|
+
this._fillRateHelper.computeBlankness(
|
|
794
|
+
// @ts-ignore
|
|
795
|
+
this.props,
|
|
796
|
+
this.state.cellsAroundViewport,
|
|
797
|
+
this._scrollMetrics
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
key: "_onCellFocusCapture",
|
|
803
|
+
value: function(cellKey) {
|
|
804
|
+
this._lastFocusedCellKey = cellKey, this._updateCellsToRender();
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
key: "_triggerRemeasureForChildListsInCell",
|
|
809
|
+
value: function(cellKey) {
|
|
810
|
+
this._nestedChildLists.forEachInCell(cellKey, function(childList) {
|
|
811
|
+
childList.measureLayoutRelativeToContainingList();
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
key: "measureLayoutRelativeToContainingList",
|
|
817
|
+
value: function() {
|
|
818
|
+
var _this = this;
|
|
819
|
+
try {
|
|
820
|
+
if (!this._scrollRef)
|
|
821
|
+
return;
|
|
822
|
+
this._scrollRef.measureLayout(this.context.getOutermostParentListRef().getScrollRef(), function(x, y, width, height) {
|
|
823
|
+
_this._offsetFromParentVirtualizedList = _this._selectOffset({
|
|
824
|
+
x,
|
|
825
|
+
y
|
|
826
|
+
}), _this._scrollMetrics.contentLength = _this._selectLength({
|
|
827
|
+
width,
|
|
828
|
+
height
|
|
829
|
+
});
|
|
830
|
+
var scrollMetrics = _this._convertParentScrollMetrics(_this.context.getScrollMetrics()), metricsChanged = _this._scrollMetrics.visibleLength !== scrollMetrics.visibleLength || _this._scrollMetrics.offset !== scrollMetrics.offset;
|
|
831
|
+
metricsChanged && (_this._scrollMetrics.visibleLength = scrollMetrics.visibleLength, _this._scrollMetrics.offset = scrollMetrics.offset, _this._nestedChildLists.forEach(function(childList) {
|
|
832
|
+
childList.measureLayoutRelativeToContainingList();
|
|
833
|
+
}));
|
|
834
|
+
}, function(error) {
|
|
835
|
+
console.warn("VirtualizedList: Encountered an error while measuring a list's offset from its containing VirtualizedList.");
|
|
836
|
+
});
|
|
837
|
+
} catch (error) {
|
|
838
|
+
console.warn("measureLayoutRelativeToContainingList threw an error", error.stack);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
key: "_getFooterCellKey",
|
|
844
|
+
value: function() {
|
|
845
|
+
return this._getCellKey() + "-footer";
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
key: "_renderDebugOverlay",
|
|
850
|
+
value: function() {
|
|
851
|
+
for (var normalize = this._scrollMetrics.visibleLength / (this._scrollMetrics.contentLength || 1), framesInLayout = [], itemCount = this.props.getItemCount(this.props.data), ii = 0; ii < itemCount; ii++) {
|
|
852
|
+
var frame = this.__getFrameMetricsApprox(ii, this.props);
|
|
853
|
+
frame.inLayout && framesInLayout.push(frame);
|
|
854
|
+
}
|
|
855
|
+
var windowTop = this.__getFrameMetricsApprox(this.state.cellsAroundViewport.first, this.props).offset, frameLast = this.__getFrameMetricsApprox(this.state.cellsAroundViewport.last, this.props), windowLen = frameLast.offset + frameLast.length - windowTop, visTop = this._scrollMetrics.offset, visLen = this._scrollMetrics.visibleLength;
|
|
856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_View.default, {
|
|
857
|
+
style: [
|
|
858
|
+
styles.debugOverlayBase,
|
|
859
|
+
styles.debugOverlay
|
|
860
|
+
],
|
|
861
|
+
children: [
|
|
862
|
+
framesInLayout.map(function(f, ii2) {
|
|
863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_View.default, {
|
|
864
|
+
style: [
|
|
865
|
+
styles.debugOverlayBase,
|
|
866
|
+
styles.debugOverlayFrame,
|
|
867
|
+
{
|
|
868
|
+
top: f.offset * normalize,
|
|
869
|
+
height: f.length * normalize
|
|
870
|
+
}
|
|
871
|
+
]
|
|
872
|
+
}, "f" + ii2);
|
|
873
|
+
}),
|
|
874
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_View.default, {
|
|
875
|
+
style: [
|
|
876
|
+
styles.debugOverlayBase,
|
|
877
|
+
styles.debugOverlayFrameLast,
|
|
878
|
+
{
|
|
879
|
+
top: windowTop * normalize,
|
|
880
|
+
height: windowLen * normalize
|
|
881
|
+
}
|
|
882
|
+
]
|
|
883
|
+
}),
|
|
884
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_View.default, {
|
|
885
|
+
style: [
|
|
886
|
+
styles.debugOverlayBase,
|
|
887
|
+
styles.debugOverlayFrameVis,
|
|
888
|
+
{
|
|
889
|
+
top: visTop * normalize,
|
|
890
|
+
height: visLen * normalize
|
|
891
|
+
}
|
|
892
|
+
]
|
|
893
|
+
})
|
|
894
|
+
]
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
key: "_selectLength",
|
|
900
|
+
value: function(metrics) {
|
|
901
|
+
return horizontalOrDefault(this.props.horizontal) ? metrics.width : metrics.height;
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
key: "_selectOffset",
|
|
906
|
+
value: function(metrics) {
|
|
907
|
+
return horizontalOrDefault(this.props.horizontal) ? metrics.x : metrics.y;
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
key: "_maybeCallOnEdgeReached",
|
|
912
|
+
value: function() {
|
|
913
|
+
var { data, getItemCount, onStartReached, onStartReachedThreshold, onEndReached, onEndReachedThreshold, initialScrollIndex } = this.props, { contentLength, visibleLength, offset } = this._scrollMetrics, distanceFromStart = offset, distanceFromEnd = contentLength - visibleLength - offset;
|
|
914
|
+
distanceFromStart < ON_EDGE_REACHED_EPSILON && (distanceFromStart = 0), distanceFromEnd < ON_EDGE_REACHED_EPSILON && (distanceFromEnd = 0);
|
|
915
|
+
var DEFAULT_THRESHOLD_PX = 2, startThreshold = onStartReachedThreshold != null ? onStartReachedThreshold * visibleLength : DEFAULT_THRESHOLD_PX, endThreshold = onEndReachedThreshold != null ? onEndReachedThreshold * visibleLength : DEFAULT_THRESHOLD_PX, isWithinStartThreshold = distanceFromStart <= startThreshold, isWithinEndThreshold = distanceFromEnd <= endThreshold;
|
|
916
|
+
onEndReached && this.state.cellsAroundViewport.last === getItemCount(data) - 1 && isWithinEndThreshold && this._scrollMetrics.contentLength !== this._sentEndForContentLength ? (this._sentEndForContentLength = this._scrollMetrics.contentLength, onEndReached({
|
|
917
|
+
distanceFromEnd
|
|
918
|
+
})) : onStartReached != null && this.state.cellsAroundViewport.first === 0 && isWithinStartThreshold && this._scrollMetrics.contentLength !== this._sentStartForContentLength ? (!initialScrollIndex || this._scrollMetrics.timestamp !== 0) && (this._sentStartForContentLength = this._scrollMetrics.contentLength, onStartReached({
|
|
919
|
+
distanceFromStart
|
|
920
|
+
})) : (this._sentStartForContentLength = isWithinStartThreshold ? this._sentStartForContentLength : 0, this._sentEndForContentLength = isWithinEndThreshold ? this._sentEndForContentLength : 0);
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
key: "_scheduleCellsToRenderUpdate",
|
|
925
|
+
value: function() {
|
|
926
|
+
var { first, last } = this.state.cellsAroundViewport, { offset, visibleLength, velocity } = this._scrollMetrics, itemCount = this.props.getItemCount(this.props.data), hiPri = !1, onStartReachedThreshold = onStartReachedThresholdOrDefault(this.props.onStartReachedThreshold), onEndReachedThreshold = onEndReachedThresholdOrDefault(this.props.onEndReachedThreshold);
|
|
927
|
+
if (first > 0) {
|
|
928
|
+
var distTop = offset - this.__getFrameMetricsApprox(first, this.props).offset;
|
|
929
|
+
hiPri = distTop < 0 || velocity < -2 && distTop < getScrollingThreshold(onStartReachedThreshold, visibleLength);
|
|
930
|
+
}
|
|
931
|
+
if (!hiPri && last >= 0 && last < itemCount - 1) {
|
|
932
|
+
var distBottom = this.__getFrameMetricsApprox(last, this.props).offset - (offset + visibleLength);
|
|
933
|
+
hiPri = distBottom < 0 || velocity > 2 && distBottom < getScrollingThreshold(onEndReachedThreshold, visibleLength);
|
|
934
|
+
}
|
|
935
|
+
if (hiPri && (this._averageCellLength || this.props.getItemLayout) && !this._hiPriInProgress) {
|
|
936
|
+
this._hiPriInProgress = !0, this._updateCellsToRenderBatcher.dispose({
|
|
937
|
+
abort: !0
|
|
938
|
+
}), this._updateCellsToRender();
|
|
939
|
+
return;
|
|
940
|
+
} else
|
|
941
|
+
this._updateCellsToRenderBatcher.schedule();
|
|
942
|
+
}
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
key: "_updateViewableItems",
|
|
946
|
+
value: function(props, cellsAroundViewport) {
|
|
947
|
+
var _this = this;
|
|
948
|
+
this._viewabilityTuples.forEach(function(tuple) {
|
|
949
|
+
tuple.viewabilityHelper.onUpdate(props, _this._scrollMetrics.offset, _this._scrollMetrics.visibleLength, _this._getFrameMetrics, _this._createViewToken, tuple.onViewableItemsChanged, cellsAroundViewport);
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
], [
|
|
954
|
+
{
|
|
955
|
+
key: "_createRenderMask",
|
|
956
|
+
value: function(props, cellsAroundViewport, additionalRegions) {
|
|
957
|
+
var itemCount = props.getItemCount(props.data);
|
|
958
|
+
(0, import_react_native_web_internals.invariant)(cellsAroundViewport.first >= 0 && cellsAroundViewport.last >= cellsAroundViewport.first - 1 && cellsAroundViewport.last < itemCount, `Invalid cells around viewport "[${cellsAroundViewport.first}, ${cellsAroundViewport.last}]" was passed to VirtualizedList._createRenderMask`);
|
|
959
|
+
var renderMask = new import_CellRenderMask.CellRenderMask(itemCount);
|
|
960
|
+
if (itemCount > 0) {
|
|
961
|
+
var allRegions = [
|
|
962
|
+
cellsAroundViewport,
|
|
963
|
+
...additionalRegions ?? []
|
|
964
|
+
], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
965
|
+
try {
|
|
966
|
+
for (var _iterator = allRegions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
967
|
+
var region = _step.value;
|
|
968
|
+
renderMask.addCells(region);
|
|
969
|
+
}
|
|
970
|
+
} catch (err) {
|
|
971
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
972
|
+
} finally {
|
|
973
|
+
try {
|
|
974
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
975
|
+
} finally {
|
|
976
|
+
if (_didIteratorError)
|
|
977
|
+
throw _iteratorError;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
if (props.initialScrollIndex == null || props.initialScrollIndex <= 0) {
|
|
981
|
+
var initialRegion = VirtualizedList2._initialRenderRegion(props);
|
|
982
|
+
renderMask.addCells(initialRegion);
|
|
983
|
+
}
|
|
984
|
+
var stickyIndicesSet = new Set(props.stickyHeaderIndices);
|
|
985
|
+
VirtualizedList2._ensureClosestStickyHeader(props, stickyIndicesSet, renderMask, cellsAroundViewport.first);
|
|
986
|
+
}
|
|
987
|
+
return renderMask;
|
|
988
|
+
}
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
key: "_initialRenderRegion",
|
|
992
|
+
value: function(props) {
|
|
993
|
+
var itemCount = props.getItemCount(props.data), _props_initialScrollIndex, firstCellIndex = Math.max(0, Math.min(itemCount - 1, Math.floor((_props_initialScrollIndex = props.initialScrollIndex) !== null && _props_initialScrollIndex !== void 0 ? _props_initialScrollIndex : 0))), lastCellIndex = Math.min(itemCount, firstCellIndex + initialNumToRenderOrDefault(props.initialNumToRender)) - 1;
|
|
994
|
+
return {
|
|
995
|
+
first: firstCellIndex,
|
|
996
|
+
last: lastCellIndex
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
key: "_ensureClosestStickyHeader",
|
|
1002
|
+
value: function(props, stickyIndicesSet, renderMask, cellIdx) {
|
|
1003
|
+
for (var stickyOffset = props.ListHeaderComponent ? 1 : 0, itemIdx = cellIdx - 1; itemIdx >= 0; itemIdx--)
|
|
1004
|
+
if (stickyIndicesSet.has(itemIdx + stickyOffset)) {
|
|
1005
|
+
renderMask.addCells({
|
|
1006
|
+
first: itemIdx,
|
|
1007
|
+
last: itemIdx
|
|
1008
|
+
});
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
key: "getDerivedStateFromProps",
|
|
1015
|
+
value: function(newProps, prevState) {
|
|
1016
|
+
var itemCount = newProps.getItemCount(newProps.data);
|
|
1017
|
+
if (itemCount === prevState.renderMask.numCells())
|
|
1018
|
+
return prevState;
|
|
1019
|
+
var constrainedCells = VirtualizedList2._constrainToItemCount(prevState.cellsAroundViewport, newProps);
|
|
1020
|
+
return {
|
|
1021
|
+
cellsAroundViewport: constrainedCells,
|
|
1022
|
+
renderMask: VirtualizedList2._createRenderMask(newProps, constrainedCells)
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
key: "_constrainToItemCount",
|
|
1028
|
+
value: function(cells, props) {
|
|
1029
|
+
var itemCount = props.getItemCount(props.data), last = Math.min(itemCount - 1, cells.last), maxToRenderPerBatch = maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch);
|
|
1030
|
+
return {
|
|
1031
|
+
first: (0, import_clamp.default)(0, itemCount - 1 - maxToRenderPerBatch, cells.first),
|
|
1032
|
+
last
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
]), VirtualizedList2;
|
|
1037
|
+
}(import_StateSafePureComponent.default);
|
|
1038
|
+
_define_property(VirtualizedList, "contextType", import_VirtualizedListContext.VirtualizedListContext);
|
|
1039
|
+
var styles = import_react_native_web_internals.StyleSheet.create({
|
|
1040
|
+
verticallyInverted: {
|
|
1041
|
+
transform: "scaleY(-1)"
|
|
1042
|
+
},
|
|
1043
|
+
horizontallyInverted: {
|
|
1044
|
+
transform: "scaleX(-1)"
|
|
1045
|
+
},
|
|
1046
|
+
debug: {
|
|
1047
|
+
flex: 1
|
|
1048
|
+
},
|
|
1049
|
+
debugOverlayBase: {
|
|
1050
|
+
position: "absolute",
|
|
1051
|
+
top: 0,
|
|
1052
|
+
right: 0
|
|
1053
|
+
},
|
|
1054
|
+
debugOverlay: {
|
|
1055
|
+
bottom: 0,
|
|
1056
|
+
width: 20,
|
|
1057
|
+
borderColor: "blue",
|
|
1058
|
+
borderWidth: 1
|
|
1059
|
+
},
|
|
1060
|
+
debugOverlayFrame: {
|
|
1061
|
+
left: 0,
|
|
1062
|
+
backgroundColor: "orange"
|
|
1063
|
+
},
|
|
1064
|
+
debugOverlayFrameLast: {
|
|
1065
|
+
left: 0,
|
|
1066
|
+
borderColor: "green",
|
|
1067
|
+
borderWidth: 2
|
|
1068
|
+
},
|
|
1069
|
+
debugOverlayFrameVis: {
|
|
1070
|
+
left: 0,
|
|
1071
|
+
borderColor: "red",
|
|
1072
|
+
borderWidth: 2
|
|
1073
|
+
}
|
|
1074
|
+
}), VirtualizedList_default = VirtualizedList;
|
|
1075
|
+
//# sourceMappingURL=index.js.map
|