@legendapp/list 3.0.2 → 3.0.4
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/CHANGELOG.md +12 -0
- package/animated.d.ts +11 -4
- package/keyboard-legacy.d.ts +5 -4
- package/keyboard.d.ts +11 -4
- package/package.json +1 -1
- package/react-native.d.ts +11 -4
- package/react-native.js +211 -92
- package/react-native.mjs +212 -93
- package/react-native.web.d.ts +11 -4
- package/react-native.web.js +178 -88
- package/react-native.web.mjs +178 -88
- package/react.d.ts +11 -4
- package/react.js +178 -88
- package/react.mjs +178 -88
- package/reanimated.d.ts +11 -4
- package/section-list.d.ts +11 -4
package/react-native.web.js
CHANGED
|
@@ -2462,17 +2462,42 @@ function setSize(ctx, itemKey, size, notifyTotalSize = true) {
|
|
|
2462
2462
|
}
|
|
2463
2463
|
|
|
2464
2464
|
// src/utils/getItemSize.ts
|
|
2465
|
+
function getKnownOrFixedSize(ctx, key, index, data) {
|
|
2466
|
+
var _a3;
|
|
2467
|
+
const state = ctx.state;
|
|
2468
|
+
const { getFixedItemSize, getItemType } = state.props;
|
|
2469
|
+
let size = key ? state.sizesKnown.get(key) : void 0;
|
|
2470
|
+
if (size === void 0 && key && getFixedItemSize) {
|
|
2471
|
+
const itemType = getItemType ? (_a3 = getItemType(data, index)) != null ? _a3 : "" : "";
|
|
2472
|
+
size = getFixedItemSize(data, index, itemType);
|
|
2473
|
+
if (size !== void 0) {
|
|
2474
|
+
state.sizesKnown.set(key, size);
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
return size;
|
|
2478
|
+
}
|
|
2479
|
+
function getKnownOrFixedItemSize(ctx, index) {
|
|
2480
|
+
const key = getId(ctx.state, index);
|
|
2481
|
+
return getKnownOrFixedSize(ctx, key, index, ctx.state.props.data[index]);
|
|
2482
|
+
}
|
|
2483
|
+
function areKnownOrFixedItemSizesAvailable(ctx, startIndex, endIndex) {
|
|
2484
|
+
for (let index = startIndex; index <= endIndex; index++) {
|
|
2485
|
+
if (getKnownOrFixedItemSize(ctx, index) === void 0) {
|
|
2486
|
+
return false;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
return true;
|
|
2490
|
+
}
|
|
2465
2491
|
function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, notifyTotalSize) {
|
|
2466
2492
|
var _a3, _b, _c;
|
|
2467
2493
|
const state = ctx.state;
|
|
2468
2494
|
const {
|
|
2469
|
-
sizesKnown,
|
|
2470
2495
|
sizes,
|
|
2471
2496
|
averageSizes,
|
|
2472
|
-
props: { estimatedItemSize,
|
|
2497
|
+
props: { estimatedItemSize, getItemType },
|
|
2473
2498
|
scrollingTo
|
|
2474
2499
|
} = state;
|
|
2475
|
-
const sizeKnown = sizesKnown.get(key);
|
|
2500
|
+
const sizeKnown = state.sizesKnown.get(key);
|
|
2476
2501
|
if (sizeKnown !== void 0) {
|
|
2477
2502
|
return sizeKnown;
|
|
2478
2503
|
}
|
|
@@ -2483,14 +2508,13 @@ function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, no
|
|
|
2483
2508
|
return renderedSize;
|
|
2484
2509
|
}
|
|
2485
2510
|
}
|
|
2486
|
-
|
|
2487
|
-
if (
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
sizesKnown.set(key, size);
|
|
2491
|
-
}
|
|
2511
|
+
size = getKnownOrFixedSize(ctx, key, index, data);
|
|
2512
|
+
if (size !== void 0) {
|
|
2513
|
+
setSize(ctx, key, size, notifyTotalSize);
|
|
2514
|
+
return size;
|
|
2492
2515
|
}
|
|
2493
|
-
|
|
2516
|
+
const itemType = getItemType ? (_a3 = getItemType(data, index)) != null ? _a3 : "" : "";
|
|
2517
|
+
if (useAverageSize && !scrollingTo) {
|
|
2494
2518
|
const averageSizeForType = (_b = averageSizes[itemType]) == null ? void 0 : _b.avg;
|
|
2495
2519
|
if (averageSizeForType !== void 0) {
|
|
2496
2520
|
size = roundSize(averageSizeForType);
|
|
@@ -2499,7 +2523,7 @@ function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, no
|
|
|
2499
2523
|
if (size === void 0 && renderedSize !== void 0) {
|
|
2500
2524
|
return renderedSize;
|
|
2501
2525
|
}
|
|
2502
|
-
if (size === void 0 && useAverageSize &&
|
|
2526
|
+
if (size === void 0 && useAverageSize && scrollingTo) {
|
|
2503
2527
|
const averageSizeForType = (_c = scrollingTo.averageSizeSnapshot) == null ? void 0 : _c[itemType];
|
|
2504
2528
|
if (averageSizeForType !== void 0) {
|
|
2505
2529
|
size = roundSize(averageSizeForType);
|
|
@@ -3106,7 +3130,7 @@ function updateScroll(ctx, newScroll, forceUpdate, options) {
|
|
|
3106
3130
|
if (scrollLength > 0 && scrollingTo === void 0 && scrollDelta > scrollLength && !state.pendingNativeMVCPAdjust) {
|
|
3107
3131
|
state.mvcpAnchorLock = void 0;
|
|
3108
3132
|
state.pendingNativeMVCPAdjust = void 0;
|
|
3109
|
-
state.
|
|
3133
|
+
state.userScrollAnchorReset = { keys: /* @__PURE__ */ new Set() };
|
|
3110
3134
|
if (state.queuedMVCPRecalculate !== void 0) {
|
|
3111
3135
|
cancelAnimationFrame(state.queuedMVCPRecalculate);
|
|
3112
3136
|
state.queuedMVCPRecalculate = void 0;
|
|
@@ -5069,7 +5093,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, drawDistance, currentSt
|
|
|
5069
5093
|
function calculateItemsInView(ctx, params = {}) {
|
|
5070
5094
|
const state = ctx.state;
|
|
5071
5095
|
batchedUpdates(() => {
|
|
5072
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p
|
|
5096
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
5073
5097
|
const {
|
|
5074
5098
|
columns,
|
|
5075
5099
|
containerItemKeys,
|
|
@@ -5383,7 +5407,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
5383
5407
|
state.containerItemTypes.set(containerIndex, requiredItemTypes[idx]);
|
|
5384
5408
|
}
|
|
5385
5409
|
containerItemKeys.set(id, containerIndex);
|
|
5386
|
-
(_o = state.
|
|
5410
|
+
(_o = state.userScrollAnchorReset) == null ? void 0 : _o.keys.add(id);
|
|
5387
5411
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
5388
5412
|
const isSticky = stickyHeaderIndicesSet.has(i);
|
|
5389
5413
|
const isAlwaysRender = alwaysRenderSet.has(i);
|
|
@@ -5411,13 +5435,17 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
5411
5435
|
}
|
|
5412
5436
|
}
|
|
5413
5437
|
}
|
|
5414
|
-
if (
|
|
5415
|
-
state.
|
|
5438
|
+
if (state.userScrollAnchorReset) {
|
|
5439
|
+
if (state.userScrollAnchorReset.keys.size === 0) {
|
|
5440
|
+
state.userScrollAnchorReset = void 0;
|
|
5441
|
+
} else {
|
|
5442
|
+
state.userScrollAnchorReset.batchSize = state.userScrollAnchorReset.keys.size;
|
|
5443
|
+
}
|
|
5416
5444
|
}
|
|
5417
5445
|
if (alwaysRenderArr.length > 0) {
|
|
5418
5446
|
for (const index of alwaysRenderArr) {
|
|
5419
5447
|
if (index < 0 || index >= dataLength) continue;
|
|
5420
|
-
const id = (
|
|
5448
|
+
const id = (_p = idCache[index]) != null ? _p : getId(state, index);
|
|
5421
5449
|
const containerIndex = containerItemKeys.get(id);
|
|
5422
5450
|
if (containerIndex !== void 0) {
|
|
5423
5451
|
state.stickyContainerPool.add(containerIndex);
|
|
@@ -5815,22 +5843,27 @@ var ScrollAdjustHandler = class {
|
|
|
5815
5843
|
|
|
5816
5844
|
// src/core/updateAnchoredEndSpace.ts
|
|
5817
5845
|
function maybeUpdateAnchoredEndSpace(ctx) {
|
|
5818
|
-
var _a3;
|
|
5846
|
+
var _a3, _b;
|
|
5819
5847
|
const state = ctx.state;
|
|
5820
5848
|
const anchoredEndSpace = state.props.anchoredEndSpace;
|
|
5821
5849
|
const previousSize = peek$(ctx, "anchoredEndSpaceSize");
|
|
5850
|
+
const previousReadyAnchorIndex = state.anchoredEndSpaceReadyAnchorIndex;
|
|
5851
|
+
const previousReadyAnchorKey = state.anchoredEndSpaceReadyAnchorKey;
|
|
5852
|
+
const nextAnchorIndex = anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex;
|
|
5853
|
+
let nextAnchorKey;
|
|
5854
|
+
let isReady = true;
|
|
5822
5855
|
let nextSize = 0;
|
|
5823
5856
|
if (anchoredEndSpace) {
|
|
5824
5857
|
const { anchorIndex, anchorMaxSize, anchorOffset = 0 } = anchoredEndSpace;
|
|
5825
5858
|
const { data } = state.props;
|
|
5826
5859
|
if (anchorIndex >= 0 && anchorIndex < data.length && state.scrollLength > 0) {
|
|
5860
|
+
nextAnchorKey = getId(state, anchorIndex);
|
|
5827
5861
|
let contentBelowAnchor = 0;
|
|
5828
5862
|
const footerSize = ctx.values.get("footerSize") || 0;
|
|
5829
5863
|
const stylePaddingBottom = state.props.stylePaddingBottom || 0;
|
|
5830
5864
|
let hasUnknownTailSize = false;
|
|
5831
5865
|
for (let index = anchorIndex; index < data.length; index++) {
|
|
5832
|
-
const
|
|
5833
|
-
const size = itemKey ? state.sizesKnown.get(itemKey) : void 0;
|
|
5866
|
+
const size = getKnownOrFixedItemSize(ctx, index);
|
|
5834
5867
|
const effectiveSize = index === anchorIndex && anchorMaxSize !== void 0 ? Math.min(size || 0, Math.max(0, anchorMaxSize)) : size;
|
|
5835
5868
|
if (size === void 0) {
|
|
5836
5869
|
hasUnknownTailSize = true;
|
|
@@ -5840,15 +5873,25 @@ function maybeUpdateAnchoredEndSpace(ctx) {
|
|
|
5840
5873
|
}
|
|
5841
5874
|
}
|
|
5842
5875
|
contentBelowAnchor += footerSize + stylePaddingBottom;
|
|
5876
|
+
isReady = !hasUnknownTailSize;
|
|
5843
5877
|
nextSize = hasUnknownTailSize ? previousSize || 0 : Math.max(0, state.scrollLength - contentBelowAnchor - anchorOffset);
|
|
5878
|
+
} else if (anchorIndex >= 0) {
|
|
5879
|
+
isReady = false;
|
|
5844
5880
|
}
|
|
5845
5881
|
}
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5882
|
+
const didSizeChange = previousSize !== nextSize;
|
|
5883
|
+
const didReadyAnchorChange = previousReadyAnchorIndex !== nextAnchorIndex || previousReadyAnchorKey !== nextAnchorKey;
|
|
5884
|
+
if (isReady && (didSizeChange || didReadyAnchorChange)) {
|
|
5885
|
+
state.anchoredEndSpaceReadyAnchorIndex = nextAnchorIndex;
|
|
5886
|
+
state.anchoredEndSpaceReadyAnchorKey = nextAnchorKey;
|
|
5887
|
+
if (didSizeChange) {
|
|
5888
|
+
set$(ctx, "anchoredEndSpaceSize", nextSize);
|
|
5889
|
+
(_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
|
|
5890
|
+
}
|
|
5891
|
+
if (didSizeChange && (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset)) {
|
|
5850
5892
|
updateScroll(ctx, state.scroll, true);
|
|
5851
5893
|
}
|
|
5894
|
+
(_b = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onReady) == null ? void 0 : _b.call(anchoredEndSpace, { anchorIndex: nextAnchorIndex, anchorKey: nextAnchorKey, size: nextSize });
|
|
5852
5895
|
}
|
|
5853
5896
|
return nextSize;
|
|
5854
5897
|
}
|
|
@@ -5871,37 +5914,42 @@ function updateContentInsetEndAdjustment(ctx, previousContentInsetEndAdjustment)
|
|
|
5871
5914
|
|
|
5872
5915
|
// src/core/updateItemSize.ts
|
|
5873
5916
|
function runOrScheduleMVCPRecalculate(ctx) {
|
|
5917
|
+
var _a3, _b;
|
|
5874
5918
|
const state = ctx.state;
|
|
5875
|
-
if (state.
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5919
|
+
if (state.userScrollAnchorReset !== void 0) {
|
|
5920
|
+
const replacementBatchSize = (_a3 = state.userScrollAnchorReset.batchSize) != null ? _a3 : state.userScrollAnchorReset.keys.size;
|
|
5921
|
+
const replacementMeasurementBatchThreshold = 3;
|
|
5922
|
+
const shouldBatchReplacementMeasurements = replacementBatchSize > replacementMeasurementBatchThreshold;
|
|
5923
|
+
if (shouldBatchReplacementMeasurements) {
|
|
5924
|
+
if (state.queuedMVCPRecalculate === void 0) {
|
|
5925
|
+
state.queuedMVCPRecalculate = requestAnimationFrame(() => {
|
|
5926
|
+
var _a4;
|
|
5927
|
+
state.queuedMVCPRecalculate = void 0;
|
|
5928
|
+
calculateItemsInView(ctx);
|
|
5929
|
+
if (((_a4 = state.userScrollAnchorReset) == null ? void 0 : _a4.keys.size) === 0) {
|
|
5930
|
+
state.userScrollAnchorReset = void 0;
|
|
5931
|
+
}
|
|
5932
|
+
});
|
|
5933
|
+
}
|
|
5934
|
+
} else {
|
|
5882
5935
|
calculateItemsInView(ctx);
|
|
5883
|
-
if (((
|
|
5884
|
-
state.
|
|
5936
|
+
if (((_b = state.userScrollAnchorReset) == null ? void 0 : _b.keys.size) === 0) {
|
|
5937
|
+
state.userScrollAnchorReset = void 0;
|
|
5885
5938
|
}
|
|
5886
|
-
}
|
|
5887
|
-
|
|
5888
|
-
}
|
|
5889
|
-
{
|
|
5939
|
+
}
|
|
5940
|
+
} else {
|
|
5890
5941
|
if (!state.mvcpAnchorLock) {
|
|
5891
5942
|
if (state.queuedMVCPRecalculate !== void 0) {
|
|
5892
5943
|
cancelAnimationFrame(state.queuedMVCPRecalculate);
|
|
5893
5944
|
state.queuedMVCPRecalculate = void 0;
|
|
5894
5945
|
}
|
|
5895
5946
|
calculateItemsInView(ctx, { doMVCP: true });
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5947
|
+
} else if (state.queuedMVCPRecalculate === void 0) {
|
|
5948
|
+
state.queuedMVCPRecalculate = requestAnimationFrame(() => {
|
|
5949
|
+
state.queuedMVCPRecalculate = void 0;
|
|
5950
|
+
calculateItemsInView(ctx, { doMVCP: true });
|
|
5951
|
+
});
|
|
5900
5952
|
}
|
|
5901
|
-
state.queuedMVCPRecalculate = requestAnimationFrame(() => {
|
|
5902
|
-
state.queuedMVCPRecalculate = void 0;
|
|
5903
|
-
calculateItemsInView(ctx, { doMVCP: true });
|
|
5904
|
-
});
|
|
5905
5953
|
}
|
|
5906
5954
|
}
|
|
5907
5955
|
function updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal) {
|
|
@@ -5917,8 +5965,8 @@ function updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal) {
|
|
|
5917
5965
|
function updateItemSize(ctx, itemKey, sizeObj) {
|
|
5918
5966
|
var _a3;
|
|
5919
5967
|
const state = ctx.state;
|
|
5920
|
-
const
|
|
5921
|
-
const didMeasureUserScrollAnchorResetItem = !!(
|
|
5968
|
+
const userScrollAnchorReset = state.userScrollAnchorReset;
|
|
5969
|
+
const didMeasureUserScrollAnchorResetItem = !!(userScrollAnchorReset == null ? void 0 : userScrollAnchorReset.keys.delete(itemKey));
|
|
5922
5970
|
const {
|
|
5923
5971
|
didContainersLayout,
|
|
5924
5972
|
sizesKnown,
|
|
@@ -5974,8 +6022,8 @@ function updateItemSize(ctx, itemKey, sizeObj) {
|
|
|
5974
6022
|
if (needsRecalculate) {
|
|
5975
6023
|
state.scrollForNextCalculateItemsInView = void 0;
|
|
5976
6024
|
runOrScheduleMVCPRecalculate(ctx);
|
|
5977
|
-
} else if (didMeasureUserScrollAnchorResetItem && (
|
|
5978
|
-
state.
|
|
6025
|
+
} else if (didMeasureUserScrollAnchorResetItem && (userScrollAnchorReset == null ? void 0 : userScrollAnchorReset.keys.size) === 0) {
|
|
6026
|
+
state.userScrollAnchorReset = void 0;
|
|
5979
6027
|
}
|
|
5980
6028
|
if (shouldMaintainScrollAtEnd) {
|
|
5981
6029
|
if (maintainScrollAtEnd == null ? void 0 : maintainScrollAtEnd.onItemLayout) {
|
|
@@ -5985,7 +6033,7 @@ function updateItemSize(ctx, itemKey, sizeObj) {
|
|
|
5985
6033
|
}
|
|
5986
6034
|
}
|
|
5987
6035
|
function updateOneItemSize(ctx, itemKey, sizeObj) {
|
|
5988
|
-
var _a3;
|
|
6036
|
+
var _a3, _b;
|
|
5989
6037
|
const state = ctx.state;
|
|
5990
6038
|
const {
|
|
5991
6039
|
indexByKey,
|
|
@@ -5995,13 +6043,20 @@ function updateOneItemSize(ctx, itemKey, sizeObj) {
|
|
|
5995
6043
|
} = state;
|
|
5996
6044
|
if (!data) return 0;
|
|
5997
6045
|
const index = indexByKey.get(itemKey);
|
|
5998
|
-
const
|
|
6046
|
+
const itemData = data[index];
|
|
6047
|
+
let itemType;
|
|
6048
|
+
let fixedItemSize;
|
|
6049
|
+
if (getFixedItemSize) {
|
|
6050
|
+
itemType = getItemType ? (_a3 = getItemType(itemData, index)) != null ? _a3 : "" : "";
|
|
6051
|
+
fixedItemSize = getFixedItemSize(itemData, index, itemType);
|
|
6052
|
+
}
|
|
6053
|
+
const prevSize = getItemSize(ctx, itemKey, index, itemData);
|
|
5999
6054
|
const rawSize = horizontal ? sizeObj.width : sizeObj.height;
|
|
6000
|
-
const size = Math.round(rawSize) ;
|
|
6001
6055
|
const prevSizeKnown = sizesKnown.get(itemKey);
|
|
6056
|
+
const size = Math.round(rawSize) ;
|
|
6002
6057
|
sizesKnown.set(itemKey, size);
|
|
6003
|
-
if (
|
|
6004
|
-
|
|
6058
|
+
if (fixedItemSize === void 0 && size > 0) {
|
|
6059
|
+
itemType != null ? itemType : itemType = getItemType ? (_b = getItemType(itemData, index)) != null ? _b : "" : "";
|
|
6005
6060
|
let averages = averageSizes[itemType];
|
|
6006
6061
|
if (!averages) {
|
|
6007
6062
|
averages = averageSizes[itemType] = { avg: 0, num: 0 };
|
|
@@ -6069,6 +6124,25 @@ function createColumnWrapperStyle(contentContainerStyle) {
|
|
|
6069
6124
|
}
|
|
6070
6125
|
}
|
|
6071
6126
|
|
|
6127
|
+
// src/core/scrollToEnd.ts
|
|
6128
|
+
function scrollToEnd(ctx, options) {
|
|
6129
|
+
const state = ctx.state;
|
|
6130
|
+
const data = state.props.data;
|
|
6131
|
+
const index = data.length - 1;
|
|
6132
|
+
if (index === -1) {
|
|
6133
|
+
return false;
|
|
6134
|
+
}
|
|
6135
|
+
const paddingBottom = state.props.stylePaddingBottom || 0;
|
|
6136
|
+
const footerSize = peek$(ctx, "footerSize") || 0;
|
|
6137
|
+
scrollToIndex(ctx, {
|
|
6138
|
+
...options,
|
|
6139
|
+
index,
|
|
6140
|
+
viewOffset: -paddingBottom - footerSize + ((options == null ? void 0 : options.viewOffset) || 0),
|
|
6141
|
+
viewPosition: 1
|
|
6142
|
+
});
|
|
6143
|
+
return true;
|
|
6144
|
+
}
|
|
6145
|
+
|
|
6072
6146
|
// src/utils/createImperativeHandle.ts
|
|
6073
6147
|
var DEFAULT_AVERAGE_ITEM_SIZE_TYPE = "default";
|
|
6074
6148
|
function getAverageItemSizes(state) {
|
|
@@ -6084,7 +6158,7 @@ function getAverageItemSizes(state) {
|
|
|
6084
6158
|
}
|
|
6085
6159
|
return averageItemSizes;
|
|
6086
6160
|
}
|
|
6087
|
-
function createImperativeHandle(ctx) {
|
|
6161
|
+
function createImperativeHandle(ctx, scheduleImperativeScrollCommit) {
|
|
6088
6162
|
const state = ctx.state;
|
|
6089
6163
|
const IMPERATIVE_SCROLL_SETTLE_MAX_WAIT_MS = 800;
|
|
6090
6164
|
const IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES = 2;
|
|
@@ -6101,15 +6175,10 @@ function createImperativeHandle(ctx) {
|
|
|
6101
6175
|
if (targetIndex >= dataLength) {
|
|
6102
6176
|
return false;
|
|
6103
6177
|
}
|
|
6104
|
-
if (anchorIndex === void 0 || anchorIndex < 0 || anchorIndex >= dataLength || targetIndex < anchorIndex
|
|
6178
|
+
if (anchorIndex === void 0 || anchorIndex < 0 || anchorIndex >= dataLength || targetIndex < anchorIndex) {
|
|
6105
6179
|
return true;
|
|
6106
6180
|
}
|
|
6107
|
-
|
|
6108
|
-
if (!state.sizesKnown.has(getId(state, index))) {
|
|
6109
|
-
return false;
|
|
6110
|
-
}
|
|
6111
|
-
}
|
|
6112
|
-
return true;
|
|
6181
|
+
return areKnownOrFixedItemSizesAvailable(ctx, anchorIndex, dataLength - 1);
|
|
6113
6182
|
};
|
|
6114
6183
|
const runWhenReady = (token, run, isReady) => {
|
|
6115
6184
|
const startedAt = Date.now();
|
|
@@ -6132,11 +6201,7 @@ function createImperativeHandle(ctx) {
|
|
|
6132
6201
|
};
|
|
6133
6202
|
requestAnimationFrame(check);
|
|
6134
6203
|
};
|
|
6135
|
-
const
|
|
6136
|
-
var _a3;
|
|
6137
|
-
const token = ++imperativeScrollToken;
|
|
6138
|
-
(_a3 = state.pendingScrollResolve) == null ? void 0 : _a3.call(state);
|
|
6139
|
-
state.pendingScrollResolve = resolve;
|
|
6204
|
+
const runScrollRequest = (token, resolve, run, isReady = () => true) => {
|
|
6140
6205
|
const runNow = () => {
|
|
6141
6206
|
if (token !== imperativeScrollToken) {
|
|
6142
6207
|
return;
|
|
@@ -6154,7 +6219,33 @@ function createImperativeHandle(ctx) {
|
|
|
6154
6219
|
} else {
|
|
6155
6220
|
runNow();
|
|
6156
6221
|
}
|
|
6222
|
+
};
|
|
6223
|
+
const startImperativeScroll = (resolve) => {
|
|
6224
|
+
var _a3;
|
|
6225
|
+
const token = ++imperativeScrollToken;
|
|
6226
|
+
state.pendingScrollToEnd = void 0;
|
|
6227
|
+
(_a3 = state.pendingScrollResolve) == null ? void 0 : _a3.call(state);
|
|
6228
|
+
state.pendingScrollResolve = resolve;
|
|
6229
|
+
return token;
|
|
6230
|
+
};
|
|
6231
|
+
const runScrollWithPromise = (run, isReady = () => true) => new Promise((resolve) => {
|
|
6232
|
+
const token = startImperativeScroll(resolve);
|
|
6233
|
+
runScrollRequest(token, resolve, run, isReady);
|
|
6157
6234
|
});
|
|
6235
|
+
state.runPendingScrollToEnd = () => {
|
|
6236
|
+
const pendingScroll = state.pendingScrollToEnd;
|
|
6237
|
+
if (pendingScroll) {
|
|
6238
|
+
state.pendingScrollToEnd = void 0;
|
|
6239
|
+
if (pendingScroll.token === imperativeScrollToken) {
|
|
6240
|
+
runScrollRequest(
|
|
6241
|
+
pendingScroll.token,
|
|
6242
|
+
pendingScroll.resolve,
|
|
6243
|
+
() => scrollToEnd(ctx, pendingScroll.options),
|
|
6244
|
+
() => isScrollToIndexReady(state.props.data.length - 1, true)
|
|
6245
|
+
);
|
|
6246
|
+
}
|
|
6247
|
+
}
|
|
6248
|
+
};
|
|
6158
6249
|
const scrollIndexIntoView = (options) => {
|
|
6159
6250
|
if (state) {
|
|
6160
6251
|
const { index, ...rest } = options;
|
|
@@ -6253,26 +6344,20 @@ function createImperativeHandle(ctx) {
|
|
|
6253
6344
|
}
|
|
6254
6345
|
return false;
|
|
6255
6346
|
}),
|
|
6256
|
-
scrollToEnd: (options) =>
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
return true;
|
|
6271
|
-
}
|
|
6272
|
-
return false;
|
|
6273
|
-
},
|
|
6274
|
-
() => isScrollToIndexReady(state.props.data.length - 1, true)
|
|
6275
|
-
),
|
|
6347
|
+
scrollToEnd: (options) => new Promise((resolve) => {
|
|
6348
|
+
var _a3;
|
|
6349
|
+
const token = startImperativeScroll(resolve);
|
|
6350
|
+
state.pendingScrollToEnd = {
|
|
6351
|
+
options,
|
|
6352
|
+
resolve,
|
|
6353
|
+
token
|
|
6354
|
+
};
|
|
6355
|
+
if (scheduleImperativeScrollCommit) {
|
|
6356
|
+
scheduleImperativeScrollCommit();
|
|
6357
|
+
} else {
|
|
6358
|
+
(_a3 = state.runPendingScrollToEnd) == null ? void 0 : _a3.call(state);
|
|
6359
|
+
}
|
|
6360
|
+
}),
|
|
6276
6361
|
scrollToIndex: (params) => {
|
|
6277
6362
|
return runScrollWithPromise(
|
|
6278
6363
|
() => {
|
|
@@ -6642,6 +6727,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6642
6727
|
viewOffset: 0
|
|
6643
6728
|
} : void 0;
|
|
6644
6729
|
const [canRender, setCanRender] = React3__namespace.useState(!IsNewArchitecture);
|
|
6730
|
+
const [, scheduleImperativeScrollCommit] = React3__namespace.useReducer((value) => value + 1, 0);
|
|
6645
6731
|
const ctx = useStateContext();
|
|
6646
6732
|
ctx.columnWrapperStyle = columnWrapperStyle || (contentContainerStyle ? createColumnWrapperStyle(contentContainerStyle) : void 0);
|
|
6647
6733
|
const refScroller = React3.useRef(null);
|
|
@@ -7006,7 +7092,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
7006
7092
|
}, [viewabilityConfig, viewabilityConfigCallbackPairs, onViewableItemsChanged]);
|
|
7007
7093
|
useInit(() => {
|
|
7008
7094
|
});
|
|
7009
|
-
React3.useImperativeHandle(forwardedRef, () => createImperativeHandle(ctx), []);
|
|
7095
|
+
React3.useImperativeHandle(forwardedRef, () => createImperativeHandle(ctx, scheduleImperativeScrollCommit), []);
|
|
7096
|
+
React3.useLayoutEffect(() => {
|
|
7097
|
+
var _a4;
|
|
7098
|
+
(_a4 = state.runPendingScrollToEnd) == null ? void 0 : _a4.call(state);
|
|
7099
|
+
});
|
|
7010
7100
|
React3.useEffect(() => {
|
|
7011
7101
|
if (usesBootstrapInitialScroll) {
|
|
7012
7102
|
return;
|