@legendapp/list 3.0.0-beta.54 → 3.0.0-beta.55
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/animated.d.ts +13 -0
- package/index.d.ts +17 -0
- package/index.js +333 -81
- package/index.mjs +333 -81
- package/index.native.js +255 -59
- package/index.native.mjs +256 -60
- package/package.json +1 -1
- package/react-native.d.ts +13 -0
- package/react-native.js +255 -59
- package/react-native.mjs +256 -60
- package/react-native.web.d.ts +13 -0
- package/react-native.web.js +333 -81
- package/react-native.web.mjs +333 -81
- package/react.d.ts +13 -0
- package/react.js +333 -81
- package/react.mjs +333 -81
- package/reanimated.d.ts +13 -0
- package/section-list.d.ts +13 -0
package/react.mjs
CHANGED
|
@@ -13,6 +13,115 @@ var View = forwardRef(function View2(props, ref) {
|
|
|
13
13
|
});
|
|
14
14
|
var Text = View;
|
|
15
15
|
|
|
16
|
+
// src/platform/Platform.ts
|
|
17
|
+
var Platform = {
|
|
18
|
+
// Widen the type to avoid unreachable-branch lints in cross-platform code that compares against other OSes
|
|
19
|
+
OS: "web"
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/utils/rtl.ts
|
|
23
|
+
function clampHorizontalOffset(offset, maxOffset) {
|
|
24
|
+
if (maxOffset === void 0) {
|
|
25
|
+
return offset;
|
|
26
|
+
}
|
|
27
|
+
return Math.max(0, Math.min(maxOffset, offset));
|
|
28
|
+
}
|
|
29
|
+
function getHorizontalMaxOffset(state, contentWidth) {
|
|
30
|
+
if (contentWidth === void 0 || !Number.isFinite(contentWidth) || !Number.isFinite(state.scrollLength) || contentWidth <= state.scrollLength) {
|
|
31
|
+
return contentWidth !== void 0 && Number.isFinite(contentWidth) && Number.isFinite(state.scrollLength) ? 0 : void 0;
|
|
32
|
+
}
|
|
33
|
+
return Math.max(0, contentWidth - state.scrollLength);
|
|
34
|
+
}
|
|
35
|
+
function getDefaultHorizontalRTLScrollType() {
|
|
36
|
+
return "normal" ;
|
|
37
|
+
}
|
|
38
|
+
function getNativeHorizontalRTLScrollType(state) {
|
|
39
|
+
var _a3;
|
|
40
|
+
return (_a3 = state == null ? void 0 : state.horizontalRTLScrollType) != null ? _a3 : getDefaultHorizontalRTLScrollType();
|
|
41
|
+
}
|
|
42
|
+
function isRTLProps(props) {
|
|
43
|
+
var _a3;
|
|
44
|
+
return (_a3 = props == null ? void 0 : props.rtl) != null ? _a3 : false;
|
|
45
|
+
}
|
|
46
|
+
function isHorizontalRTL(state) {
|
|
47
|
+
return isHorizontalRTLProps(state == null ? void 0 : state.props);
|
|
48
|
+
}
|
|
49
|
+
function isHorizontalRTLProps(props) {
|
|
50
|
+
return !!(props == null ? void 0 : props.horizontal) && isRTLProps(props);
|
|
51
|
+
}
|
|
52
|
+
function getLogicalHorizontalMaxOffset(state, contentWidth) {
|
|
53
|
+
var _a3;
|
|
54
|
+
return (_a3 = getHorizontalMaxOffset(state, contentWidth)) != null ? _a3 : 0;
|
|
55
|
+
}
|
|
56
|
+
function getHorizontalInsetEnd(state, inset) {
|
|
57
|
+
if (!inset) {
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
return (isHorizontalRTL(state) ? inset.left : inset.right) || 0;
|
|
61
|
+
}
|
|
62
|
+
function toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, listSize) {
|
|
63
|
+
if (!isHorizontalRTL(state) || listSize === void 0 || !Number.isFinite(listSize)) {
|
|
64
|
+
return logicalPosition;
|
|
65
|
+
}
|
|
66
|
+
return Math.max(0, listSize - logicalPosition - itemSize);
|
|
67
|
+
}
|
|
68
|
+
function toNativeHorizontalOffset(state, logicalOffset, contentWidth) {
|
|
69
|
+
if (!state || !isHorizontalRTL(state)) {
|
|
70
|
+
return logicalOffset;
|
|
71
|
+
}
|
|
72
|
+
const maxOffset = getHorizontalMaxOffset(state, contentWidth);
|
|
73
|
+
const clampedLogicalOffset = clampHorizontalOffset(logicalOffset, maxOffset);
|
|
74
|
+
const mode = getNativeHorizontalRTLScrollType(state);
|
|
75
|
+
if (mode === "negative") {
|
|
76
|
+
return clampedLogicalOffset === 0 ? 0 : -clampedLogicalOffset;
|
|
77
|
+
}
|
|
78
|
+
if (mode === "inverted") {
|
|
79
|
+
if (maxOffset === void 0) {
|
|
80
|
+
return clampedLogicalOffset;
|
|
81
|
+
}
|
|
82
|
+
return clampHorizontalOffset(maxOffset - clampedLogicalOffset, maxOffset);
|
|
83
|
+
}
|
|
84
|
+
return clampedLogicalOffset;
|
|
85
|
+
}
|
|
86
|
+
function toLogicalHorizontalOffset(state, rawOffset, contentWidth) {
|
|
87
|
+
if (!isHorizontalRTL(state)) {
|
|
88
|
+
state.horizontalRTLScrollType = void 0;
|
|
89
|
+
return rawOffset;
|
|
90
|
+
}
|
|
91
|
+
const maxOffset = getHorizontalMaxOffset(state, contentWidth);
|
|
92
|
+
if (rawOffset < 0) {
|
|
93
|
+
state.horizontalRTLScrollType = "negative";
|
|
94
|
+
return clampHorizontalOffset(-rawOffset, maxOffset);
|
|
95
|
+
}
|
|
96
|
+
if (maxOffset === void 0) {
|
|
97
|
+
return rawOffset;
|
|
98
|
+
}
|
|
99
|
+
const normalOffset = rawOffset;
|
|
100
|
+
const invertedOffset = maxOffset - rawOffset;
|
|
101
|
+
if (!Number.isFinite(invertedOffset)) {
|
|
102
|
+
state.horizontalRTLScrollType = "normal";
|
|
103
|
+
return normalOffset;
|
|
104
|
+
}
|
|
105
|
+
const previousMode = state.horizontalRTLScrollType;
|
|
106
|
+
if (previousMode === "inverted") {
|
|
107
|
+
return clampHorizontalOffset(invertedOffset, maxOffset);
|
|
108
|
+
}
|
|
109
|
+
if (previousMode === "normal") {
|
|
110
|
+
return clampHorizontalOffset(normalOffset, maxOffset);
|
|
111
|
+
}
|
|
112
|
+
if (!state.hasScrolled) {
|
|
113
|
+
const defaultMode = getDefaultHorizontalRTLScrollType();
|
|
114
|
+
state.horizontalRTLScrollType = defaultMode;
|
|
115
|
+
return clampHorizontalOffset(normalOffset, maxOffset);
|
|
116
|
+
}
|
|
117
|
+
const referenceScroll = state.scroll;
|
|
118
|
+
const distanceNormal = Math.abs(normalOffset - referenceScroll);
|
|
119
|
+
const distanceInverted = Math.abs(invertedOffset - referenceScroll);
|
|
120
|
+
const useInverted = distanceInverted + 0.5 < distanceNormal;
|
|
121
|
+
state.horizontalRTLScrollType = useInverted ? "inverted" : "normal";
|
|
122
|
+
return clampHorizontalOffset(useInverted ? invertedOffset : normalOffset, maxOffset);
|
|
123
|
+
}
|
|
124
|
+
|
|
16
125
|
// src/platform/Animated.tsx
|
|
17
126
|
var createAnimatedValue = (value) => value;
|
|
18
127
|
|
|
@@ -155,7 +264,7 @@ function getContentInsetEnd(ctx, contentInsetEndAdjustmentOverride) {
|
|
|
155
264
|
const horizontal = props.horizontal;
|
|
156
265
|
const contentInset = props.contentInset;
|
|
157
266
|
const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
|
|
158
|
-
const baseEndInset = (horizontal ?
|
|
267
|
+
const baseEndInset = (horizontal ? getHorizontalInsetEnd(state, baseInset) : baseInset == null ? void 0 : baseInset.bottom) || 0;
|
|
159
268
|
const contentInsetEndAdjustment = getContentInsetEndAdjustmentEnd(
|
|
160
269
|
contentInsetEndAdjustmentOverride != null ? contentInsetEndAdjustmentOverride : props.contentInsetEndAdjustment
|
|
161
270
|
);
|
|
@@ -164,9 +273,9 @@ function getContentInsetEnd(ctx, contentInsetEndAdjustmentOverride) {
|
|
|
164
273
|
const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
|
|
165
274
|
const adjustedBaseEndInset = baseEndInset + contentInsetEndAdjustment;
|
|
166
275
|
if (overrideInset) {
|
|
167
|
-
const mergedInset = { bottom: 0, right: 0, ...baseInset, ...overrideInset };
|
|
276
|
+
const mergedInset = { bottom: 0, left: 0, right: 0, ...baseInset, ...overrideInset };
|
|
168
277
|
return Math.max(
|
|
169
|
-
((horizontal ? mergedInset
|
|
278
|
+
((horizontal ? getHorizontalInsetEnd(state, mergedInset) : mergedInset.bottom) || 0) + contentInsetEndAdjustment,
|
|
170
279
|
anchoredEndInset
|
|
171
280
|
);
|
|
172
281
|
}
|
|
@@ -260,6 +369,15 @@ var ENABLE_DEVMODE = IS_DEV && false;
|
|
|
260
369
|
var ENABLE_DEBUG_VIEW = IS_DEV && false;
|
|
261
370
|
var typedForwardRef = React3.forwardRef;
|
|
262
371
|
var typedMemo = React3.memo;
|
|
372
|
+
var getComponent = (Component) => {
|
|
373
|
+
if (React3.isValidElement(Component)) {
|
|
374
|
+
return Component;
|
|
375
|
+
}
|
|
376
|
+
if (Component) {
|
|
377
|
+
return /* @__PURE__ */ React3.createElement(Component, null);
|
|
378
|
+
}
|
|
379
|
+
return null;
|
|
380
|
+
};
|
|
263
381
|
|
|
264
382
|
// src/utils/helpers.ts
|
|
265
383
|
function isFunction(obj) {
|
|
@@ -286,7 +404,8 @@ function comparatorDefault(a, b) {
|
|
|
286
404
|
}
|
|
287
405
|
function getPadding(s, type) {
|
|
288
406
|
var _a3, _b, _c;
|
|
289
|
-
|
|
407
|
+
const axisPadding = type === "Left" || type === "Right" ? s.paddingHorizontal : s.paddingVertical;
|
|
408
|
+
return (_c = (_b = (_a3 = s[`padding${type}`]) != null ? _a3 : axisPadding) != null ? _b : s.padding) != null ? _c : 0;
|
|
290
409
|
}
|
|
291
410
|
function extractPadding(style, contentContainerStyle, type) {
|
|
292
411
|
return getPadding(style, type) + getPadding(contentContainerStyle, type);
|
|
@@ -308,6 +427,14 @@ function findContainerId(ctx, key) {
|
|
|
308
427
|
}
|
|
309
428
|
|
|
310
429
|
// src/components/PositionView.tsx
|
|
430
|
+
var isRNWeb = typeof document !== "undefined" && !!document.getElementById("react-native-stylesheet");
|
|
431
|
+
var baseCss = {
|
|
432
|
+
contain: "paint layout style",
|
|
433
|
+
...isRNWeb ? {
|
|
434
|
+
display: "flex",
|
|
435
|
+
flexDirection: "column"
|
|
436
|
+
} : {}
|
|
437
|
+
};
|
|
311
438
|
var PositionViewState = typedMemo(function PositionViewState2({
|
|
312
439
|
id,
|
|
313
440
|
horizontal,
|
|
@@ -316,11 +443,8 @@ var PositionViewState = typedMemo(function PositionViewState2({
|
|
|
316
443
|
...props
|
|
317
444
|
}) {
|
|
318
445
|
const [position = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);
|
|
319
|
-
const base = {
|
|
320
|
-
contain: "paint layout style"
|
|
321
|
-
};
|
|
322
446
|
const composed = isArray(style) ? Object.assign({}, ...style) : style;
|
|
323
|
-
const combinedStyle = horizontal ? { ...
|
|
447
|
+
const combinedStyle = horizontal ? { ...baseCss, ...composed, left: position } : { ...baseCss, ...composed, top: position };
|
|
324
448
|
const {
|
|
325
449
|
animatedScrollY: _animatedScrollY,
|
|
326
450
|
index,
|
|
@@ -348,9 +472,6 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
348
472
|
`containerPosition${id}`,
|
|
349
473
|
"activeStickyIndex"
|
|
350
474
|
]);
|
|
351
|
-
const base = {
|
|
352
|
-
contain: "paint layout style"
|
|
353
|
-
};
|
|
354
475
|
const composed = React3.useMemo(
|
|
355
476
|
() => {
|
|
356
477
|
var _a3;
|
|
@@ -360,10 +481,9 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
360
481
|
);
|
|
361
482
|
const viewStyle = React3.useMemo(() => {
|
|
362
483
|
var _a3;
|
|
363
|
-
const styleBase = { ...
|
|
484
|
+
const styleBase = { ...baseCss, ...composed };
|
|
364
485
|
delete styleBase.transform;
|
|
365
|
-
const
|
|
366
|
-
const offset = stickyConfigOffset != null ? stickyConfigOffset : 0;
|
|
486
|
+
const offset = (_a3 = stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset) != null ? _a3 : 0;
|
|
367
487
|
const isActive = activeStickyIndex === index;
|
|
368
488
|
styleBase.position = isActive ? "sticky" : "absolute";
|
|
369
489
|
styleBase.zIndex = index + 1e3;
|
|
@@ -374,6 +494,20 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
374
494
|
}
|
|
375
495
|
return styleBase;
|
|
376
496
|
}, [composed, horizontal, position, index, activeStickyIndex, stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset]);
|
|
497
|
+
const renderStickyHeaderBackdrop = React3.useMemo(
|
|
498
|
+
() => (stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.backdropComponent) ? /* @__PURE__ */ React3.createElement(
|
|
499
|
+
"div",
|
|
500
|
+
{
|
|
501
|
+
style: {
|
|
502
|
+
inset: 0,
|
|
503
|
+
pointerEvents: "none",
|
|
504
|
+
position: "absolute"
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
getComponent(stickyHeaderConfig.backdropComponent)
|
|
508
|
+
) : null,
|
|
509
|
+
[stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.backdropComponent]
|
|
510
|
+
);
|
|
377
511
|
return /* @__PURE__ */ React3.createElement(
|
|
378
512
|
"div",
|
|
379
513
|
{
|
|
@@ -382,6 +516,7 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
382
516
|
style: viewStyle,
|
|
383
517
|
...webProps
|
|
384
518
|
},
|
|
519
|
+
renderStickyHeaderBackdrop,
|
|
385
520
|
children
|
|
386
521
|
);
|
|
387
522
|
});
|
|
@@ -646,12 +781,6 @@ function toLayout(rect) {
|
|
|
646
781
|
};
|
|
647
782
|
}
|
|
648
783
|
|
|
649
|
-
// src/platform/Platform.ts
|
|
650
|
-
var Platform = {
|
|
651
|
-
// Widen the type to avoid unreachable-branch lints in cross-platform code that compares against other OSes
|
|
652
|
-
OS: "web"
|
|
653
|
-
};
|
|
654
|
-
|
|
655
784
|
// src/utils/hasActiveMVCPAnchorLock.ts
|
|
656
785
|
function hasActiveMVCPAnchorLock(state) {
|
|
657
786
|
const lock = state.mvcpAnchorLock;
|
|
@@ -675,6 +804,7 @@ function getContainerPositionStyle({
|
|
|
675
804
|
columnWrapperStyle,
|
|
676
805
|
horizontal,
|
|
677
806
|
hasItemSeparator,
|
|
807
|
+
isHorizontalRTLList,
|
|
678
808
|
numColumns,
|
|
679
809
|
otherAxisPos,
|
|
680
810
|
otherAxisSize
|
|
@@ -698,6 +828,7 @@ function getContainerPositionStyle({
|
|
|
698
828
|
}
|
|
699
829
|
return horizontal ? {
|
|
700
830
|
boxSizing: paddingStyles ? "border-box" : void 0,
|
|
831
|
+
direction: isHorizontalRTLList && Platform.OS === "web" ? "ltr" : void 0,
|
|
701
832
|
flexDirection: hasItemSeparator ? "row" : void 0,
|
|
702
833
|
height: otherAxisSize,
|
|
703
834
|
left: 0,
|
|
@@ -726,6 +857,7 @@ var Container = typedMemo(function Container2({
|
|
|
726
857
|
}) {
|
|
727
858
|
const ctx = useStateContext();
|
|
728
859
|
const { columnWrapperStyle, animatedScrollY } = ctx;
|
|
860
|
+
const isHorizontalRTLList = isHorizontalRTL(ctx.state);
|
|
729
861
|
const positionComponentInternal = ctx.state.props.positionComponentInternal;
|
|
730
862
|
const stickyPositionComponentInternal = ctx.state.props.stickyPositionComponentInternal;
|
|
731
863
|
const [column = 0, span = 1, data, numColumns = 1, extraData, isSticky] = useArr$([
|
|
@@ -757,11 +889,20 @@ var Container = typedMemo(function Container2({
|
|
|
757
889
|
columnWrapperStyle,
|
|
758
890
|
hasItemSeparator: !!ItemSeparatorComponent,
|
|
759
891
|
horizontal,
|
|
892
|
+
isHorizontalRTLList,
|
|
760
893
|
numColumns,
|
|
761
894
|
otherAxisPos,
|
|
762
895
|
otherAxisSize
|
|
763
896
|
}),
|
|
764
|
-
[
|
|
897
|
+
[
|
|
898
|
+
horizontal,
|
|
899
|
+
isHorizontalRTLList,
|
|
900
|
+
otherAxisPos,
|
|
901
|
+
otherAxisSize,
|
|
902
|
+
columnWrapperStyle,
|
|
903
|
+
numColumns,
|
|
904
|
+
ItemSeparatorComponent
|
|
905
|
+
]
|
|
765
906
|
);
|
|
766
907
|
const renderedItemInfo = useMemo(
|
|
767
908
|
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
@@ -1001,9 +1142,16 @@ var ContainersInner = typedMemo(function ContainersInner2({ horizontal, numColum
|
|
|
1001
1142
|
const ref = useRef(null);
|
|
1002
1143
|
const ctx = useStateContext();
|
|
1003
1144
|
const columnWrapperStyle = ctx.columnWrapperStyle;
|
|
1145
|
+
const isHorizontalRTLList = isHorizontalRTL(ctx.state);
|
|
1004
1146
|
const [otherAxisSize, readyToRender, totalSize] = useArr$(["otherAxisSize", "readyToRender", "totalSize"]);
|
|
1005
1147
|
useDOMOrder(ref);
|
|
1006
|
-
const style = horizontal ? {
|
|
1148
|
+
const style = horizontal ? {
|
|
1149
|
+
direction: isHorizontalRTLList ? "ltr" : void 0,
|
|
1150
|
+
minHeight: otherAxisSize,
|
|
1151
|
+
opacity: readyToRender ? 1 : 0,
|
|
1152
|
+
position: "relative",
|
|
1153
|
+
width: totalSize
|
|
1154
|
+
} : { height: totalSize, minWidth: otherAxisSize, opacity: readyToRender ? 1 : 0, position: "relative" };
|
|
1007
1155
|
if (!readyToRender) {
|
|
1008
1156
|
style.pointerEvents = "none";
|
|
1009
1157
|
}
|
|
@@ -1214,6 +1362,31 @@ function getContentInsetEndAdjustmentEnd2(ctx) {
|
|
|
1214
1362
|
const adjustment = (_b = (_a3 = ctx.state) == null ? void 0 : _a3.props) == null ? void 0 : _b.contentInsetEndAdjustment;
|
|
1215
1363
|
return Math.max(0, adjustment != null ? adjustment : 0);
|
|
1216
1364
|
}
|
|
1365
|
+
function getFiniteSnapOffsets(snapToOffsets) {
|
|
1366
|
+
if (!(snapToOffsets == null ? void 0 : snapToOffsets.length)) {
|
|
1367
|
+
return [];
|
|
1368
|
+
}
|
|
1369
|
+
const snapOffsets = [];
|
|
1370
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1371
|
+
for (const offset of snapToOffsets) {
|
|
1372
|
+
if (Number.isFinite(offset) && !seen.has(offset)) {
|
|
1373
|
+
seen.add(offset);
|
|
1374
|
+
snapOffsets.push(offset);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
return snapOffsets;
|
|
1378
|
+
}
|
|
1379
|
+
function getSnapAnchorStyle(offset, horizontal) {
|
|
1380
|
+
return {
|
|
1381
|
+
height: horizontal ? "100%" : 1,
|
|
1382
|
+
left: horizontal ? offset : 0,
|
|
1383
|
+
pointerEvents: "none",
|
|
1384
|
+
position: "absolute",
|
|
1385
|
+
scrollSnapAlign: "start",
|
|
1386
|
+
top: horizontal ? 0 : offset,
|
|
1387
|
+
width: horizontal ? 1 : "100%"
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1217
1390
|
var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
|
|
1218
1391
|
children,
|
|
1219
1392
|
style,
|
|
@@ -1231,7 +1404,7 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
|
|
|
1231
1404
|
onLayout,
|
|
1232
1405
|
...props
|
|
1233
1406
|
}, ref) {
|
|
1234
|
-
var _a3, _b, _c;
|
|
1407
|
+
var _a3, _b, _c, _d;
|
|
1235
1408
|
const ctx = useStateContext();
|
|
1236
1409
|
const [anchoredEndSpaceSize] = useArr$(["anchoredEndSpaceSize"]);
|
|
1237
1410
|
const scrollRef = useRef(null);
|
|
@@ -1446,10 +1619,16 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
|
|
|
1446
1619
|
contentInset: _contentInset,
|
|
1447
1620
|
scrollEventThrottle: _scrollEventThrottle,
|
|
1448
1621
|
ScrollComponent: _ScrollComponent,
|
|
1622
|
+
snapToOffsets,
|
|
1449
1623
|
useWindowScroll: _useWindowScroll,
|
|
1450
1624
|
className: scrollViewClassNameProp,
|
|
1451
1625
|
...webProps
|
|
1452
1626
|
} = props;
|
|
1627
|
+
const snapOffsets = !isWindowScroll ? getFiniteSnapOffsets(snapToOffsets) : [];
|
|
1628
|
+
if (snapOffsets.length > 0) {
|
|
1629
|
+
scrollViewStyle.scrollSnapType = horizontal ? "x mandatory" : "y mandatory";
|
|
1630
|
+
contentStyle.position = (_d = contentStyle.position) != null ? _d : "relative";
|
|
1631
|
+
}
|
|
1453
1632
|
const scrollViewClassName = hiddenScrollIndicatorClassName ? scrollViewClassNameProp ? `${scrollViewClassNameProp} ${hiddenScrollIndicatorClassName}` : hiddenScrollIndicatorClassName : scrollViewClassNameProp;
|
|
1454
1633
|
if (IS_DEV) {
|
|
1455
1634
|
if (/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(
|
|
@@ -1470,9 +1649,29 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
|
|
|
1470
1649
|
style: scrollViewStyle
|
|
1471
1650
|
},
|
|
1472
1651
|
refreshControl,
|
|
1473
|
-
/* @__PURE__ */ React3.createElement("div", { className, ref: contentRef, style: contentStyle },
|
|
1652
|
+
/* @__PURE__ */ React3.createElement("div", { className, ref: contentRef, style: contentStyle }, snapOffsets.map((offset) => /* @__PURE__ */ React3.createElement(
|
|
1653
|
+
"div",
|
|
1654
|
+
{
|
|
1655
|
+
"aria-hidden": true,
|
|
1656
|
+
"data-legend-list-snap-anchor": offset,
|
|
1657
|
+
key: `snap-${offset}`,
|
|
1658
|
+
style: getSnapAnchorStyle(offset, horizontal)
|
|
1659
|
+
}
|
|
1660
|
+
)), children, contentInsetEndAdjustmentSpacerStyle ? /* @__PURE__ */ React3.createElement("div", { "aria-hidden": true, style: contentInsetEndAdjustmentSpacerStyle }) : null)
|
|
1474
1661
|
);
|
|
1475
1662
|
});
|
|
1663
|
+
|
|
1664
|
+
// src/components/listComponentStyles.ts
|
|
1665
|
+
function getAutoOtherAxisStyle({
|
|
1666
|
+
horizontal,
|
|
1667
|
+
needsOtherAxisSize,
|
|
1668
|
+
otherAxisSize
|
|
1669
|
+
}) {
|
|
1670
|
+
if (!needsOtherAxisSize || !otherAxisSize || otherAxisSize <= 0) {
|
|
1671
|
+
return void 0;
|
|
1672
|
+
}
|
|
1673
|
+
return horizontal ? { height: otherAxisSize } : { width: otherAxisSize };
|
|
1674
|
+
}
|
|
1476
1675
|
function useValueListener$(key, callback) {
|
|
1477
1676
|
const ctx = useStateContext();
|
|
1478
1677
|
useLayoutEffect(() => {
|
|
@@ -1567,10 +1766,10 @@ function ScrollAdjust() {
|
|
|
1567
1766
|
useValueListener$("scrollAdjustUserOffset", callback);
|
|
1568
1767
|
return null;
|
|
1569
1768
|
}
|
|
1570
|
-
|
|
1769
|
+
var SnapWrapper = React3.forwardRef(function SnapWrapperInner({ ScrollComponent, ...props }, ref) {
|
|
1571
1770
|
const [snapToOffsets] = useArr$(["snapToOffsets"]);
|
|
1572
|
-
return /* @__PURE__ */ React3.createElement(ScrollComponent, { ...props, snapToOffsets });
|
|
1573
|
-
}
|
|
1771
|
+
return /* @__PURE__ */ React3.createElement(ScrollComponent, { ...props, ref, snapToOffsets });
|
|
1772
|
+
});
|
|
1574
1773
|
function WebAnchoredEndSpace({ horizontal }) {
|
|
1575
1774
|
const ctx = useStateContext();
|
|
1576
1775
|
const [anchoredEndSpaceSize] = useArr$(["anchoredEndSpaceSize"]);
|
|
@@ -1587,15 +1786,6 @@ var LayoutView = ({ onLayoutChange, refView, children, ...rest }) => {
|
|
|
1587
1786
|
useOnLayoutSync({ onLayoutChange, ref });
|
|
1588
1787
|
return /* @__PURE__ */ React3.createElement("div", { ...rest, ref }, children);
|
|
1589
1788
|
};
|
|
1590
|
-
var getComponent = (Component) => {
|
|
1591
|
-
if (React3.isValidElement(Component)) {
|
|
1592
|
-
return Component;
|
|
1593
|
-
}
|
|
1594
|
-
if (Component) {
|
|
1595
|
-
return /* @__PURE__ */ React3.createElement(Component, null);
|
|
1596
|
-
}
|
|
1597
|
-
return null;
|
|
1598
|
-
};
|
|
1599
1789
|
|
|
1600
1790
|
// src/components/ListComponent.tsx
|
|
1601
1791
|
var ListComponent = typedMemo(function ListComponent2({
|
|
@@ -1628,6 +1818,12 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1628
1818
|
}) {
|
|
1629
1819
|
const ctx = useStateContext();
|
|
1630
1820
|
const maintainVisibleContentPosition = ctx.state.props.maintainVisibleContentPosition;
|
|
1821
|
+
const [otherAxisSize = 0] = useArr$(["otherAxisSize"]);
|
|
1822
|
+
const autoOtherAxisStyle = getAutoOtherAxisStyle({
|
|
1823
|
+
horizontal,
|
|
1824
|
+
needsOtherAxisSize: ctx.state.needsOtherAxisSize,
|
|
1825
|
+
otherAxisSize
|
|
1826
|
+
});
|
|
1631
1827
|
const ScrollComponent = useMemo(() => {
|
|
1632
1828
|
if (!renderScrollComponent) {
|
|
1633
1829
|
return ListComponentScrollView;
|
|
@@ -1666,10 +1862,10 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1666
1862
|
...rest,
|
|
1667
1863
|
...ScrollComponent === ListComponentScrollView ? { useWindowScroll } : {},
|
|
1668
1864
|
contentContainerStyle: [
|
|
1669
|
-
contentContainerStyle,
|
|
1670
1865
|
horizontal ? {
|
|
1671
1866
|
height: "100%"
|
|
1672
|
-
} : {}
|
|
1867
|
+
} : {},
|
|
1868
|
+
contentContainerStyle
|
|
1673
1869
|
],
|
|
1674
1870
|
contentOffset: initialContentOffset !== void 0 ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
1675
1871
|
horizontal,
|
|
@@ -1678,7 +1874,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1678
1874
|
onScroll: onScroll2,
|
|
1679
1875
|
ref: refScrollView,
|
|
1680
1876
|
ScrollComponent: snapToIndices ? ScrollComponent : void 0,
|
|
1681
|
-
style
|
|
1877
|
+
style: autoOtherAxisStyle ? [autoOtherAxisStyle, style] : style
|
|
1682
1878
|
},
|
|
1683
1879
|
/* @__PURE__ */ React3.createElement(ScrollAdjust, null),
|
|
1684
1880
|
ListHeaderComponent && /* @__PURE__ */ React3.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
|
|
@@ -2395,7 +2591,8 @@ function doScrollTo(ctx, params) {
|
|
|
2395
2591
|
}
|
|
2396
2592
|
const isAnimated = !!animated;
|
|
2397
2593
|
const isHorizontal = !!horizontal;
|
|
2398
|
-
const
|
|
2594
|
+
const contentSize = isHorizontal ? getContentSize(ctx) : void 0;
|
|
2595
|
+
const left = isHorizontal ? toNativeHorizontalOffset(state, offset, contentSize) : 0;
|
|
2399
2596
|
const top = isHorizontal ? 0 : offset;
|
|
2400
2597
|
scroller.scrollTo({ animated: isAnimated, x: left, y: top });
|
|
2401
2598
|
if (isAnimated) {
|
|
@@ -3456,7 +3653,14 @@ function handleInitialScrollLayoutReady(ctx) {
|
|
|
3456
3653
|
}
|
|
3457
3654
|
function initializeInitialScrollOnMount(ctx, options) {
|
|
3458
3655
|
var _a3, _b;
|
|
3459
|
-
const {
|
|
3656
|
+
const {
|
|
3657
|
+
alwaysDispatchInitialScroll,
|
|
3658
|
+
dataLength,
|
|
3659
|
+
hasFooterComponent,
|
|
3660
|
+
initialContentOffset,
|
|
3661
|
+
initialScrollAtEnd,
|
|
3662
|
+
useBootstrapInitialScroll
|
|
3663
|
+
} = options;
|
|
3460
3664
|
const state = ctx.state;
|
|
3461
3665
|
const initialScroll = state.initialScroll;
|
|
3462
3666
|
const resolvedInitialContentOffset = initialContentOffset != null ? initialContentOffset : 0;
|
|
@@ -3476,7 +3680,7 @@ function initializeInitialScrollOnMount(ctx, options) {
|
|
|
3476
3680
|
return;
|
|
3477
3681
|
}
|
|
3478
3682
|
const hasPendingDataDependentInitialScroll = !!initialScroll && dataLength === 0 && !(resolvedInitialContentOffset === 0 && !initialScrollAtEnd);
|
|
3479
|
-
if (!resolvedInitialContentOffset && !hasPendingDataDependentInitialScroll) {
|
|
3683
|
+
if (!alwaysDispatchInitialScroll && !resolvedInitialContentOffset && !hasPendingDataDependentInitialScroll) {
|
|
3480
3684
|
if (initialScroll && !initialScrollAtEnd) {
|
|
3481
3685
|
finishInitialScroll(ctx, {
|
|
3482
3686
|
resolvedOffset: resolvedInitialContentOffset
|
|
@@ -3797,9 +4001,18 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
3797
4001
|
}
|
|
3798
4002
|
}
|
|
3799
4003
|
|
|
4004
|
+
// src/core/resetLayoutCachesForDataChange.ts
|
|
4005
|
+
function resetLayoutCachesForDataChange(state) {
|
|
4006
|
+
state.indexByKey.clear();
|
|
4007
|
+
state.idCache.length = 0;
|
|
4008
|
+
state.positions.length = 0;
|
|
4009
|
+
state.columns.length = 0;
|
|
4010
|
+
state.columnSpans.length = 0;
|
|
4011
|
+
}
|
|
4012
|
+
|
|
3800
4013
|
// src/core/syncMountedContainer.ts
|
|
3801
4014
|
function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
3802
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
4015
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3803
4016
|
const state = ctx.state;
|
|
3804
4017
|
const {
|
|
3805
4018
|
columns,
|
|
@@ -3811,7 +4024,8 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3811
4024
|
if (item === void 0) {
|
|
3812
4025
|
return { didChangePosition: false, didRefreshData: false };
|
|
3813
4026
|
}
|
|
3814
|
-
const
|
|
4027
|
+
const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
|
|
4028
|
+
const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
|
|
3815
4029
|
let didChangePosition = false;
|
|
3816
4030
|
let didRefreshData = false;
|
|
3817
4031
|
if (updateLayout) {
|
|
@@ -3820,7 +4034,9 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3820
4034
|
set$(ctx, `containerPosition${containerIndex}`, POSITION_OUT_OF_VIEW);
|
|
3821
4035
|
return { didChangePosition: false, didRefreshData: false };
|
|
3822
4036
|
}
|
|
3823
|
-
const
|
|
4037
|
+
const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
|
|
4038
|
+
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
|
|
4039
|
+
const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
|
|
3824
4040
|
const column = columns[itemIndex] || 1;
|
|
3825
4041
|
const span = columnSpans[itemIndex] || 1;
|
|
3826
4042
|
const prevPos = peek$(ctx, `containerPosition${containerIndex}`);
|
|
@@ -3839,15 +4055,15 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3839
4055
|
}
|
|
3840
4056
|
const prevData = peek$(ctx, `containerItemData${containerIndex}`);
|
|
3841
4057
|
if (prevData !== item) {
|
|
3842
|
-
const pendingDataComparison = ((
|
|
3843
|
-
const cachedComparison = (
|
|
4058
|
+
const pendingDataComparison = ((_e = state.pendingDataComparison) == null ? void 0 : _e.previousData) === state.previousData && ((_f = state.pendingDataComparison) == null ? void 0 : _f.nextData) === data ? state.pendingDataComparison : void 0;
|
|
4059
|
+
const cachedComparison = (_g = pendingDataComparison == null ? void 0 : pendingDataComparison.byIndex[itemIndex]) != null ? _g : 0;
|
|
3844
4060
|
if (cachedComparison === 2) {
|
|
3845
4061
|
set$(ctx, `containerItemData${containerIndex}`, item);
|
|
3846
4062
|
didRefreshData = true;
|
|
3847
4063
|
} else if (cachedComparison !== 1) {
|
|
3848
|
-
const
|
|
4064
|
+
const nextItemKey = (_h = peek$(ctx, `containerItemKey${containerIndex}`)) != null ? _h : itemKey;
|
|
3849
4065
|
const prevKey = keyExtractor == null ? void 0 : keyExtractor(prevData, itemIndex);
|
|
3850
|
-
if (prevData === void 0 || !keyExtractor || prevKey !==
|
|
4066
|
+
if (prevData === void 0 || !keyExtractor || prevKey !== nextItemKey) {
|
|
3851
4067
|
set$(ctx, `containerItemData${containerIndex}`, item);
|
|
3852
4068
|
didRefreshData = true;
|
|
3853
4069
|
} else if (!itemsAreEqual) {
|
|
@@ -3864,7 +4080,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3864
4080
|
};
|
|
3865
4081
|
}
|
|
3866
4082
|
}
|
|
3867
|
-
if ((
|
|
4083
|
+
if ((_i = state.pendingDataComparison) == null ? void 0 : _i.byIndex) {
|
|
3868
4084
|
state.pendingDataComparison.byIndex[itemIndex] = isEqual ? 1 : 2;
|
|
3869
4085
|
}
|
|
3870
4086
|
if (!isEqual) {
|
|
@@ -4029,11 +4245,13 @@ function updateSnapToOffsets(ctx) {
|
|
|
4029
4245
|
const {
|
|
4030
4246
|
props: { snapToIndices }
|
|
4031
4247
|
} = state;
|
|
4248
|
+
const contentSize = state.props.horizontal ? getContentSize(ctx) : void 0;
|
|
4032
4249
|
const snapToOffsets = Array(snapToIndices.length);
|
|
4033
4250
|
for (let i = 0; i < snapToIndices.length; i++) {
|
|
4034
4251
|
const idx = snapToIndices[i];
|
|
4035
4252
|
getId(state, idx);
|
|
4036
|
-
|
|
4253
|
+
const logicalOffset = state.positions[idx];
|
|
4254
|
+
snapToOffsets[i] = toNativeHorizontalOffset(state, logicalOffset, contentSize);
|
|
4037
4255
|
}
|
|
4038
4256
|
set$(ctx, "snapToOffsets", snapToOffsets);
|
|
4039
4257
|
}
|
|
@@ -4642,7 +4860,6 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4642
4860
|
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
4643
4861
|
const {
|
|
4644
4862
|
columns,
|
|
4645
|
-
columnSpans,
|
|
4646
4863
|
containerItemKeys,
|
|
4647
4864
|
enableScrollForNextCalculateItemsInView,
|
|
4648
4865
|
idCache,
|
|
@@ -4692,8 +4909,10 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4692
4909
|
let scrollTopBuffered = 0;
|
|
4693
4910
|
let scrollBottom = 0;
|
|
4694
4911
|
let scrollBottomBuffered = 0;
|
|
4912
|
+
let nativeScrollState = scrollState;
|
|
4695
4913
|
const updateScroll2 = (nextScrollState) => {
|
|
4696
4914
|
var _a4;
|
|
4915
|
+
nativeScrollState = nextScrollState;
|
|
4697
4916
|
scrollAdjustPending = (_a4 = peek$(ctx, "scrollAdjustPending")) != null ? _a4 : 0;
|
|
4698
4917
|
scrollAdjustPad = scrollAdjustPending - topPad;
|
|
4699
4918
|
scroll = Math.round(nextScrollState + scrollExtra + scrollAdjustPad);
|
|
@@ -4705,9 +4924,17 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4705
4924
|
const previousStickyIndex = peek$(ctx, "activeStickyIndex");
|
|
4706
4925
|
const currentStickyIdx = stickyIndicesArr.length > 0 ? findCurrentStickyIndex(stickyIndicesArr, scroll, state) : -1;
|
|
4707
4926
|
const nextActiveStickyIndex = currentStickyIdx >= 0 ? stickyIndicesArr[currentStickyIdx] : -1;
|
|
4927
|
+
const stickyIndexDidChange = previousStickyIndex !== nextActiveStickyIndex;
|
|
4708
4928
|
if (currentStickyIdx >= 0 || previousStickyIndex >= 0) {
|
|
4709
4929
|
set$(ctx, "activeStickyIndex", nextActiveStickyIndex);
|
|
4710
4930
|
}
|
|
4931
|
+
const shouldNotifyStickyHeaderChange = !!onStickyHeaderChange && stickyIndicesArr.length > 0 && stickyIndexDidChange;
|
|
4932
|
+
const finishCalculateItemsInView = shouldNotifyStickyHeaderChange ? () => {
|
|
4933
|
+
const item = data[nextActiveStickyIndex];
|
|
4934
|
+
if (item !== void 0) {
|
|
4935
|
+
onStickyHeaderChange == null ? void 0 : onStickyHeaderChange({ index: nextActiveStickyIndex, item });
|
|
4936
|
+
}
|
|
4937
|
+
} : void 0;
|
|
4711
4938
|
let scrollBufferTop = drawDistance;
|
|
4712
4939
|
let scrollBufferBottom = drawDistance;
|
|
4713
4940
|
if (speed > 0 || speed === 0 && scroll < Math.max(50, drawDistance)) {
|
|
@@ -4718,8 +4945,10 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4718
4945
|
scrollBufferBottom = drawDistance * 0.5;
|
|
4719
4946
|
}
|
|
4720
4947
|
const updateScrollRange = () => {
|
|
4721
|
-
|
|
4722
|
-
|
|
4948
|
+
const scrollStart = Math.max(0, scroll);
|
|
4949
|
+
const overscrollBeforeContent = Math.max(0, -nativeScrollState);
|
|
4950
|
+
scrollTopBuffered = scrollStart - scrollBufferTop;
|
|
4951
|
+
scrollBottom = Math.max(scrollStart, scroll + scrollLength + overscrollBeforeContent);
|
|
4723
4952
|
scrollBottomBuffered = scrollBottom + scrollBufferBottom;
|
|
4724
4953
|
};
|
|
4725
4954
|
updateScrollRange();
|
|
@@ -4729,17 +4958,14 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4729
4958
|
state.scrollForNextCalculateItemsInView = void 0;
|
|
4730
4959
|
} else if ((top === null || scrollTopBuffered > top) && (bottom === null || scrollBottomBuffered < bottom)) {
|
|
4731
4960
|
if (!isInMVCPActiveMode(state)) {
|
|
4961
|
+
finishCalculateItemsInView == null ? void 0 : finishCalculateItemsInView();
|
|
4732
4962
|
return;
|
|
4733
4963
|
}
|
|
4734
4964
|
}
|
|
4735
4965
|
}
|
|
4736
4966
|
const checkMVCP = doMVCP && !suppressInitialScrollSideEffects ? prepareMVCP(ctx, dataChanged) : void 0;
|
|
4737
4967
|
if (dataChanged) {
|
|
4738
|
-
|
|
4739
|
-
idCache.length = 0;
|
|
4740
|
-
positions.length = 0;
|
|
4741
|
-
columns.length = 0;
|
|
4742
|
-
columnSpans.length = 0;
|
|
4968
|
+
resetLayoutCachesForDataChange(state);
|
|
4743
4969
|
}
|
|
4744
4970
|
const startIndex = forceFullItemPositions || dataChanged ? 0 : (_c = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _c : 0;
|
|
4745
4971
|
const optimizeForVisibleWindow = !forceFullItemPositions && !dataChanged && numColumns > 1 && minIndexSizeChanged !== void 0;
|
|
@@ -5053,12 +5279,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
5053
5279
|
);
|
|
5054
5280
|
}
|
|
5055
5281
|
}
|
|
5056
|
-
|
|
5057
|
-
const item = data[nextActiveStickyIndex];
|
|
5058
|
-
if (item !== void 0) {
|
|
5059
|
-
onStickyHeaderChange({ index: nextActiveStickyIndex, item });
|
|
5060
|
-
}
|
|
5061
|
-
}
|
|
5282
|
+
finishCalculateItemsInView == null ? void 0 : finishCalculateItemsInView();
|
|
5062
5283
|
});
|
|
5063
5284
|
}
|
|
5064
5285
|
|
|
@@ -5086,11 +5307,22 @@ function doMaintainScrollAtEnd(ctx) {
|
|
|
5086
5307
|
if (!state.maintainingScrollAtEnd) {
|
|
5087
5308
|
state.maintainingScrollAtEnd = true;
|
|
5088
5309
|
requestAnimationFrame(() => {
|
|
5089
|
-
var _a3;
|
|
5090
5310
|
if (peek$(ctx, "isWithinMaintainScrollAtEndThreshold")) {
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5311
|
+
const scroller = refScroller.current;
|
|
5312
|
+
if (state.props.horizontal && isHorizontalRTL(state)) {
|
|
5313
|
+
const currentContentSize = getContentSize(ctx);
|
|
5314
|
+
const logicalEndOffset = getLogicalHorizontalMaxOffset(state, currentContentSize);
|
|
5315
|
+
const nativeOffset = toNativeHorizontalOffset(state, logicalEndOffset, currentContentSize);
|
|
5316
|
+
scroller == null ? void 0 : scroller.scrollTo({
|
|
5317
|
+
animated: maintainScrollAtEnd.animated,
|
|
5318
|
+
x: nativeOffset,
|
|
5319
|
+
y: 0
|
|
5320
|
+
});
|
|
5321
|
+
} else {
|
|
5322
|
+
scroller == null ? void 0 : scroller.scrollToEnd({
|
|
5323
|
+
animated: maintainScrollAtEnd.animated
|
|
5324
|
+
});
|
|
5325
|
+
}
|
|
5094
5326
|
setTimeout(
|
|
5095
5327
|
() => {
|
|
5096
5328
|
state.maintainingScrollAtEnd = false;
|
|
@@ -5290,7 +5522,8 @@ function handleLayout(ctx, layoutParam, setCanRender) {
|
|
|
5290
5522
|
}
|
|
5291
5523
|
checkThresholds(ctx);
|
|
5292
5524
|
if (state) {
|
|
5293
|
-
|
|
5525
|
+
const crossAxisPadding = state.props.horizontal ? (state.props.stylePaddingTop || 0) + (state.props.stylePaddingBottom || 0) : (state.props.stylePaddingLeft || 0) + (state.props.stylePaddingRight || 0);
|
|
5526
|
+
state.needsOtherAxisSize = otherAxisSize - crossAxisPadding < 10;
|
|
5294
5527
|
}
|
|
5295
5528
|
if (IS_DEV && measuredLength === 0) {
|
|
5296
5529
|
warnDevOnce(
|
|
@@ -5404,7 +5637,7 @@ function cloneScrollEvent(event) {
|
|
|
5404
5637
|
};
|
|
5405
5638
|
}
|
|
5406
5639
|
function onScroll(ctx, event) {
|
|
5407
|
-
var _a3, _b, _c, _d;
|
|
5640
|
+
var _a3, _b, _c, _d, _e;
|
|
5408
5641
|
const state = ctx.state;
|
|
5409
5642
|
const { scrollProcessingEnabled } = state;
|
|
5410
5643
|
if (scrollProcessingEnabled === false) {
|
|
@@ -5423,6 +5656,9 @@ function onScroll(ctx, event) {
|
|
|
5423
5656
|
}
|
|
5424
5657
|
}
|
|
5425
5658
|
let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
|
|
5659
|
+
if (state.props.horizontal) {
|
|
5660
|
+
newScroll = toLogicalHorizontalOffset(state, newScroll, (_e = event.nativeEvent.contentSize) == null ? void 0 : _e.width);
|
|
5661
|
+
}
|
|
5426
5662
|
if (state.scrollingTo && state.scrollingTo.offset >= newScroll) {
|
|
5427
5663
|
const maxOffset = clampScrollOffset(ctx, newScroll, state.scrollingTo);
|
|
5428
5664
|
if (newScroll !== maxOffset && Math.abs(newScroll - maxOffset) > 1) {
|
|
@@ -5594,6 +5830,16 @@ function runOrScheduleMVCPRecalculate(ctx) {
|
|
|
5594
5830
|
});
|
|
5595
5831
|
}
|
|
5596
5832
|
}
|
|
5833
|
+
function updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal) {
|
|
5834
|
+
const state = ctx.state;
|
|
5835
|
+
if (state.needsOtherAxisSize) {
|
|
5836
|
+
const otherAxisSize = horizontal ? sizeObj.height : sizeObj.width;
|
|
5837
|
+
const currentOtherAxisSize = peek$(ctx, "otherAxisSize");
|
|
5838
|
+
if (!currentOtherAxisSize || otherAxisSize > currentOtherAxisSize) {
|
|
5839
|
+
set$(ctx, "otherAxisSize", otherAxisSize);
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
}
|
|
5597
5843
|
function updateItemSize(ctx, itemKey, sizeObj) {
|
|
5598
5844
|
var _a3;
|
|
5599
5845
|
const state = ctx.state;
|
|
@@ -5617,13 +5863,13 @@ function updateItemSize(ctx, itemKey, sizeObj) {
|
|
|
5617
5863
|
const type = getItemType ? (_a3 = getItemType(itemData, index)) != null ? _a3 : "" : "";
|
|
5618
5864
|
const size2 = getFixedItemSize(itemData, index, type);
|
|
5619
5865
|
if (size2 !== void 0 && size2 === sizesKnown.get(itemKey)) {
|
|
5866
|
+
updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal);
|
|
5620
5867
|
return;
|
|
5621
5868
|
}
|
|
5622
5869
|
}
|
|
5623
5870
|
let needsRecalculate = !didContainersLayout;
|
|
5624
5871
|
let shouldMaintainScrollAtEnd = false;
|
|
5625
5872
|
let minIndexSizeChanged;
|
|
5626
|
-
let maxOtherAxisSize = peek$(ctx, "otherAxisSize") || 0;
|
|
5627
5873
|
const prevSizeKnown = state.sizesKnown.get(itemKey);
|
|
5628
5874
|
const diff = updateOneItemSize(ctx, itemKey, sizeObj);
|
|
5629
5875
|
const size = roundSize(horizontal ? sizeObj.width : sizeObj.height);
|
|
@@ -5634,10 +5880,6 @@ function updateItemSize(ctx, itemKey, sizeObj) {
|
|
|
5634
5880
|
if (!needsRecalculate && state.containerItemKeys.has(itemKey)) {
|
|
5635
5881
|
needsRecalculate = true;
|
|
5636
5882
|
}
|
|
5637
|
-
if (state.needsOtherAxisSize) {
|
|
5638
|
-
const otherAxisSize = horizontal ? sizeObj.height : sizeObj.width;
|
|
5639
|
-
maxOtherAxisSize = Math.max(maxOtherAxisSize, otherAxisSize);
|
|
5640
|
-
}
|
|
5641
5883
|
if (prevSizeKnown !== void 0 && Math.abs(prevSizeKnown - size) > 5) {
|
|
5642
5884
|
shouldMaintainScrollAtEnd = true;
|
|
5643
5885
|
}
|
|
@@ -5653,10 +5895,7 @@ function updateItemSize(ctx, itemKey, sizeObj) {
|
|
|
5653
5895
|
if (minIndexSizeChanged !== void 0) {
|
|
5654
5896
|
state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, minIndexSizeChanged) : minIndexSizeChanged;
|
|
5655
5897
|
}
|
|
5656
|
-
|
|
5657
|
-
if (!cur || maxOtherAxisSize > cur) {
|
|
5658
|
-
set$(ctx, "otherAxisSize", maxOtherAxisSize);
|
|
5659
|
-
}
|
|
5898
|
+
updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal);
|
|
5660
5899
|
if (didContainersLayout || checkAllSizesKnown(state, getMountedBufferedIndices(state))) {
|
|
5661
5900
|
if (needsRecalculate) {
|
|
5662
5901
|
state.scrollForNextCalculateItemsInView = void 0;
|
|
@@ -6231,7 +6470,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6231
6470
|
getFixedItemSize,
|
|
6232
6471
|
getItemType,
|
|
6233
6472
|
horizontal,
|
|
6473
|
+
rtl,
|
|
6234
6474
|
initialContainerPoolRatio = 3,
|
|
6475
|
+
estimatedHeaderSize,
|
|
6235
6476
|
initialScrollAtEnd = false,
|
|
6236
6477
|
initialScrollIndex: initialScrollIndexProp,
|
|
6237
6478
|
initialScrollOffset: initialScrollOffsetProp,
|
|
@@ -6299,13 +6540,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6299
6540
|
const style = { ...StyleSheet.flatten(styleProp) };
|
|
6300
6541
|
const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
|
|
6301
6542
|
const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
|
|
6543
|
+
const stylePaddingLeftState = extractPadding(style, contentContainerStyle, "Left");
|
|
6544
|
+
const stylePaddingRightState = extractPadding(style, contentContainerStyle, "Right");
|
|
6302
6545
|
const maintainScrollAtEndConfig = normalizeMaintainScrollAtEnd(maintainScrollAtEnd);
|
|
6303
6546
|
const maintainVisibleContentPositionConfig = normalizeMaintainVisibleContentPosition(
|
|
6304
6547
|
maintainVisibleContentPositionProp
|
|
6305
6548
|
);
|
|
6306
6549
|
const hasInitialScrollIndex = initialScrollIndexProp !== void 0 && initialScrollIndexProp !== null;
|
|
6307
6550
|
const hasInitialScrollOffset = initialScrollOffsetProp !== void 0 && initialScrollOffsetProp !== null;
|
|
6308
|
-
const
|
|
6551
|
+
const shouldInitializeHorizontalRTL = !initialScrollAtEnd && !hasInitialScrollIndex && !hasInitialScrollOffset && isHorizontalRTLProps({ horizontal, rtl });
|
|
6552
|
+
const initialScrollUsesOffsetOnly = !initialScrollAtEnd && !hasInitialScrollIndex && (hasInitialScrollOffset || shouldInitializeHorizontalRTL);
|
|
6309
6553
|
const usesBootstrapInitialScroll = initialScrollAtEnd || hasInitialScrollIndex;
|
|
6310
6554
|
const initialScrollProp = initialScrollAtEnd ? {
|
|
6311
6555
|
index: Math.max(0, dataProp.length - 1),
|
|
@@ -6421,6 +6665,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6421
6665
|
internalState.reprocessCurrentScroll = () => updateScroll(ctx, internalState.scroll, true);
|
|
6422
6666
|
set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPositionConfig);
|
|
6423
6667
|
set$(ctx, "extraData", extraData);
|
|
6668
|
+
if (estimatedHeaderSize !== void 0) {
|
|
6669
|
+
set$(ctx, "headerSize", estimatedHeaderSize);
|
|
6670
|
+
}
|
|
6424
6671
|
}
|
|
6425
6672
|
refState.current = ctx.state;
|
|
6426
6673
|
}
|
|
@@ -6480,11 +6727,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6480
6727
|
positionComponentInternal,
|
|
6481
6728
|
recycleItems: !!recycleItems,
|
|
6482
6729
|
renderItem,
|
|
6730
|
+
rtl,
|
|
6483
6731
|
snapToIndices,
|
|
6484
6732
|
stickyIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],
|
|
6485
6733
|
stickyIndicesSet: useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),
|
|
6486
6734
|
stickyPositionComponentInternal,
|
|
6487
6735
|
stylePaddingBottom: stylePaddingBottomState,
|
|
6736
|
+
stylePaddingLeft: stylePaddingLeftState,
|
|
6737
|
+
stylePaddingRight: stylePaddingRightState,
|
|
6488
6738
|
stylePaddingTop: stylePaddingTopState,
|
|
6489
6739
|
useWindowScroll: useWindowScrollResolved
|
|
6490
6740
|
};
|
|
@@ -6507,6 +6757,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6507
6757
|
};
|
|
6508
6758
|
if (isFirstLocal) {
|
|
6509
6759
|
initializeStateVars(false);
|
|
6760
|
+
resetLayoutCachesForDataChange(state);
|
|
6510
6761
|
updateItemPositions(
|
|
6511
6762
|
ctx,
|
|
6512
6763
|
/*dataChanged*/
|
|
@@ -6524,6 +6775,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6524
6775
|
}, [usesBootstrapInitialScroll]);
|
|
6525
6776
|
useLayoutEffect(() => {
|
|
6526
6777
|
initializeInitialScrollOnMount(ctx, {
|
|
6778
|
+
alwaysDispatchInitialScroll: shouldInitializeHorizontalRTL,
|
|
6527
6779
|
dataLength: dataProp.length,
|
|
6528
6780
|
hasFooterComponent: !!ListFooterComponent,
|
|
6529
6781
|
initialContentOffset,
|