@legendapp/list 0.4.0 → 0.4.2
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/index.js +49 -49
- package/index.mjs +28 -28
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React6 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
|
|
6
6
|
function _interopNamespace(e) {
|
|
@@ -21,28 +21,28 @@ function _interopNamespace(e) {
|
|
|
21
21
|
return Object.freeze(n);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
|
|
25
25
|
|
|
26
26
|
// src/LegendList.tsx
|
|
27
|
-
var LeanView =
|
|
28
|
-
return
|
|
27
|
+
var LeanView = React6__namespace.forwardRef((props, ref) => {
|
|
28
|
+
return React6__namespace.createElement("RCTView", { ...props, ref });
|
|
29
29
|
});
|
|
30
30
|
LeanView.displayName = "RCTView";
|
|
31
|
-
var ContextState =
|
|
31
|
+
var ContextState = React6__namespace.createContext(null);
|
|
32
32
|
function StateProvider({ children }) {
|
|
33
|
-
const [value] =
|
|
33
|
+
const [value] = React6__namespace.useState(() => ({
|
|
34
34
|
hooks: /* @__PURE__ */ new Map(),
|
|
35
35
|
listeners: /* @__PURE__ */ new Map(),
|
|
36
36
|
values: /* @__PURE__ */ new Map()
|
|
37
37
|
}));
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ React6__namespace.createElement(ContextState.Provider, { value }, children);
|
|
39
39
|
}
|
|
40
40
|
function useStateContext() {
|
|
41
|
-
return
|
|
41
|
+
return React6__namespace.useContext(ContextState);
|
|
42
42
|
}
|
|
43
43
|
function use$(signalName) {
|
|
44
|
-
const { hooks, values } =
|
|
45
|
-
const [, forceUpdate] =
|
|
44
|
+
const { hooks, values } = React6__namespace.useContext(ContextState);
|
|
45
|
+
const [, forceUpdate] = React6__namespace.useReducer((x) => x + 1, 0);
|
|
46
46
|
hooks.set(signalName, forceUpdate);
|
|
47
47
|
return values.get(signalName);
|
|
48
48
|
}
|
|
@@ -79,7 +79,7 @@ function set$(ctx, signalName, value) {
|
|
|
79
79
|
function $View({ $key, $style, ...rest }) {
|
|
80
80
|
use$($key);
|
|
81
81
|
const style = $style();
|
|
82
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ React6__namespace.createElement(LeanView, { style, ...rest });
|
|
83
83
|
}
|
|
84
84
|
function InnerContainer({ id, getRenderedItem, recycleItems, ItemSeparatorComponent }) {
|
|
85
85
|
const itemIndex = use$(`containerIndex${id}`);
|
|
@@ -87,7 +87,7 @@ function InnerContainer({ id, getRenderedItem, recycleItems, ItemSeparatorCompon
|
|
|
87
87
|
if (itemIndex < 0) {
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ React6__namespace.createElement(React6__namespace.Fragment, { key: recycleItems ? void 0 : itemIndex }, /* @__PURE__ */ React6__namespace.createElement(RenderedItem, { itemIndex, id, getRenderedItem }), ItemSeparatorComponent && itemIndex < numItems - 1 && ItemSeparatorComponent);
|
|
91
91
|
}
|
|
92
92
|
function RenderedItem({
|
|
93
93
|
itemIndex,
|
|
@@ -123,7 +123,7 @@ var Container = ({
|
|
|
123
123
|
opacity: position < 0 ? 0 : 1
|
|
124
124
|
};
|
|
125
125
|
};
|
|
126
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ React6__namespace.createElement(
|
|
127
127
|
$View,
|
|
128
128
|
{
|
|
129
129
|
$key: `containerPosition${id}`,
|
|
@@ -136,7 +136,7 @@ var Container = ({
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ React6__namespace.createElement(
|
|
140
140
|
InnerContainer,
|
|
141
141
|
{
|
|
142
142
|
id,
|
|
@@ -149,7 +149,7 @@ var Container = ({
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
// src/Containers.tsx
|
|
152
|
-
var Containers =
|
|
152
|
+
var Containers = React6__namespace.memo(function Containers2({
|
|
153
153
|
horizontal,
|
|
154
154
|
recycleItems,
|
|
155
155
|
ItemSeparatorComponent,
|
|
@@ -161,7 +161,7 @@ var Containers = React7__namespace.memo(function Containers2({
|
|
|
161
161
|
const containers = [];
|
|
162
162
|
for (let i = 0; i < numContainers; i++) {
|
|
163
163
|
containers.push(
|
|
164
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ React6__namespace.createElement(
|
|
165
165
|
Container,
|
|
166
166
|
{
|
|
167
167
|
id: i,
|
|
@@ -175,7 +175,7 @@ var Containers = React7__namespace.memo(function Containers2({
|
|
|
175
175
|
)
|
|
176
176
|
);
|
|
177
177
|
}
|
|
178
|
-
return /* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ React6__namespace.createElement(
|
|
179
179
|
$View,
|
|
180
180
|
{
|
|
181
181
|
$key: "totalSize",
|
|
@@ -191,15 +191,15 @@ var Containers = React7__namespace.memo(function Containers2({
|
|
|
191
191
|
|
|
192
192
|
// src/ListComponent.tsx
|
|
193
193
|
var getComponent = (Component) => {
|
|
194
|
-
if (
|
|
194
|
+
if (React6__namespace.isValidElement(Component)) {
|
|
195
195
|
return Component;
|
|
196
196
|
}
|
|
197
197
|
if (Component) {
|
|
198
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ React6__namespace.createElement(Component, null);
|
|
199
199
|
}
|
|
200
200
|
return null;
|
|
201
201
|
};
|
|
202
|
-
var ListComponent =
|
|
202
|
+
var ListComponent = React6__namespace.memo(function ListComponent2({
|
|
203
203
|
style,
|
|
204
204
|
contentContainerStyle,
|
|
205
205
|
horizontal,
|
|
@@ -220,7 +220,7 @@ var ListComponent = React7__namespace.memo(function ListComponent2({
|
|
|
220
220
|
...rest
|
|
221
221
|
}) {
|
|
222
222
|
const ctx = useStateContext();
|
|
223
|
-
return /* @__PURE__ */
|
|
223
|
+
return /* @__PURE__ */ React6__namespace.createElement(
|
|
224
224
|
reactNative.ScrollView,
|
|
225
225
|
{
|
|
226
226
|
...rest,
|
|
@@ -238,8 +238,8 @@ var ListComponent = React7__namespace.memo(function ListComponent2({
|
|
|
238
238
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
239
239
|
ref: refScroller
|
|
240
240
|
},
|
|
241
|
-
alignItemsAtEnd && /* @__PURE__ */
|
|
242
|
-
ListHeaderComponent && /* @__PURE__ */
|
|
241
|
+
alignItemsAtEnd && /* @__PURE__ */ React6__namespace.createElement($View, { $key: "paddingTop", $style: () => ({ height: peek$(ctx, "paddingTop") }) }),
|
|
242
|
+
ListHeaderComponent && /* @__PURE__ */ React6__namespace.createElement(
|
|
243
243
|
reactNative.View,
|
|
244
244
|
{
|
|
245
245
|
style: ListHeaderComponentStyle,
|
|
@@ -254,7 +254,7 @@ var ListComponent = React7__namespace.memo(function ListComponent2({
|
|
|
254
254
|
},
|
|
255
255
|
getComponent(ListHeaderComponent)
|
|
256
256
|
),
|
|
257
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ React6__namespace.createElement(
|
|
258
258
|
Containers,
|
|
259
259
|
{
|
|
260
260
|
horizontal,
|
|
@@ -264,7 +264,7 @@ var ListComponent = React7__namespace.memo(function ListComponent2({
|
|
|
264
264
|
updateItemSize
|
|
265
265
|
}
|
|
266
266
|
),
|
|
267
|
-
ListFooterComponent && /* @__PURE__ */
|
|
267
|
+
ListFooterComponent && /* @__PURE__ */ React6__namespace.createElement(reactNative.View, { style: ListFooterComponentStyle }, getComponent(ListFooterComponent))
|
|
268
268
|
);
|
|
269
269
|
});
|
|
270
270
|
|
|
@@ -386,10 +386,10 @@ function registerViewabilityCallback(itemKey, configId, callback) {
|
|
|
386
386
|
// src/LegendList.tsx
|
|
387
387
|
var DEFAULT_SCROLL_BUFFER = 0;
|
|
388
388
|
var POSITION_OUT_OF_VIEW = -1e4;
|
|
389
|
-
var LegendList =
|
|
390
|
-
return /* @__PURE__ */
|
|
389
|
+
var LegendList = React6.forwardRef(function LegendList2(props, forwardedRef) {
|
|
390
|
+
return /* @__PURE__ */ React6__namespace.createElement(StateProvider, null, /* @__PURE__ */ React6__namespace.createElement(LegendListInner, { ...props, ref: forwardedRef }));
|
|
391
391
|
});
|
|
392
|
-
var LegendListInner =
|
|
392
|
+
var LegendListInner = React6.forwardRef(function LegendListInner2(props, forwardedRef) {
|
|
393
393
|
var _a, _b;
|
|
394
394
|
const {
|
|
395
395
|
data,
|
|
@@ -399,8 +399,8 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
399
399
|
style: styleProp,
|
|
400
400
|
contentContainerStyle: contentContainerStyleProp,
|
|
401
401
|
initialNumContainers,
|
|
402
|
-
drawDistance,
|
|
403
|
-
recycleItems =
|
|
402
|
+
drawDistance = 250,
|
|
403
|
+
recycleItems = false,
|
|
404
404
|
onEndReachedThreshold = 0.5,
|
|
405
405
|
maintainScrollAtEnd = false,
|
|
406
406
|
maintainScrollAtEndThreshold = 0.1,
|
|
@@ -415,17 +415,17 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
415
415
|
...rest
|
|
416
416
|
} = props;
|
|
417
417
|
const ctx = useStateContext();
|
|
418
|
-
const internalRef =
|
|
418
|
+
const internalRef = React6.useRef(null);
|
|
419
419
|
const refScroller = internalRef;
|
|
420
420
|
const scrollBuffer = drawDistance != null ? drawDistance : DEFAULT_SCROLL_BUFFER;
|
|
421
421
|
const styleFlattened = reactNative.StyleSheet.flatten(styleProp);
|
|
422
|
-
const style =
|
|
422
|
+
const style = React6.useMemo(() => styleFlattened, [JSON.stringify(styleFlattened)]);
|
|
423
423
|
const contentContainerStyleFlattened = reactNative.StyleSheet.flatten(contentContainerStyleProp);
|
|
424
|
-
const contentContainerStyle =
|
|
424
|
+
const contentContainerStyle = React6.useMemo(
|
|
425
425
|
() => contentContainerStyleFlattened,
|
|
426
426
|
[JSON.stringify(contentContainerStyleProp)]
|
|
427
427
|
);
|
|
428
|
-
const refState =
|
|
428
|
+
const refState = React6.useRef();
|
|
429
429
|
const getId = (index) => {
|
|
430
430
|
var _a2;
|
|
431
431
|
const data2 = (_a2 = refState.current) == null ? void 0 : _a2.data;
|
|
@@ -453,7 +453,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
453
453
|
}
|
|
454
454
|
return void 0;
|
|
455
455
|
};
|
|
456
|
-
const initialContentOffset = initialScrollOffset != null ? initialScrollOffset :
|
|
456
|
+
const initialContentOffset = initialScrollOffset != null ? initialScrollOffset : React6.useMemo(calculateInitialOffset, []);
|
|
457
457
|
if (!refState.current) {
|
|
458
458
|
refState.current = {
|
|
459
459
|
sizes: /* @__PURE__ */ new Map(),
|
|
@@ -483,7 +483,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
483
483
|
refState.current.data = data;
|
|
484
484
|
set$(ctx, "numItems", data.length);
|
|
485
485
|
set$(ctx, "stylePaddingTop", (_b = (_a = styleFlattened == null ? void 0 : styleFlattened.paddingTop) != null ? _a : contentContainerStyleFlattened == null ? void 0 : contentContainerStyleFlattened.paddingTop) != null ? _b : 0);
|
|
486
|
-
const addTotalSize =
|
|
486
|
+
const addTotalSize = React6.useCallback((add) => {
|
|
487
487
|
const prev = refState.current.totalSize;
|
|
488
488
|
refState.current.totalSize += add;
|
|
489
489
|
const totalSize = refState.current.totalSize;
|
|
@@ -502,7 +502,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
502
502
|
refState.current.animFrameTotalSize = requestAnimationFrame(doAdd);
|
|
503
503
|
}
|
|
504
504
|
}, []);
|
|
505
|
-
const getRenderedItem =
|
|
505
|
+
const getRenderedItem = React6.useCallback(
|
|
506
506
|
(index, containerIndex) => {
|
|
507
507
|
var _a2;
|
|
508
508
|
const data2 = (_a2 = refState.current) == null ? void 0 : _a2.data;
|
|
@@ -511,10 +511,10 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
511
511
|
}
|
|
512
512
|
const itemKey = getId(index);
|
|
513
513
|
const useViewability = (configId, callback) => {
|
|
514
|
-
|
|
514
|
+
React6.useEffect(() => registerViewabilityCallback(itemKey, configId, callback), []);
|
|
515
515
|
};
|
|
516
516
|
const useRecyclingEffect = (effect) => {
|
|
517
|
-
|
|
517
|
+
React6.useEffect(() => {
|
|
518
518
|
let prevIndex = index;
|
|
519
519
|
let prevItem = data2[index];
|
|
520
520
|
const signal = `containerIndex${containerIndex}`;
|
|
@@ -539,7 +539,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
539
539
|
}, []);
|
|
540
540
|
};
|
|
541
541
|
const useRecyclingState = (updateState) => {
|
|
542
|
-
const stateInfo =
|
|
542
|
+
const stateInfo = React6.useState(
|
|
543
543
|
() => updateState({
|
|
544
544
|
index,
|
|
545
545
|
item: data2[index],
|
|
@@ -565,7 +565,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
565
565
|
},
|
|
566
566
|
[renderItem]
|
|
567
567
|
);
|
|
568
|
-
const calculateItemsInView =
|
|
568
|
+
const calculateItemsInView = React6.useCallback(() => {
|
|
569
569
|
reactNative.unstable_batchedUpdates(() => {
|
|
570
570
|
var _a2, _b2, _c;
|
|
571
571
|
const {
|
|
@@ -726,7 +726,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
726
726
|
}
|
|
727
727
|
});
|
|
728
728
|
}, [data]);
|
|
729
|
-
|
|
729
|
+
React6.useMemo(() => {
|
|
730
730
|
var _a2, _b2;
|
|
731
731
|
refState.current.viewabilityConfigCallbackPairs = setupViewability(props);
|
|
732
732
|
const scrollLength = refState.current.scrollLength;
|
|
@@ -763,14 +763,14 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
765
|
};
|
|
766
|
-
|
|
766
|
+
React6.useEffect(() => {
|
|
767
767
|
if (refState.current) {
|
|
768
768
|
refState.current.isEndReached = false;
|
|
769
769
|
}
|
|
770
770
|
calculateItemsInView();
|
|
771
771
|
checkAtBottom();
|
|
772
772
|
}, [data]);
|
|
773
|
-
const updateItemSize =
|
|
773
|
+
const updateItemSize = React6.useCallback((index, size) => {
|
|
774
774
|
var _a2, _b2, _c, _d;
|
|
775
775
|
const data2 = (_a2 = refState.current) == null ? void 0 : _a2.data;
|
|
776
776
|
if (!data2) {
|
|
@@ -800,18 +800,18 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
}, []);
|
|
803
|
-
const handleScrollDebounced =
|
|
803
|
+
const handleScrollDebounced = React6.useCallback(() => {
|
|
804
804
|
calculateItemsInView();
|
|
805
805
|
checkAtBottom();
|
|
806
806
|
if (refState.current) {
|
|
807
807
|
refState.current.animFrameScroll = null;
|
|
808
808
|
}
|
|
809
809
|
}, []);
|
|
810
|
-
const onLayout =
|
|
810
|
+
const onLayout = React6.useCallback((event) => {
|
|
811
811
|
const scrollLength = event.nativeEvent.layout[horizontal ? "width" : "height"];
|
|
812
812
|
refState.current.scrollLength = scrollLength;
|
|
813
813
|
}, []);
|
|
814
|
-
const handleScroll =
|
|
814
|
+
const handleScroll = React6.useCallback(
|
|
815
815
|
(event, fromSelf) => {
|
|
816
816
|
var _a2, _b2, _c;
|
|
817
817
|
if (((_b2 = (_a2 = event.nativeEvent) == null ? void 0 : _a2.contentSize) == null ? void 0 : _b2.height) === 0 && ((_c = event.nativeEvent.contentSize) == null ? void 0 : _c.width) === 0) {
|
|
@@ -829,7 +829,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
829
829
|
},
|
|
830
830
|
[]
|
|
831
831
|
);
|
|
832
|
-
|
|
832
|
+
React6.useImperativeHandle(forwardedRef, () => {
|
|
833
833
|
const scrollToIndex = ({ index, animated }) => {
|
|
834
834
|
const offsetObj = calculateInitialOffset(index);
|
|
835
835
|
const offset = horizontal ? { x: offsetObj, y: 0 } : { x: 0, y: offsetObj };
|
|
@@ -854,7 +854,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
854
854
|
scrollToEnd: refScroller.current.scrollToEnd
|
|
855
855
|
};
|
|
856
856
|
}, []);
|
|
857
|
-
return /* @__PURE__ */
|
|
857
|
+
return /* @__PURE__ */ React6__namespace.createElement(
|
|
858
858
|
ListComponent,
|
|
859
859
|
{
|
|
860
860
|
...rest,
|
package/index.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React6 from 'react';
|
|
2
2
|
import { forwardRef, useRef, useMemo, useCallback, useEffect, useImperativeHandle, useState } from 'react';
|
|
3
3
|
import { ScrollView, View, StyleSheet, Dimensions, unstable_batchedUpdates } from 'react-native';
|
|
4
4
|
|
|
5
5
|
// src/LegendList.tsx
|
|
6
|
-
var LeanView =
|
|
7
|
-
return
|
|
6
|
+
var LeanView = React6.forwardRef((props, ref) => {
|
|
7
|
+
return React6.createElement("RCTView", { ...props, ref });
|
|
8
8
|
});
|
|
9
9
|
LeanView.displayName = "RCTView";
|
|
10
|
-
var ContextState =
|
|
10
|
+
var ContextState = React6.createContext(null);
|
|
11
11
|
function StateProvider({ children }) {
|
|
12
|
-
const [value] =
|
|
12
|
+
const [value] = React6.useState(() => ({
|
|
13
13
|
hooks: /* @__PURE__ */ new Map(),
|
|
14
14
|
listeners: /* @__PURE__ */ new Map(),
|
|
15
15
|
values: /* @__PURE__ */ new Map()
|
|
16
16
|
}));
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ React6.createElement(ContextState.Provider, { value }, children);
|
|
18
18
|
}
|
|
19
19
|
function useStateContext() {
|
|
20
|
-
return
|
|
20
|
+
return React6.useContext(ContextState);
|
|
21
21
|
}
|
|
22
22
|
function use$(signalName) {
|
|
23
|
-
const { hooks, values } =
|
|
24
|
-
const [, forceUpdate] =
|
|
23
|
+
const { hooks, values } = React6.useContext(ContextState);
|
|
24
|
+
const [, forceUpdate] = React6.useReducer((x) => x + 1, 0);
|
|
25
25
|
hooks.set(signalName, forceUpdate);
|
|
26
26
|
return values.get(signalName);
|
|
27
27
|
}
|
|
@@ -58,7 +58,7 @@ function set$(ctx, signalName, value) {
|
|
|
58
58
|
function $View({ $key, $style, ...rest }) {
|
|
59
59
|
use$($key);
|
|
60
60
|
const style = $style();
|
|
61
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ React6.createElement(LeanView, { style, ...rest });
|
|
62
62
|
}
|
|
63
63
|
function InnerContainer({ id, getRenderedItem, recycleItems, ItemSeparatorComponent }) {
|
|
64
64
|
const itemIndex = use$(`containerIndex${id}`);
|
|
@@ -66,7 +66,7 @@ function InnerContainer({ id, getRenderedItem, recycleItems, ItemSeparatorCompon
|
|
|
66
66
|
if (itemIndex < 0) {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, { key: recycleItems ? void 0 : itemIndex }, /* @__PURE__ */ React6.createElement(RenderedItem, { itemIndex, id, getRenderedItem }), ItemSeparatorComponent && itemIndex < numItems - 1 && ItemSeparatorComponent);
|
|
70
70
|
}
|
|
71
71
|
function RenderedItem({
|
|
72
72
|
itemIndex,
|
|
@@ -102,7 +102,7 @@ var Container = ({
|
|
|
102
102
|
opacity: position < 0 ? 0 : 1
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ React6.createElement(
|
|
106
106
|
$View,
|
|
107
107
|
{
|
|
108
108
|
$key: `containerPosition${id}`,
|
|
@@ -115,7 +115,7 @@ var Container = ({
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ React6.createElement(
|
|
119
119
|
InnerContainer,
|
|
120
120
|
{
|
|
121
121
|
id,
|
|
@@ -128,7 +128,7 @@ var Container = ({
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// src/Containers.tsx
|
|
131
|
-
var Containers =
|
|
131
|
+
var Containers = React6.memo(function Containers2({
|
|
132
132
|
horizontal,
|
|
133
133
|
recycleItems,
|
|
134
134
|
ItemSeparatorComponent,
|
|
@@ -140,7 +140,7 @@ var Containers = React7.memo(function Containers2({
|
|
|
140
140
|
const containers = [];
|
|
141
141
|
for (let i = 0; i < numContainers; i++) {
|
|
142
142
|
containers.push(
|
|
143
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ React6.createElement(
|
|
144
144
|
Container,
|
|
145
145
|
{
|
|
146
146
|
id: i,
|
|
@@ -154,7 +154,7 @@ var Containers = React7.memo(function Containers2({
|
|
|
154
154
|
)
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
|
-
return /* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ React6.createElement(
|
|
158
158
|
$View,
|
|
159
159
|
{
|
|
160
160
|
$key: "totalSize",
|
|
@@ -170,15 +170,15 @@ var Containers = React7.memo(function Containers2({
|
|
|
170
170
|
|
|
171
171
|
// src/ListComponent.tsx
|
|
172
172
|
var getComponent = (Component) => {
|
|
173
|
-
if (
|
|
173
|
+
if (React6.isValidElement(Component)) {
|
|
174
174
|
return Component;
|
|
175
175
|
}
|
|
176
176
|
if (Component) {
|
|
177
|
-
return /* @__PURE__ */
|
|
177
|
+
return /* @__PURE__ */ React6.createElement(Component, null);
|
|
178
178
|
}
|
|
179
179
|
return null;
|
|
180
180
|
};
|
|
181
|
-
var ListComponent =
|
|
181
|
+
var ListComponent = React6.memo(function ListComponent2({
|
|
182
182
|
style,
|
|
183
183
|
contentContainerStyle,
|
|
184
184
|
horizontal,
|
|
@@ -199,7 +199,7 @@ var ListComponent = React7.memo(function ListComponent2({
|
|
|
199
199
|
...rest
|
|
200
200
|
}) {
|
|
201
201
|
const ctx = useStateContext();
|
|
202
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ React6.createElement(
|
|
203
203
|
ScrollView,
|
|
204
204
|
{
|
|
205
205
|
...rest,
|
|
@@ -217,8 +217,8 @@ var ListComponent = React7.memo(function ListComponent2({
|
|
|
217
217
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
218
218
|
ref: refScroller
|
|
219
219
|
},
|
|
220
|
-
alignItemsAtEnd && /* @__PURE__ */
|
|
221
|
-
ListHeaderComponent && /* @__PURE__ */
|
|
220
|
+
alignItemsAtEnd && /* @__PURE__ */ React6.createElement($View, { $key: "paddingTop", $style: () => ({ height: peek$(ctx, "paddingTop") }) }),
|
|
221
|
+
ListHeaderComponent && /* @__PURE__ */ React6.createElement(
|
|
222
222
|
View,
|
|
223
223
|
{
|
|
224
224
|
style: ListHeaderComponentStyle,
|
|
@@ -233,7 +233,7 @@ var ListComponent = React7.memo(function ListComponent2({
|
|
|
233
233
|
},
|
|
234
234
|
getComponent(ListHeaderComponent)
|
|
235
235
|
),
|
|
236
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ React6.createElement(
|
|
237
237
|
Containers,
|
|
238
238
|
{
|
|
239
239
|
horizontal,
|
|
@@ -243,7 +243,7 @@ var ListComponent = React7.memo(function ListComponent2({
|
|
|
243
243
|
updateItemSize
|
|
244
244
|
}
|
|
245
245
|
),
|
|
246
|
-
ListFooterComponent && /* @__PURE__ */
|
|
246
|
+
ListFooterComponent && /* @__PURE__ */ React6.createElement(View, { style: ListFooterComponentStyle }, getComponent(ListFooterComponent))
|
|
247
247
|
);
|
|
248
248
|
});
|
|
249
249
|
|
|
@@ -366,7 +366,7 @@ function registerViewabilityCallback(itemKey, configId, callback) {
|
|
|
366
366
|
var DEFAULT_SCROLL_BUFFER = 0;
|
|
367
367
|
var POSITION_OUT_OF_VIEW = -1e4;
|
|
368
368
|
var LegendList = forwardRef(function LegendList2(props, forwardedRef) {
|
|
369
|
-
return /* @__PURE__ */
|
|
369
|
+
return /* @__PURE__ */ React6.createElement(StateProvider, null, /* @__PURE__ */ React6.createElement(LegendListInner, { ...props, ref: forwardedRef }));
|
|
370
370
|
});
|
|
371
371
|
var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef) {
|
|
372
372
|
var _a, _b;
|
|
@@ -378,8 +378,8 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
378
378
|
style: styleProp,
|
|
379
379
|
contentContainerStyle: contentContainerStyleProp,
|
|
380
380
|
initialNumContainers,
|
|
381
|
-
drawDistance,
|
|
382
|
-
recycleItems =
|
|
381
|
+
drawDistance = 250,
|
|
382
|
+
recycleItems = false,
|
|
383
383
|
onEndReachedThreshold = 0.5,
|
|
384
384
|
maintainScrollAtEnd = false,
|
|
385
385
|
maintainScrollAtEndThreshold = 0.1,
|
|
@@ -833,7 +833,7 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
833
833
|
scrollToEnd: refScroller.current.scrollToEnd
|
|
834
834
|
};
|
|
835
835
|
}, []);
|
|
836
|
-
return /* @__PURE__ */
|
|
836
|
+
return /* @__PURE__ */ React6.createElement(
|
|
837
837
|
ListComponent,
|
|
838
838
|
{
|
|
839
839
|
...rest,
|