@legendapp/list 2.1.0-beta.12 → 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 -143
- package/index.mjs +175 -143
- package/index.native.d.mts +8 -664
- package/index.native.d.ts +8 -664
- package/index.native.js +154 -144
- package/index.native.mjs +154 -144
- 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,70 +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
|
-
if (Platform2.OS === "web") {
|
|
1280
|
-
const unlisten = listen$(ctx, "containersDidLayout", (value) => {
|
|
1281
|
-
if (value) {
|
|
1282
|
-
finishScrollTo(ctx, state);
|
|
1283
|
-
unlisten();
|
|
1284
|
-
}
|
|
1285
|
-
});
|
|
1286
|
-
} else {
|
|
1287
|
-
setTimeout(() => finishScrollTo(ctx, state), 100);
|
|
1288
|
-
}
|
|
1289
|
-
if (isInitialScroll) {
|
|
1290
|
-
setTimeout(() => {
|
|
1291
|
-
state.initialScroll = void 0;
|
|
1292
|
-
}, 500);
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
1280
|
// src/utils/requestAdjust.ts
|
|
1298
1281
|
function requestAdjust(ctx, state, positionDiff, dataChanged) {
|
|
1299
1282
|
if (Math.abs(positionDiff) > 0.1) {
|
|
@@ -1306,6 +1289,9 @@ function requestAdjust(ctx, state, positionDiff, dataChanged) {
|
|
|
1306
1289
|
});
|
|
1307
1290
|
} else {
|
|
1308
1291
|
state.scrollAdjustHandler.requestAdjust(positionDiff);
|
|
1292
|
+
if (state.adjustingFromInitialMount) {
|
|
1293
|
+
state.adjustingFromInitialMount--;
|
|
1294
|
+
}
|
|
1309
1295
|
}
|
|
1310
1296
|
};
|
|
1311
1297
|
state.scroll += positionDiff;
|
|
@@ -1338,6 +1324,7 @@ function requestAdjust(ctx, state, positionDiff, dataChanged) {
|
|
|
1338
1324
|
}, delay);
|
|
1339
1325
|
}
|
|
1340
1326
|
} else {
|
|
1327
|
+
state.adjustingFromInitialMount = (state.adjustingFromInitialMount || 0) + 1;
|
|
1341
1328
|
requestAnimationFrame(doit);
|
|
1342
1329
|
}
|
|
1343
1330
|
}
|
|
@@ -1397,18 +1384,16 @@ function ensureInitialAnchor(ctx, state) {
|
|
|
1397
1384
|
|
|
1398
1385
|
// src/core/mvcp.ts
|
|
1399
1386
|
function prepareMVCP(ctx, state, dataChanged) {
|
|
1400
|
-
const {
|
|
1401
|
-
|
|
1402
|
-
positions,
|
|
1403
|
-
props: { maintainVisibleContentPosition }
|
|
1404
|
-
} = state;
|
|
1387
|
+
const { idsInView, positions, props } = state;
|
|
1388
|
+
const { maintainVisibleContentPosition } = props;
|
|
1405
1389
|
const scrollingTo = peek$(ctx, "scrollingTo");
|
|
1406
1390
|
let prevPosition;
|
|
1407
1391
|
let targetId;
|
|
1408
1392
|
const idsInViewWithPositions = [];
|
|
1409
1393
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1410
|
-
|
|
1411
|
-
|
|
1394
|
+
const shouldMVCP = !dataChanged || maintainVisibleContentPosition;
|
|
1395
|
+
const indexByKey = state.indexByKey;
|
|
1396
|
+
if (shouldMVCP) {
|
|
1412
1397
|
if (scrollTarget !== void 0) {
|
|
1413
1398
|
if (!IsNewArchitecture && (scrollingTo == null ? void 0 : scrollingTo.isInitialScroll)) {
|
|
1414
1399
|
return void 0;
|
|
@@ -1424,44 +1409,44 @@ function prepareMVCP(ctx, state, dataChanged) {
|
|
|
1424
1409
|
}
|
|
1425
1410
|
}
|
|
1426
1411
|
} else {
|
|
1427
|
-
targetId =
|
|
1412
|
+
targetId = idsInView.find((id) => indexByKey.get(id) !== void 0);
|
|
1428
1413
|
}
|
|
1429
1414
|
}
|
|
1430
1415
|
if (targetId !== void 0) {
|
|
1431
1416
|
prevPosition = positions.get(targetId);
|
|
1432
1417
|
}
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
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
|
+
}
|
|
1443
1428
|
}
|
|
1444
1429
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
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
|
+
}
|
|
1456
1441
|
}
|
|
1442
|
+
positionDiff = diff;
|
|
1457
1443
|
}
|
|
1458
|
-
positionDiff = diff;
|
|
1459
1444
|
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1445
|
+
if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
|
|
1446
|
+
requestAdjust(ctx, state, positionDiff, dataChanged && maintainVisibleContentPosition);
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1465
1450
|
}
|
|
1466
1451
|
|
|
1467
1452
|
// src/core/prepareColumnStartState.ts
|
|
@@ -1603,7 +1588,8 @@ function updateSnapToOffsets(ctx, state) {
|
|
|
1603
1588
|
}
|
|
1604
1589
|
|
|
1605
1590
|
// src/core/updateItemPositions.ts
|
|
1606
|
-
function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false } = {
|
|
1591
|
+
function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false, doMVCP } = {
|
|
1592
|
+
doMVCP: false,
|
|
1607
1593
|
forceFullUpdate: false,
|
|
1608
1594
|
scrollBottomBuffered: -1,
|
|
1609
1595
|
startIndex: 0
|
|
@@ -1615,7 +1601,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
|
|
|
1615
1601
|
positions,
|
|
1616
1602
|
idCache,
|
|
1617
1603
|
sizesKnown,
|
|
1618
|
-
props: { getEstimatedItemSize, snapToIndices, enableAverages
|
|
1604
|
+
props: { getEstimatedItemSize, snapToIndices, enableAverages }
|
|
1619
1605
|
} = state;
|
|
1620
1606
|
const data = state.props.data;
|
|
1621
1607
|
const dataLength = data.length;
|
|
@@ -1626,7 +1612,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
|
|
|
1626
1612
|
const shouldOptimize = !forceFullUpdate && !dataChanged && Math.abs(getScrollVelocity(state)) > 0;
|
|
1627
1613
|
const maxVisibleArea = scrollBottomBuffered + 1e3;
|
|
1628
1614
|
const useAverageSize = enableAverages && !getEstimatedItemSize;
|
|
1629
|
-
const preferCachedSize =
|
|
1615
|
+
const preferCachedSize = !doMVCP || dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_a3 = peek$(ctx, "scrollAdjustPending")) != null ? _a3 : 0) !== 0;
|
|
1630
1616
|
let currentRowTop = 0;
|
|
1631
1617
|
let column = 1;
|
|
1632
1618
|
let maxSizeInRow = 0;
|
|
@@ -2092,14 +2078,14 @@ function findCurrentStickyIndex(stickyArray, scroll, state) {
|
|
|
2092
2078
|
}
|
|
2093
2079
|
return -1;
|
|
2094
2080
|
}
|
|
2095
|
-
function getActiveStickyIndices(ctx, state,
|
|
2081
|
+
function getActiveStickyIndices(ctx, state, stickyHeaderIndices) {
|
|
2096
2082
|
return new Set(
|
|
2097
|
-
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))
|
|
2098
2084
|
);
|
|
2099
2085
|
}
|
|
2100
|
-
function handleStickyActivation(ctx, state,
|
|
2086
|
+
function handleStickyActivation(ctx, state, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
|
|
2101
2087
|
var _a3;
|
|
2102
|
-
const activeIndices = getActiveStickyIndices(ctx, state,
|
|
2088
|
+
const activeIndices = getActiveStickyIndices(ctx, state, stickyHeaderIndices);
|
|
2103
2089
|
state.activeStickyIndex = currentStickyIdx >= 0 ? stickyArray[currentStickyIdx] : void 0;
|
|
2104
2090
|
for (let offset = 0; offset <= 1; offset++) {
|
|
2105
2091
|
const idx = currentStickyIdx - offset;
|
|
@@ -2235,6 +2221,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
2235
2221
|
}
|
|
2236
2222
|
const startIndex = dataChanged ? 0 : (_b = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _b : 0;
|
|
2237
2223
|
updateItemPositions(ctx, state, dataChanged, {
|
|
2224
|
+
doMVCP,
|
|
2238
2225
|
forceFullUpdate: !!forceFullItemPositions,
|
|
2239
2226
|
scrollBottomBuffered,
|
|
2240
2227
|
startIndex
|
|
@@ -2529,6 +2516,7 @@ function doMaintainScrollAtEnd(ctx, state, animated) {
|
|
|
2529
2516
|
});
|
|
2530
2517
|
return true;
|
|
2531
2518
|
}
|
|
2519
|
+
return false;
|
|
2532
2520
|
}
|
|
2533
2521
|
|
|
2534
2522
|
// src/utils/updateAveragesOnDataChange.ts
|
|
@@ -2697,6 +2685,25 @@ function handleLayout(ctx, state, layout, setCanRender) {
|
|
|
2697
2685
|
setCanRender(true);
|
|
2698
2686
|
}
|
|
2699
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
|
+
|
|
2700
2707
|
// src/core/ScrollAdjustHandler.ts
|
|
2701
2708
|
var ScrollAdjustHandler = class {
|
|
2702
2709
|
constructor(ctx) {
|
|
@@ -2732,12 +2739,7 @@ var ScrollAdjustHandler = class {
|
|
|
2732
2739
|
set$(this.context, "scrollAdjustPending", this.pendingAdjust);
|
|
2733
2740
|
} else {
|
|
2734
2741
|
this.appliedAdjust += add;
|
|
2735
|
-
|
|
2736
|
-
if (this.mounted) {
|
|
2737
|
-
setter();
|
|
2738
|
-
} else {
|
|
2739
|
-
requestAnimationFrame(setter);
|
|
2740
|
-
}
|
|
2742
|
+
set$(this.context, "scrollAdjust", this.appliedAdjust);
|
|
2741
2743
|
}
|
|
2742
2744
|
}
|
|
2743
2745
|
setMounted() {
|
|
@@ -2899,9 +2901,9 @@ function getWindowSize() {
|
|
|
2899
2901
|
};
|
|
2900
2902
|
}
|
|
2901
2903
|
var StyleSheet = reactNative.StyleSheet;
|
|
2902
|
-
function useStickyScrollHandler(
|
|
2904
|
+
function useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, onScroll2) {
|
|
2903
2905
|
return React2.useMemo(() => {
|
|
2904
|
-
if (
|
|
2906
|
+
if (stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.length) {
|
|
2905
2907
|
const { animatedScrollY } = ctx;
|
|
2906
2908
|
return reactNative.Animated.event(
|
|
2907
2909
|
[
|
|
@@ -2918,7 +2920,7 @@ function useStickyScrollHandler(stickyIndices, horizontal, ctx, onScroll2) {
|
|
|
2918
2920
|
);
|
|
2919
2921
|
}
|
|
2920
2922
|
return onScroll2;
|
|
2921
|
-
}, [
|
|
2923
|
+
}, [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(","), horizontal]);
|
|
2922
2924
|
}
|
|
2923
2925
|
|
|
2924
2926
|
// src/utils/createColumnWrapperStyle.ts
|
|
@@ -3140,7 +3142,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3140
3142
|
ListHeaderComponent,
|
|
3141
3143
|
maintainScrollAtEnd = false,
|
|
3142
3144
|
maintainScrollAtEndThreshold = 0.1,
|
|
3143
|
-
maintainVisibleContentPosition =
|
|
3145
|
+
maintainVisibleContentPosition = false,
|
|
3144
3146
|
numColumns: numColumnsProp = 1,
|
|
3145
3147
|
onEndReached,
|
|
3146
3148
|
onEndReachedThreshold = 0.5,
|
|
@@ -3162,7 +3164,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3162
3164
|
renderItem,
|
|
3163
3165
|
scrollEventThrottle,
|
|
3164
3166
|
snapToIndices,
|
|
3165
|
-
|
|
3167
|
+
stickyHeaderIndices: stickyHeaderIndicesProp,
|
|
3168
|
+
stickyIndices: stickyIndicesDeprecated,
|
|
3166
3169
|
style: styleProp,
|
|
3167
3170
|
suggestEstimatedItemSize,
|
|
3168
3171
|
viewabilityConfig,
|
|
@@ -3184,6 +3187,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3184
3187
|
const estimatedItemSize = estimatedItemSizeProp != null ? estimatedItemSizeProp : DEFAULT_ITEM_SIZE;
|
|
3185
3188
|
const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
|
|
3186
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
|
+
}
|
|
3187
3197
|
const refState = React2.useRef();
|
|
3188
3198
|
if (!refState.current) {
|
|
3189
3199
|
if (!ctx.internalState) {
|
|
@@ -3295,8 +3305,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3295
3305
|
renderItem,
|
|
3296
3306
|
scrollBuffer,
|
|
3297
3307
|
snapToIndices,
|
|
3298
|
-
stickyIndicesArr:
|
|
3299
|
-
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(",")]),
|
|
3300
3310
|
stylePaddingBottom: stylePaddingBottomState,
|
|
3301
3311
|
stylePaddingTop: stylePaddingTopState,
|
|
3302
3312
|
suggestEstimatedItemSize: !!suggestEstimatedItemSize
|
|
@@ -3316,7 +3326,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3316
3326
|
setPaddingTop(ctx, state, { stylePaddingTop: stylePaddingTopState });
|
|
3317
3327
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
3318
3328
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
3319
|
-
if (
|
|
3329
|
+
if (paddingDiff && prevPaddingTop !== void 0 && Platform2.OS === "ios") {
|
|
3320
3330
|
if (state.scroll < 0) {
|
|
3321
3331
|
paddingDiff += state.scroll;
|
|
3322
3332
|
}
|
|
@@ -3364,7 +3374,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3364
3374
|
state.initialScroll = updatedInitialScroll;
|
|
3365
3375
|
refState.current.isStartReached = clampedOffset < refState.current.scrollLength * onStartReachedThreshold;
|
|
3366
3376
|
return clampedOffset;
|
|
3367
|
-
}, [renderNum
|
|
3377
|
+
}, [renderNum]);
|
|
3368
3378
|
if (isFirstLocal || didDataChangeLocal || numColumnsProp !== peek$(ctx, "numColumns")) {
|
|
3369
3379
|
refState.current.lastBatchingAction = Date.now();
|
|
3370
3380
|
if (!keyExtractorProp && !isFirstLocal && didDataChangeLocal) {
|
|
@@ -3404,7 +3414,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3404
3414
|
precomputedWithViewOffset: true
|
|
3405
3415
|
});
|
|
3406
3416
|
}
|
|
3407
|
-
}, [initialContentOffset
|
|
3417
|
+
}, [initialContentOffset]);
|
|
3408
3418
|
const onLayoutChange = React2.useCallback((layout) => {
|
|
3409
3419
|
doInitialScroll();
|
|
3410
3420
|
handleLayout(ctx, state, layout, setCanRender);
|
|
@@ -3471,7 +3481,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3471
3481
|
}),
|
|
3472
3482
|
[]
|
|
3473
3483
|
);
|
|
3474
|
-
const onScrollHandler = useStickyScrollHandler(
|
|
3484
|
+
const onScrollHandler = useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, fns.onScroll);
|
|
3475
3485
|
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(
|
|
3476
3486
|
ListComponent,
|
|
3477
3487
|
{
|
|
@@ -3517,7 +3527,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3517
3527
|
scrollAdjustHandler: (_b = refState.current) == null ? void 0 : _b.scrollAdjustHandler,
|
|
3518
3528
|
scrollEventThrottle: Platform2.OS === "web" ? 16 : void 0,
|
|
3519
3529
|
snapToIndices,
|
|
3520
|
-
|
|
3530
|
+
stickyHeaderIndices,
|
|
3521
3531
|
style,
|
|
3522
3532
|
updateItemSize: fns.updateItemSize,
|
|
3523
3533
|
waitForInitialLayout
|