@legendapp/list 2.1.0-beta.11 → 2.1.0-beta.13
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.d.mts +8 -664
- package/index.d.ts +8 -664
- package/index.js +175 -136
- package/index.mjs +175 -136
- package/index.native.d.mts +8 -664
- package/index.native.d.ts +8 -664
- package/index.native.js +154 -135
- package/index.native.mjs +154 -135
- package/package.json +1 -1
- package/section-list.d.mts +113 -0
- package/section-list.d.ts +113 -0
- package/section-list.js +3924 -0
- package/section-list.mjs +3903 -0
- package/section-list.native.d.mts +113 -0
- package/section-list.native.d.ts +113 -0
- package/section-list.native.js +3703 -0
- package/section-list.native.mjs +3682 -0
- package/types-JPHClxiw.d.mts +670 -0
- package/types-JPHClxiw.d.ts +670 -0
- package/types-YNdphn_A.d.mts +670 -0
- package/types-YNdphn_A.d.ts +670 -0
package/index.native.js
CHANGED
|
@@ -832,7 +832,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
832
832
|
scrollAdjustHandler,
|
|
833
833
|
onLayoutHeader,
|
|
834
834
|
snapToIndices,
|
|
835
|
-
|
|
835
|
+
stickyHeaderIndices,
|
|
836
836
|
...rest
|
|
837
837
|
}) {
|
|
838
838
|
const ctx = useStateContext();
|
|
@@ -867,7 +867,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
867
867
|
ScrollComponent: snapToIndices ? ScrollComponent : void 0,
|
|
868
868
|
style
|
|
869
869
|
},
|
|
870
|
-
|
|
870
|
+
/* @__PURE__ */ React2__namespace.createElement(ScrollAdjust, null),
|
|
871
871
|
ENABLE_DEVMODE ? /* @__PURE__ */ React2__namespace.createElement(PaddingDevMode, null) : /* @__PURE__ */ React2__namespace.createElement(Padding, null),
|
|
872
872
|
ListHeaderComponent && /* @__PURE__ */ React2__namespace.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
|
|
873
873
|
ListEmptyComponent && getComponent(ListEmptyComponent),
|
|
@@ -1060,6 +1060,70 @@ function calculateOffsetWithOffsetPosition(ctx, state, offsetParam, params) {
|
|
|
1060
1060
|
return offset;
|
|
1061
1061
|
}
|
|
1062
1062
|
|
|
1063
|
+
// src/core/finishScrollTo.ts
|
|
1064
|
+
function finishScrollTo(ctx, state) {
|
|
1065
|
+
var _a3, _b;
|
|
1066
|
+
if (state) {
|
|
1067
|
+
state.scrollHistory.length = 0;
|
|
1068
|
+
state.initialScroll = void 0;
|
|
1069
|
+
state.initialAnchor = void 0;
|
|
1070
|
+
set$(ctx, "scrollingTo", void 0);
|
|
1071
|
+
if (state.pendingTotalSize !== void 0) {
|
|
1072
|
+
addTotalSize(ctx, state, null, state.pendingTotalSize);
|
|
1073
|
+
}
|
|
1074
|
+
if ((_a3 = state.props) == null ? void 0 : _a3.data) {
|
|
1075
|
+
(_b = state.triggerCalculateItemsInView) == null ? void 0 : _b.call(state, { forceFullItemPositions: true });
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
var Platform2 = reactNative.Platform;
|
|
1080
|
+
|
|
1081
|
+
// src/core/scrollTo.ts
|
|
1082
|
+
function scrollTo(ctx, state, params) {
|
|
1083
|
+
var _a3;
|
|
1084
|
+
const { noScrollingTo, ...scrollTarget } = params;
|
|
1085
|
+
const { animated, isInitialScroll, offset: scrollTargetOffset, precomputedWithViewOffset } = scrollTarget;
|
|
1086
|
+
const {
|
|
1087
|
+
refScroller,
|
|
1088
|
+
props: { horizontal }
|
|
1089
|
+
} = state;
|
|
1090
|
+
let offset = precomputedWithViewOffset ? scrollTargetOffset : calculateOffsetWithOffsetPosition(ctx, state, scrollTargetOffset, scrollTarget);
|
|
1091
|
+
if (Number.isFinite(state.scrollLength) && Number.isFinite(state.totalSize)) {
|
|
1092
|
+
const maxOffset = Math.max(0, getContentSize(ctx) - state.scrollLength);
|
|
1093
|
+
offset = Math.min(offset, maxOffset);
|
|
1094
|
+
}
|
|
1095
|
+
state.scrollHistory.length = 0;
|
|
1096
|
+
if (!noScrollingTo) {
|
|
1097
|
+
set$(ctx, "scrollingTo", scrollTarget);
|
|
1098
|
+
}
|
|
1099
|
+
state.scrollPending = offset;
|
|
1100
|
+
if (!isInitialScroll || Platform2.OS === "android") {
|
|
1101
|
+
(_a3 = refScroller.current) == null ? void 0 : _a3.scrollTo({
|
|
1102
|
+
animated: !!animated,
|
|
1103
|
+
x: horizontal ? offset : 0,
|
|
1104
|
+
y: horizontal ? 0 : offset
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
if (!animated) {
|
|
1108
|
+
state.scroll = offset;
|
|
1109
|
+
if (Platform2.OS === "web") {
|
|
1110
|
+
const unlisten = listen$(ctx, "containersDidLayout", (value) => {
|
|
1111
|
+
if (value && peek$(ctx, "scrollingTo")) {
|
|
1112
|
+
finishScrollTo(ctx, state);
|
|
1113
|
+
unlisten();
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
} else {
|
|
1117
|
+
setTimeout(() => finishScrollTo(ctx, state), 100);
|
|
1118
|
+
}
|
|
1119
|
+
if (isInitialScroll) {
|
|
1120
|
+
setTimeout(() => {
|
|
1121
|
+
state.initialScroll = void 0;
|
|
1122
|
+
}, 500);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1063
1127
|
// src/utils/checkThreshold.ts
|
|
1064
1128
|
var HYSTERESIS_MULTIPLIER = 1.3;
|
|
1065
1129
|
var checkThreshold = (distance, atThreshold, threshold, wasReached, snapshot, context, onReached, setSnapshot) => {
|
|
@@ -1170,24 +1234,7 @@ function checkAtTop(state) {
|
|
|
1170
1234
|
);
|
|
1171
1235
|
}
|
|
1172
1236
|
|
|
1173
|
-
// src/core/
|
|
1174
|
-
function onScroll(ctx, state, event) {
|
|
1175
|
-
var _a3, _b, _c;
|
|
1176
|
-
const {
|
|
1177
|
-
scrollProcessingEnabled,
|
|
1178
|
-
props: { onScroll: onScrollProp }
|
|
1179
|
-
} = state;
|
|
1180
|
-
if (scrollProcessingEnabled === false) {
|
|
1181
|
-
return;
|
|
1182
|
-
}
|
|
1183
|
-
if (((_b = (_a3 = event.nativeEvent) == null ? void 0 : _a3.contentSize) == null ? void 0 : _b.height) === 0 && ((_c = event.nativeEvent.contentSize) == null ? void 0 : _c.width) === 0) {
|
|
1184
|
-
return;
|
|
1185
|
-
}
|
|
1186
|
-
const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
|
|
1187
|
-
state.scrollPending = newScroll;
|
|
1188
|
-
updateScroll(ctx, state, newScroll);
|
|
1189
|
-
onScrollProp == null ? void 0 : onScrollProp(event);
|
|
1190
|
-
}
|
|
1237
|
+
// src/core/updateScroll.ts
|
|
1191
1238
|
function updateScroll(ctx, state, newScroll, forceUpdate) {
|
|
1192
1239
|
var _a3;
|
|
1193
1240
|
const scrollingTo = peek$(ctx, "scrollingTo");
|
|
@@ -1230,61 +1277,6 @@ function updateScroll(ctx, state, newScroll, forceUpdate) {
|
|
|
1230
1277
|
}
|
|
1231
1278
|
}
|
|
1232
1279
|
|
|
1233
|
-
// src/core/finishScrollTo.ts
|
|
1234
|
-
function finishScrollTo(ctx, state) {
|
|
1235
|
-
var _a3, _b;
|
|
1236
|
-
if (state) {
|
|
1237
|
-
state.scrollHistory.length = 0;
|
|
1238
|
-
state.initialScroll = void 0;
|
|
1239
|
-
state.initialAnchor = void 0;
|
|
1240
|
-
set$(ctx, "scrollingTo", void 0);
|
|
1241
|
-
if (state.pendingTotalSize !== void 0) {
|
|
1242
|
-
addTotalSize(ctx, state, null, state.pendingTotalSize);
|
|
1243
|
-
}
|
|
1244
|
-
if ((_a3 = state.props) == null ? void 0 : _a3.data) {
|
|
1245
|
-
(_b = state.triggerCalculateItemsInView) == null ? void 0 : _b.call(state, { forceFullItemPositions: true });
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
var Platform2 = reactNative.Platform;
|
|
1250
|
-
|
|
1251
|
-
// src/core/scrollTo.ts
|
|
1252
|
-
function scrollTo(ctx, state, params) {
|
|
1253
|
-
var _a3;
|
|
1254
|
-
const { noScrollingTo, ...scrollTarget } = params;
|
|
1255
|
-
const { animated, isInitialScroll, offset: scrollTargetOffset, precomputedWithViewOffset } = scrollTarget;
|
|
1256
|
-
const {
|
|
1257
|
-
refScroller,
|
|
1258
|
-
props: { horizontal }
|
|
1259
|
-
} = state;
|
|
1260
|
-
let offset = precomputedWithViewOffset ? scrollTargetOffset : calculateOffsetWithOffsetPosition(ctx, state, scrollTargetOffset, scrollTarget);
|
|
1261
|
-
if (Number.isFinite(state.scrollLength) && Number.isFinite(state.totalSize)) {
|
|
1262
|
-
const maxOffset = Math.max(0, getContentSize(ctx) - state.scrollLength);
|
|
1263
|
-
offset = Math.min(offset, maxOffset);
|
|
1264
|
-
}
|
|
1265
|
-
state.scrollHistory.length = 0;
|
|
1266
|
-
if (!noScrollingTo) {
|
|
1267
|
-
set$(ctx, "scrollingTo", scrollTarget);
|
|
1268
|
-
}
|
|
1269
|
-
state.scrollPending = offset;
|
|
1270
|
-
if (!isInitialScroll || Platform2.OS === "android") {
|
|
1271
|
-
(_a3 = refScroller.current) == null ? void 0 : _a3.scrollTo({
|
|
1272
|
-
animated: !!animated,
|
|
1273
|
-
x: horizontal ? offset : 0,
|
|
1274
|
-
y: horizontal ? 0 : offset
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1277
|
-
if (!animated) {
|
|
1278
|
-
state.scroll = offset;
|
|
1279
|
-
setTimeout(() => finishScrollTo(ctx, state), 100);
|
|
1280
|
-
if (isInitialScroll) {
|
|
1281
|
-
setTimeout(() => {
|
|
1282
|
-
state.initialScroll = void 0;
|
|
1283
|
-
}, 500);
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
1280
|
// src/utils/requestAdjust.ts
|
|
1289
1281
|
function requestAdjust(ctx, state, positionDiff, dataChanged) {
|
|
1290
1282
|
if (Math.abs(positionDiff) > 0.1) {
|
|
@@ -1297,6 +1289,9 @@ function requestAdjust(ctx, state, positionDiff, dataChanged) {
|
|
|
1297
1289
|
});
|
|
1298
1290
|
} else {
|
|
1299
1291
|
state.scrollAdjustHandler.requestAdjust(positionDiff);
|
|
1292
|
+
if (state.adjustingFromInitialMount) {
|
|
1293
|
+
state.adjustingFromInitialMount--;
|
|
1294
|
+
}
|
|
1300
1295
|
}
|
|
1301
1296
|
};
|
|
1302
1297
|
state.scroll += positionDiff;
|
|
@@ -1329,6 +1324,7 @@ function requestAdjust(ctx, state, positionDiff, dataChanged) {
|
|
|
1329
1324
|
}, delay);
|
|
1330
1325
|
}
|
|
1331
1326
|
} else {
|
|
1327
|
+
state.adjustingFromInitialMount = (state.adjustingFromInitialMount || 0) + 1;
|
|
1332
1328
|
requestAnimationFrame(doit);
|
|
1333
1329
|
}
|
|
1334
1330
|
}
|
|
@@ -1388,18 +1384,16 @@ function ensureInitialAnchor(ctx, state) {
|
|
|
1388
1384
|
|
|
1389
1385
|
// src/core/mvcp.ts
|
|
1390
1386
|
function prepareMVCP(ctx, state, dataChanged) {
|
|
1391
|
-
const {
|
|
1392
|
-
|
|
1393
|
-
positions,
|
|
1394
|
-
props: { maintainVisibleContentPosition }
|
|
1395
|
-
} = state;
|
|
1387
|
+
const { idsInView, positions, props } = state;
|
|
1388
|
+
const { maintainVisibleContentPosition } = props;
|
|
1396
1389
|
const scrollingTo = peek$(ctx, "scrollingTo");
|
|
1397
1390
|
let prevPosition;
|
|
1398
1391
|
let targetId;
|
|
1399
1392
|
const idsInViewWithPositions = [];
|
|
1400
1393
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1401
|
-
|
|
1402
|
-
|
|
1394
|
+
const shouldMVCP = !dataChanged || maintainVisibleContentPosition;
|
|
1395
|
+
const indexByKey = state.indexByKey;
|
|
1396
|
+
if (shouldMVCP) {
|
|
1403
1397
|
if (scrollTarget !== void 0) {
|
|
1404
1398
|
if (!IsNewArchitecture && (scrollingTo == null ? void 0 : scrollingTo.isInitialScroll)) {
|
|
1405
1399
|
return void 0;
|
|
@@ -1415,44 +1409,44 @@ function prepareMVCP(ctx, state, dataChanged) {
|
|
|
1415
1409
|
}
|
|
1416
1410
|
}
|
|
1417
1411
|
} else {
|
|
1418
|
-
targetId =
|
|
1412
|
+
targetId = idsInView.find((id) => indexByKey.get(id) !== void 0);
|
|
1419
1413
|
}
|
|
1420
1414
|
}
|
|
1421
1415
|
if (targetId !== void 0) {
|
|
1422
1416
|
prevPosition = positions.get(targetId);
|
|
1423
1417
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1418
|
+
return () => {
|
|
1419
|
+
let positionDiff;
|
|
1420
|
+
if (dataChanged && targetId === void 0 && maintainVisibleContentPosition) {
|
|
1421
|
+
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1422
|
+
const { id, position } = idsInViewWithPositions[i];
|
|
1423
|
+
const newPosition = positions.get(id);
|
|
1424
|
+
if (newPosition !== void 0) {
|
|
1425
|
+
positionDiff = newPosition - position;
|
|
1426
|
+
break;
|
|
1427
|
+
}
|
|
1434
1428
|
}
|
|
1435
1429
|
}
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1430
|
+
if (targetId !== void 0 && prevPosition !== void 0) {
|
|
1431
|
+
const newPosition = positions.get(targetId);
|
|
1432
|
+
if (newPosition !== void 0) {
|
|
1433
|
+
const totalSize = getContentSize(ctx);
|
|
1434
|
+
let diff = newPosition - prevPosition;
|
|
1435
|
+
if (diff !== 0 && state.scroll + state.scrollLength > totalSize) {
|
|
1436
|
+
if (diff > 0) {
|
|
1437
|
+
diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
|
|
1438
|
+
} else {
|
|
1439
|
+
diff = 0;
|
|
1440
|
+
}
|
|
1447
1441
|
}
|
|
1442
|
+
positionDiff = diff;
|
|
1448
1443
|
}
|
|
1449
|
-
positionDiff = diff;
|
|
1450
1444
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1445
|
+
if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
|
|
1446
|
+
requestAdjust(ctx, state, positionDiff, dataChanged && maintainVisibleContentPosition);
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1456
1450
|
}
|
|
1457
1451
|
|
|
1458
1452
|
// src/core/prepareColumnStartState.ts
|
|
@@ -1594,7 +1588,8 @@ function updateSnapToOffsets(ctx, state) {
|
|
|
1594
1588
|
}
|
|
1595
1589
|
|
|
1596
1590
|
// src/core/updateItemPositions.ts
|
|
1597
|
-
function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false } = {
|
|
1591
|
+
function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false, doMVCP } = {
|
|
1592
|
+
doMVCP: false,
|
|
1598
1593
|
forceFullUpdate: false,
|
|
1599
1594
|
scrollBottomBuffered: -1,
|
|
1600
1595
|
startIndex: 0
|
|
@@ -1606,7 +1601,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
|
|
|
1606
1601
|
positions,
|
|
1607
1602
|
idCache,
|
|
1608
1603
|
sizesKnown,
|
|
1609
|
-
props: { getEstimatedItemSize, snapToIndices, enableAverages
|
|
1604
|
+
props: { getEstimatedItemSize, snapToIndices, enableAverages }
|
|
1610
1605
|
} = state;
|
|
1611
1606
|
const data = state.props.data;
|
|
1612
1607
|
const dataLength = data.length;
|
|
@@ -1617,7 +1612,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
|
|
|
1617
1612
|
const shouldOptimize = !forceFullUpdate && !dataChanged && Math.abs(getScrollVelocity(state)) > 0;
|
|
1618
1613
|
const maxVisibleArea = scrollBottomBuffered + 1e3;
|
|
1619
1614
|
const useAverageSize = enableAverages && !getEstimatedItemSize;
|
|
1620
|
-
const preferCachedSize =
|
|
1615
|
+
const preferCachedSize = !doMVCP || dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_a3 = peek$(ctx, "scrollAdjustPending")) != null ? _a3 : 0) !== 0;
|
|
1621
1616
|
let currentRowTop = 0;
|
|
1622
1617
|
let column = 1;
|
|
1623
1618
|
let maxSizeInRow = 0;
|
|
@@ -2083,14 +2078,14 @@ function findCurrentStickyIndex(stickyArray, scroll, state) {
|
|
|
2083
2078
|
}
|
|
2084
2079
|
return -1;
|
|
2085
2080
|
}
|
|
2086
|
-
function getActiveStickyIndices(ctx, state,
|
|
2081
|
+
function getActiveStickyIndices(ctx, state, stickyHeaderIndices) {
|
|
2087
2082
|
return new Set(
|
|
2088
|
-
Array.from(state.stickyContainerPool).map((i) => peek$(ctx, `containerItemKey${i}`)).map((key) => key ? state.indexByKey.get(key) : void 0).filter((idx) => idx !== void 0 &&
|
|
2083
|
+
Array.from(state.stickyContainerPool).map((i) => peek$(ctx, `containerItemKey${i}`)).map((key) => key ? state.indexByKey.get(key) : void 0).filter((idx) => idx !== void 0 && stickyHeaderIndices.has(idx))
|
|
2089
2084
|
);
|
|
2090
2085
|
}
|
|
2091
|
-
function handleStickyActivation(ctx, state,
|
|
2086
|
+
function handleStickyActivation(ctx, state, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
|
|
2092
2087
|
var _a3;
|
|
2093
|
-
const activeIndices = getActiveStickyIndices(ctx, state,
|
|
2088
|
+
const activeIndices = getActiveStickyIndices(ctx, state, stickyHeaderIndices);
|
|
2094
2089
|
state.activeStickyIndex = currentStickyIdx >= 0 ? stickyArray[currentStickyIdx] : void 0;
|
|
2095
2090
|
for (let offset = 0; offset <= 1; offset++) {
|
|
2096
2091
|
const idx = currentStickyIdx - offset;
|
|
@@ -2226,6 +2221,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
2226
2221
|
}
|
|
2227
2222
|
const startIndex = dataChanged ? 0 : (_b = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _b : 0;
|
|
2228
2223
|
updateItemPositions(ctx, state, dataChanged, {
|
|
2224
|
+
doMVCP,
|
|
2229
2225
|
forceFullUpdate: !!forceFullItemPositions,
|
|
2230
2226
|
scrollBottomBuffered,
|
|
2231
2227
|
startIndex
|
|
@@ -2520,6 +2516,7 @@ function doMaintainScrollAtEnd(ctx, state, animated) {
|
|
|
2520
2516
|
});
|
|
2521
2517
|
return true;
|
|
2522
2518
|
}
|
|
2519
|
+
return false;
|
|
2523
2520
|
}
|
|
2524
2521
|
|
|
2525
2522
|
// src/utils/updateAveragesOnDataChange.ts
|
|
@@ -2688,6 +2685,25 @@ function handleLayout(ctx, state, layout, setCanRender) {
|
|
|
2688
2685
|
setCanRender(true);
|
|
2689
2686
|
}
|
|
2690
2687
|
|
|
2688
|
+
// src/core/onScroll.ts
|
|
2689
|
+
function onScroll(ctx, state, event) {
|
|
2690
|
+
var _a3, _b, _c;
|
|
2691
|
+
const {
|
|
2692
|
+
scrollProcessingEnabled,
|
|
2693
|
+
props: { onScroll: onScrollProp }
|
|
2694
|
+
} = state;
|
|
2695
|
+
if (scrollProcessingEnabled === false) {
|
|
2696
|
+
return;
|
|
2697
|
+
}
|
|
2698
|
+
if (((_b = (_a3 = event.nativeEvent) == null ? void 0 : _a3.contentSize) == null ? void 0 : _b.height) === 0 && ((_c = event.nativeEvent.contentSize) == null ? void 0 : _c.width) === 0) {
|
|
2699
|
+
return;
|
|
2700
|
+
}
|
|
2701
|
+
const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
|
|
2702
|
+
state.scrollPending = newScroll;
|
|
2703
|
+
updateScroll(ctx, state, newScroll);
|
|
2704
|
+
onScrollProp == null ? void 0 : onScrollProp(event);
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2691
2707
|
// src/core/ScrollAdjustHandler.ts
|
|
2692
2708
|
var ScrollAdjustHandler = class {
|
|
2693
2709
|
constructor(ctx) {
|
|
@@ -2723,12 +2739,7 @@ var ScrollAdjustHandler = class {
|
|
|
2723
2739
|
set$(this.context, "scrollAdjustPending", this.pendingAdjust);
|
|
2724
2740
|
} else {
|
|
2725
2741
|
this.appliedAdjust += add;
|
|
2726
|
-
|
|
2727
|
-
if (this.mounted) {
|
|
2728
|
-
setter();
|
|
2729
|
-
} else {
|
|
2730
|
-
requestAnimationFrame(setter);
|
|
2731
|
-
}
|
|
2742
|
+
set$(this.context, "scrollAdjust", this.appliedAdjust);
|
|
2732
2743
|
}
|
|
2733
2744
|
}
|
|
2734
2745
|
setMounted() {
|
|
@@ -2890,9 +2901,9 @@ function getWindowSize() {
|
|
|
2890
2901
|
};
|
|
2891
2902
|
}
|
|
2892
2903
|
var StyleSheet = reactNative.StyleSheet;
|
|
2893
|
-
function useStickyScrollHandler(
|
|
2904
|
+
function useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, onScroll2) {
|
|
2894
2905
|
return React2.useMemo(() => {
|
|
2895
|
-
if (
|
|
2906
|
+
if (stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.length) {
|
|
2896
2907
|
const { animatedScrollY } = ctx;
|
|
2897
2908
|
return reactNative.Animated.event(
|
|
2898
2909
|
[
|
|
@@ -2909,7 +2920,7 @@ function useStickyScrollHandler(stickyIndices, horizontal, ctx, onScroll2) {
|
|
|
2909
2920
|
);
|
|
2910
2921
|
}
|
|
2911
2922
|
return onScroll2;
|
|
2912
|
-
}, [
|
|
2923
|
+
}, [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(","), horizontal]);
|
|
2913
2924
|
}
|
|
2914
2925
|
|
|
2915
2926
|
// src/utils/createColumnWrapperStyle.ts
|
|
@@ -3131,7 +3142,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3131
3142
|
ListHeaderComponent,
|
|
3132
3143
|
maintainScrollAtEnd = false,
|
|
3133
3144
|
maintainScrollAtEndThreshold = 0.1,
|
|
3134
|
-
maintainVisibleContentPosition =
|
|
3145
|
+
maintainVisibleContentPosition = false,
|
|
3135
3146
|
numColumns: numColumnsProp = 1,
|
|
3136
3147
|
onEndReached,
|
|
3137
3148
|
onEndReachedThreshold = 0.5,
|
|
@@ -3153,7 +3164,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3153
3164
|
renderItem,
|
|
3154
3165
|
scrollEventThrottle,
|
|
3155
3166
|
snapToIndices,
|
|
3156
|
-
|
|
3167
|
+
stickyHeaderIndices: stickyHeaderIndicesProp,
|
|
3168
|
+
stickyIndices: stickyIndicesDeprecated,
|
|
3157
3169
|
style: styleProp,
|
|
3158
3170
|
suggestEstimatedItemSize,
|
|
3159
3171
|
viewabilityConfig,
|
|
@@ -3175,6 +3187,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3175
3187
|
const estimatedItemSize = estimatedItemSizeProp != null ? estimatedItemSizeProp : DEFAULT_ITEM_SIZE;
|
|
3176
3188
|
const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
|
|
3177
3189
|
const keyExtractor = keyExtractorProp != null ? keyExtractorProp : (_item, index) => index.toString();
|
|
3190
|
+
const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
|
|
3191
|
+
if (IS_DEV && stickyIndicesDeprecated && !stickyHeaderIndicesProp) {
|
|
3192
|
+
warnDevOnce(
|
|
3193
|
+
"stickyIndices",
|
|
3194
|
+
"stickyIndices has been renamed to stickyHeaderIndices. Please update your props to use stickyHeaderIndices."
|
|
3195
|
+
);
|
|
3196
|
+
}
|
|
3178
3197
|
const refState = React2.useRef();
|
|
3179
3198
|
if (!refState.current) {
|
|
3180
3199
|
if (!ctx.internalState) {
|
|
@@ -3286,8 +3305,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3286
3305
|
renderItem,
|
|
3287
3306
|
scrollBuffer,
|
|
3288
3307
|
snapToIndices,
|
|
3289
|
-
stickyIndicesArr:
|
|
3290
|
-
stickyIndicesSet: React2.useMemo(() => new Set(
|
|
3308
|
+
stickyIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],
|
|
3309
|
+
stickyIndicesSet: React2.useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),
|
|
3291
3310
|
stylePaddingBottom: stylePaddingBottomState,
|
|
3292
3311
|
stylePaddingTop: stylePaddingTopState,
|
|
3293
3312
|
suggestEstimatedItemSize: !!suggestEstimatedItemSize
|
|
@@ -3307,7 +3326,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3307
3326
|
setPaddingTop(ctx, state, { stylePaddingTop: stylePaddingTopState });
|
|
3308
3327
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3309
3328
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3310
|
-
if (
|
|
3329
|
+
if (paddingDiff && prevPaddingTop !== void 0 && Platform2.OS === "ios") {
|
|
3311
3330
|
if (state.scroll < 0) {
|
|
3312
3331
|
paddingDiff += state.scroll;
|
|
3313
3332
|
}
|
|
@@ -3355,7 +3374,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3355
3374
|
state.initialScroll = updatedInitialScroll;
|
|
3356
3375
|
refState.current.isStartReached = clampedOffset < refState.current.scrollLength * onStartReachedThreshold;
|
|
3357
3376
|
return clampedOffset;
|
|
3358
|
-
}, [renderNum
|
|
3377
|
+
}, [renderNum]);
|
|
3359
3378
|
if (isFirstLocal || didDataChangeLocal || numColumnsProp !== peek$(ctx, "numColumns")) {
|
|
3360
3379
|
refState.current.lastBatchingAction = Date.now();
|
|
3361
3380
|
if (!keyExtractorProp && !isFirstLocal && didDataChangeLocal) {
|
|
@@ -3395,7 +3414,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3395
3414
|
precomputedWithViewOffset: true
|
|
3396
3415
|
});
|
|
3397
3416
|
}
|
|
3398
|
-
}, [initialContentOffset
|
|
3417
|
+
}, [initialContentOffset]);
|
|
3399
3418
|
const onLayoutChange = React2.useCallback((layout) => {
|
|
3400
3419
|
doInitialScroll();
|
|
3401
3420
|
handleLayout(ctx, state, layout, setCanRender);
|
|
@@ -3462,7 +3481,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3462
3481
|
}),
|
|
3463
3482
|
[]
|
|
3464
3483
|
);
|
|
3465
|
-
const onScrollHandler = useStickyScrollHandler(
|
|
3484
|
+
const onScrollHandler = useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, fns.onScroll);
|
|
3466
3485
|
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(
|
|
3467
3486
|
ListComponent,
|
|
3468
3487
|
{
|
|
@@ -3508,7 +3527,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3508
3527
|
scrollAdjustHandler: (_b = refState.current) == null ? void 0 : _b.scrollAdjustHandler,
|
|
3509
3528
|
scrollEventThrottle: Platform2.OS === "web" ? 16 : void 0,
|
|
3510
3529
|
snapToIndices,
|
|
3511
|
-
|
|
3530
|
+
stickyHeaderIndices,
|
|
3512
3531
|
style,
|
|
3513
3532
|
updateItemSize: fns.updateItemSize,
|
|
3514
3533
|
waitForInitialLayout
|