@legendapp/list 3.0.0-beta.20 → 3.0.0-beta.22
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.native.d.mts +9 -0
- package/animated.native.d.ts +9 -0
- package/animated.native.js +9 -0
- package/animated.native.mjs +7 -0
- package/index.d.mts +33 -2
- package/index.d.ts +33 -2
- package/index.js +197 -24
- package/index.mjs +197 -24
- package/index.native.d.mts +802 -0
- package/index.native.d.ts +802 -0
- package/index.native.js +197 -23
- package/index.native.mjs +197 -23
- package/keyboard-controller.native.d.mts +12 -0
- package/keyboard-controller.native.d.ts +12 -0
- package/keyboard-controller.native.js +69 -0
- package/keyboard-controller.native.mjs +48 -0
- package/keyboard.js +148 -15
- package/keyboard.mjs +149 -16
- package/keyboard.native.d.mts +16 -0
- package/keyboard.native.d.ts +16 -0
- package/keyboard.native.js +361 -0
- package/keyboard.native.mjs +339 -0
- package/package.json +1 -1
- package/reanimated.native.d.mts +18 -0
- package/reanimated.native.d.ts +18 -0
- package/reanimated.native.js +89 -0
- package/reanimated.native.mjs +65 -0
- package/section-list.native.d.mts +112 -0
- package/section-list.native.d.ts +112 -0
- package/section-list.native.js +293 -0
- package/section-list.native.mjs +271 -0
package/index.native.js
CHANGED
|
@@ -31,7 +31,7 @@ var Text = reactNative.Text;
|
|
|
31
31
|
|
|
32
32
|
// src/state/getContentInsetEnd.ts
|
|
33
33
|
function getContentInsetEnd(state) {
|
|
34
|
-
var _a3;
|
|
34
|
+
var _a3, _b;
|
|
35
35
|
const { props } = state;
|
|
36
36
|
const horizontal = props.horizontal;
|
|
37
37
|
let contentInset = props.contentInset;
|
|
@@ -45,7 +45,16 @@ function getContentInsetEnd(state) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
|
|
49
|
+
const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
|
|
50
|
+
if (overrideInset) {
|
|
51
|
+
const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
|
|
52
|
+
return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
|
|
53
|
+
}
|
|
54
|
+
if (baseInset) {
|
|
55
|
+
return (horizontal ? baseInset.right : baseInset.bottom) || 0;
|
|
56
|
+
}
|
|
57
|
+
return 0;
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
// src/state/getContentSize.ts
|
|
@@ -249,7 +258,8 @@ var ENABLE_DEVMODE = IS_DEV && false;
|
|
|
249
258
|
var ENABLE_DEBUG_VIEW = IS_DEV && false;
|
|
250
259
|
|
|
251
260
|
// src/constants-platform.native.ts
|
|
252
|
-
var
|
|
261
|
+
var f = global.nativeFabricUIManager;
|
|
262
|
+
var IsNewArchitecture = f !== void 0 && f != null;
|
|
253
263
|
var useAnimatedValue = (initialValue) => {
|
|
254
264
|
const [animAnimatedValue] = React2.useState(() => new reactNative.Animated.Value(initialValue));
|
|
255
265
|
return animAnimatedValue;
|
|
@@ -2352,7 +2362,7 @@ function getActiveStickyIndices(ctx, stickyHeaderIndices) {
|
|
|
2352
2362
|
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))
|
|
2353
2363
|
);
|
|
2354
2364
|
}
|
|
2355
|
-
function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
|
|
2365
|
+
function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, needNewContainersSet, startBuffered, endBuffered) {
|
|
2356
2366
|
var _a3;
|
|
2357
2367
|
const state = ctx.state;
|
|
2358
2368
|
const activeIndices = getActiveStickyIndices(ctx, stickyHeaderIndices);
|
|
@@ -2362,18 +2372,20 @@ function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentSt
|
|
|
2362
2372
|
if (idx < 0 || activeIndices.has(stickyArray[idx])) continue;
|
|
2363
2373
|
const stickyIndex = stickyArray[idx];
|
|
2364
2374
|
const stickyId = (_a3 = state.idCache[stickyIndex]) != null ? _a3 : getId(state, stickyIndex);
|
|
2365
|
-
if (stickyId && !state.containerItemKeys.has(stickyId) && (stickyIndex < startBuffered || stickyIndex > endBuffered)) {
|
|
2375
|
+
if (stickyId && !state.containerItemKeys.has(stickyId) && (stickyIndex < startBuffered || stickyIndex > endBuffered) && !needNewContainersSet.has(stickyIndex)) {
|
|
2376
|
+
needNewContainersSet.add(stickyIndex);
|
|
2366
2377
|
needNewContainers.push(stickyIndex);
|
|
2367
2378
|
}
|
|
2368
2379
|
}
|
|
2369
2380
|
}
|
|
2370
|
-
function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentStickyIdx, pendingRemoval) {
|
|
2381
|
+
function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentStickyIdx, pendingRemoval, alwaysRenderIndicesSet) {
|
|
2371
2382
|
var _a3, _b, _c;
|
|
2372
2383
|
const state = ctx.state;
|
|
2373
2384
|
for (const containerIndex of state.stickyContainerPool) {
|
|
2374
2385
|
const itemKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
2375
2386
|
const itemIndex = itemKey ? state.indexByKey.get(itemKey) : void 0;
|
|
2376
2387
|
if (itemIndex === void 0) continue;
|
|
2388
|
+
if (alwaysRenderIndicesSet.has(itemIndex)) continue;
|
|
2377
2389
|
const arrayIdx = stickyArray.indexOf(itemIndex);
|
|
2378
2390
|
if (arrayIdx === -1) {
|
|
2379
2391
|
state.stickyContainerPool.delete(containerIndex);
|
|
@@ -2405,7 +2417,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentSt
|
|
|
2405
2417
|
function calculateItemsInView(ctx, params = {}) {
|
|
2406
2418
|
const state = ctx.state;
|
|
2407
2419
|
reactNative.unstable_batchedUpdates(() => {
|
|
2408
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2420
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2409
2421
|
const {
|
|
2410
2422
|
columns,
|
|
2411
2423
|
containerItemKeys,
|
|
@@ -2415,7 +2427,15 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2415
2427
|
initialScroll,
|
|
2416
2428
|
minIndexSizeChanged,
|
|
2417
2429
|
positions,
|
|
2418
|
-
props: {
|
|
2430
|
+
props: {
|
|
2431
|
+
alwaysRenderIndicesArr,
|
|
2432
|
+
alwaysRenderIndicesSet,
|
|
2433
|
+
getItemType,
|
|
2434
|
+
itemsAreEqual,
|
|
2435
|
+
keyExtractor,
|
|
2436
|
+
onStickyHeaderChange,
|
|
2437
|
+
scrollBuffer
|
|
2438
|
+
},
|
|
2419
2439
|
scrollForNextCalculateItemsInView,
|
|
2420
2440
|
scrollLength,
|
|
2421
2441
|
sizes,
|
|
@@ -2425,6 +2445,8 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2425
2445
|
const { data } = state.props;
|
|
2426
2446
|
const stickyIndicesArr = state.props.stickyIndicesArr || [];
|
|
2427
2447
|
const stickyIndicesSet = state.props.stickyIndicesSet || /* @__PURE__ */ new Set();
|
|
2448
|
+
const alwaysRenderArr = alwaysRenderIndicesArr || [];
|
|
2449
|
+
const alwaysRenderSet = alwaysRenderIndicesSet || /* @__PURE__ */ new Set();
|
|
2428
2450
|
const prevNumContainers = peek$(ctx, "numContainers");
|
|
2429
2451
|
if (!data || scrollLength === 0 || !prevNumContainers) {
|
|
2430
2452
|
if (!IsNewArchitecture && state.initialAnchor) {
|
|
@@ -2607,12 +2629,24 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2607
2629
|
}
|
|
2608
2630
|
if (startBuffered !== null && endBuffered !== null) {
|
|
2609
2631
|
const needNewContainers = [];
|
|
2632
|
+
const needNewContainersSet = /* @__PURE__ */ new Set();
|
|
2610
2633
|
for (let i = startBuffered; i <= endBuffered; i++) {
|
|
2611
2634
|
const id = (_h = idCache[i]) != null ? _h : getId(state, i);
|
|
2612
2635
|
if (!containerItemKeys.has(id)) {
|
|
2636
|
+
needNewContainersSet.add(i);
|
|
2613
2637
|
needNewContainers.push(i);
|
|
2614
2638
|
}
|
|
2615
2639
|
}
|
|
2640
|
+
if (alwaysRenderArr.length > 0) {
|
|
2641
|
+
for (const index of alwaysRenderArr) {
|
|
2642
|
+
if (index < 0 || index >= dataLength) continue;
|
|
2643
|
+
const id = (_i = idCache[index]) != null ? _i : getId(state, index);
|
|
2644
|
+
if (id && !containerItemKeys.has(id) && !needNewContainersSet.has(index)) {
|
|
2645
|
+
needNewContainersSet.add(index);
|
|
2646
|
+
needNewContainers.push(index);
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2616
2650
|
if (stickyIndicesArr.length > 0) {
|
|
2617
2651
|
handleStickyActivation(
|
|
2618
2652
|
ctx,
|
|
@@ -2620,6 +2654,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2620
2654
|
stickyIndicesArr,
|
|
2621
2655
|
currentStickyIdx,
|
|
2622
2656
|
needNewContainers,
|
|
2657
|
+
needNewContainersSet,
|
|
2623
2658
|
startBuffered,
|
|
2624
2659
|
endBuffered
|
|
2625
2660
|
);
|
|
@@ -2643,7 +2678,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2643
2678
|
for (let idx = 0; idx < needNewContainers.length; idx++) {
|
|
2644
2679
|
const i = needNewContainers[idx];
|
|
2645
2680
|
const containerIndex = availableContainers[idx];
|
|
2646
|
-
const id = (
|
|
2681
|
+
const id = (_j = idCache[i]) != null ? _j : getId(state, i);
|
|
2647
2682
|
const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
2648
2683
|
if (oldKey && oldKey !== id) {
|
|
2649
2684
|
containerItemKeys.delete(oldKey);
|
|
@@ -2655,14 +2690,23 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2655
2690
|
}
|
|
2656
2691
|
containerItemKeys.set(id, containerIndex);
|
|
2657
2692
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
2658
|
-
|
|
2693
|
+
const isSticky = stickyIndicesSet.has(i);
|
|
2694
|
+
const isAlwaysRender = alwaysRenderSet.has(i);
|
|
2695
|
+
if (isSticky) {
|
|
2659
2696
|
set$(ctx, containerSticky, true);
|
|
2660
2697
|
const topPadding = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
|
|
2661
2698
|
set$(ctx, `containerStickyOffset${containerIndex}`, topPadding);
|
|
2662
2699
|
state.stickyContainerPool.add(containerIndex);
|
|
2663
|
-
} else
|
|
2664
|
-
|
|
2665
|
-
|
|
2700
|
+
} else {
|
|
2701
|
+
if (peek$(ctx, containerSticky)) {
|
|
2702
|
+
set$(ctx, containerSticky, false);
|
|
2703
|
+
set$(ctx, `containerStickyOffset${containerIndex}`, void 0);
|
|
2704
|
+
}
|
|
2705
|
+
if (isAlwaysRender) {
|
|
2706
|
+
state.stickyContainerPool.add(containerIndex);
|
|
2707
|
+
} else if (state.stickyContainerPool.has(containerIndex)) {
|
|
2708
|
+
state.stickyContainerPool.delete(containerIndex);
|
|
2709
|
+
}
|
|
2666
2710
|
}
|
|
2667
2711
|
if (containerIndex >= numContainers) {
|
|
2668
2712
|
numContainers = containerIndex + 1;
|
|
@@ -2675,9 +2719,27 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2675
2719
|
}
|
|
2676
2720
|
}
|
|
2677
2721
|
}
|
|
2722
|
+
if (alwaysRenderArr.length > 0) {
|
|
2723
|
+
for (const index of alwaysRenderArr) {
|
|
2724
|
+
if (index < 0 || index >= dataLength) continue;
|
|
2725
|
+
const id = (_k = idCache[index]) != null ? _k : getId(state, index);
|
|
2726
|
+
const containerIndex = containerItemKeys.get(id);
|
|
2727
|
+
if (containerIndex !== void 0) {
|
|
2728
|
+
state.stickyContainerPool.add(containerIndex);
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2678
2732
|
}
|
|
2679
|
-
if (
|
|
2680
|
-
handleStickyRecycling(
|
|
2733
|
+
if (state.stickyContainerPool.size > 0) {
|
|
2734
|
+
handleStickyRecycling(
|
|
2735
|
+
ctx,
|
|
2736
|
+
stickyIndicesArr,
|
|
2737
|
+
scroll,
|
|
2738
|
+
scrollBuffer,
|
|
2739
|
+
currentStickyIdx,
|
|
2740
|
+
pendingRemoval,
|
|
2741
|
+
alwaysRenderSet
|
|
2742
|
+
);
|
|
2681
2743
|
}
|
|
2682
2744
|
let didChangePositions = false;
|
|
2683
2745
|
for (let i = 0; i < numContainers; i++) {
|
|
@@ -2700,7 +2762,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2700
2762
|
const itemIndex = indexByKey.get(itemKey);
|
|
2701
2763
|
const item = data[itemIndex];
|
|
2702
2764
|
if (item !== void 0) {
|
|
2703
|
-
const id = (
|
|
2765
|
+
const id = (_l = idCache[itemIndex]) != null ? _l : getId(state, itemIndex);
|
|
2704
2766
|
const positionValue = positions.get(id);
|
|
2705
2767
|
if (positionValue === void 0) {
|
|
2706
2768
|
set$(ctx, `containerPosition${i}`, POSITION_OUT_OF_VIEW);
|
|
@@ -2974,7 +3036,7 @@ function handleLayout(ctx, layout, setCanRender) {
|
|
|
2974
3036
|
|
|
2975
3037
|
// src/core/onScroll.ts
|
|
2976
3038
|
function onScroll(ctx, event) {
|
|
2977
|
-
var _a3, _b, _c;
|
|
3039
|
+
var _a3, _b, _c, _d;
|
|
2978
3040
|
const state = ctx.state;
|
|
2979
3041
|
const {
|
|
2980
3042
|
scrollProcessingEnabled,
|
|
@@ -2986,6 +3048,15 @@ function onScroll(ctx, event) {
|
|
|
2986
3048
|
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) {
|
|
2987
3049
|
return;
|
|
2988
3050
|
}
|
|
3051
|
+
let insetChanged = false;
|
|
3052
|
+
if ((_d = event.nativeEvent) == null ? void 0 : _d.contentInset) {
|
|
3053
|
+
const { contentInset } = event.nativeEvent;
|
|
3054
|
+
const prevInset = state.nativeContentInset;
|
|
3055
|
+
if (!prevInset || prevInset.top !== contentInset.top || prevInset.bottom !== contentInset.bottom || prevInset.left !== contentInset.left || prevInset.right !== contentInset.right) {
|
|
3056
|
+
state.nativeContentInset = contentInset;
|
|
3057
|
+
insetChanged = true;
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
2989
3060
|
let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
|
|
2990
3061
|
if (state.scrollingTo) {
|
|
2991
3062
|
const maxOffset = clampScrollOffset(ctx, newScroll);
|
|
@@ -3001,7 +3072,7 @@ function onScroll(ctx, event) {
|
|
|
3001
3072
|
}
|
|
3002
3073
|
}
|
|
3003
3074
|
state.scrollPending = newScroll;
|
|
3004
|
-
updateScroll(ctx, newScroll);
|
|
3075
|
+
updateScroll(ctx, newScroll, insetChanged);
|
|
3005
3076
|
if (state.scrollingTo) {
|
|
3006
3077
|
checkFinishedScroll(ctx);
|
|
3007
3078
|
}
|
|
@@ -3174,7 +3245,10 @@ function updateOneItemSize(ctx, itemKey, sizeObj) {
|
|
|
3174
3245
|
if (!averages) {
|
|
3175
3246
|
averages = averageSizes[itemType] = { avg: 0, num: 0 };
|
|
3176
3247
|
}
|
|
3177
|
-
if (
|
|
3248
|
+
if (averages.num === 0) {
|
|
3249
|
+
averages.avg = size;
|
|
3250
|
+
averages.num++;
|
|
3251
|
+
} else if (prevSizeKnown !== void 0 && prevSizeKnown > 0) {
|
|
3178
3252
|
averages.avg += (size - prevSizeKnown) / averages.num;
|
|
3179
3253
|
} else {
|
|
3180
3254
|
averages.avg = (averages.avg * averages.num + size) / (averages.num + 1);
|
|
@@ -3278,7 +3352,7 @@ function createImperativeHandle(ctx) {
|
|
|
3278
3352
|
getScrollResponder: () => refScroller.current.getScrollResponder(),
|
|
3279
3353
|
getState: () => ({
|
|
3280
3354
|
activeStickyIndex: peek$(ctx, "activeStickyIndex"),
|
|
3281
|
-
contentLength:
|
|
3355
|
+
contentLength: getContentSize(ctx),
|
|
3282
3356
|
data: state.props.data,
|
|
3283
3357
|
elementAtIndex: (index) => {
|
|
3284
3358
|
var _a3;
|
|
@@ -3294,6 +3368,7 @@ function createImperativeHandle(ctx) {
|
|
|
3294
3368
|
positions: state.positions,
|
|
3295
3369
|
scroll: state.scroll,
|
|
3296
3370
|
scrollLength: state.scrollLength,
|
|
3371
|
+
scrollVelocity: getScrollVelocity(state),
|
|
3297
3372
|
sizeAtIndex: (index) => state.sizesKnown.get(getId(state, index)),
|
|
3298
3373
|
sizes: state.sizesKnown,
|
|
3299
3374
|
start: state.startNoBuffer,
|
|
@@ -3331,6 +3406,10 @@ function createImperativeHandle(ctx) {
|
|
|
3331
3406
|
}
|
|
3332
3407
|
},
|
|
3333
3408
|
scrollToOffset: (params) => scrollTo(ctx, params),
|
|
3409
|
+
reportContentInset: (inset) => {
|
|
3410
|
+
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3411
|
+
updateScroll(ctx, state.scroll, true);
|
|
3412
|
+
},
|
|
3334
3413
|
setScrollProcessingEnabled: (enabled) => {
|
|
3335
3414
|
state.scrollProcessingEnabled = enabled;
|
|
3336
3415
|
},
|
|
@@ -3340,6 +3419,54 @@ function createImperativeHandle(ctx) {
|
|
|
3340
3419
|
}
|
|
3341
3420
|
};
|
|
3342
3421
|
}
|
|
3422
|
+
|
|
3423
|
+
// src/utils/getAlwaysRenderIndices.ts
|
|
3424
|
+
var sortAsc = (a, b) => a - b;
|
|
3425
|
+
var toCount = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : 0;
|
|
3426
|
+
var addIndex = (result, dataLength, index) => {
|
|
3427
|
+
if (index >= 0 && index < dataLength) {
|
|
3428
|
+
result.add(index);
|
|
3429
|
+
}
|
|
3430
|
+
};
|
|
3431
|
+
function getAlwaysRenderIndices(config, data, keyExtractor) {
|
|
3432
|
+
var _a3, _b;
|
|
3433
|
+
if (!config || data.length === 0) {
|
|
3434
|
+
return [];
|
|
3435
|
+
}
|
|
3436
|
+
const result = /* @__PURE__ */ new Set();
|
|
3437
|
+
const dataLength = data.length;
|
|
3438
|
+
const topCount = toCount(config.top);
|
|
3439
|
+
if (topCount > 0) {
|
|
3440
|
+
for (let i = 0; i < Math.min(topCount, dataLength); i++) {
|
|
3441
|
+
addIndex(result, dataLength, i);
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
const bottomCount = toCount(config.bottom);
|
|
3445
|
+
if (bottomCount > 0) {
|
|
3446
|
+
for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
|
|
3447
|
+
addIndex(result, dataLength, i);
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
|
|
3451
|
+
for (const index of config.indices) {
|
|
3452
|
+
if (!Number.isFinite(index)) continue;
|
|
3453
|
+
addIndex(result, dataLength, Math.floor(index));
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
if ((_b = config.keys) == null ? void 0 : _b.length) {
|
|
3457
|
+
const keys = new Set(config.keys);
|
|
3458
|
+
for (let i = 0; i < dataLength && keys.size > 0; i++) {
|
|
3459
|
+
const key = keyExtractor(data[i], i);
|
|
3460
|
+
if (keys.has(key)) {
|
|
3461
|
+
addIndex(result, dataLength, i);
|
|
3462
|
+
keys.delete(key);
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
const indices = Array.from(result);
|
|
3467
|
+
indices.sort(sortAsc);
|
|
3468
|
+
return indices;
|
|
3469
|
+
}
|
|
3343
3470
|
function getRenderedItem(ctx, key) {
|
|
3344
3471
|
var _a3;
|
|
3345
3472
|
const state = ctx.state;
|
|
@@ -3456,9 +3583,10 @@ var LegendList = typedMemo(
|
|
|
3456
3583
|
})
|
|
3457
3584
|
);
|
|
3458
3585
|
var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
|
|
3459
|
-
var _a3, _b;
|
|
3586
|
+
var _a3, _b, _c, _d;
|
|
3460
3587
|
const {
|
|
3461
3588
|
alignItemsAtEnd = false,
|
|
3589
|
+
alwaysRender,
|
|
3462
3590
|
columnWrapperStyle,
|
|
3463
3591
|
contentContainerStyle: contentContainerStyleProp,
|
|
3464
3592
|
contentInset,
|
|
@@ -3487,6 +3615,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3487
3615
|
onEndReached,
|
|
3488
3616
|
onEndReachedThreshold = 0.5,
|
|
3489
3617
|
onItemSizeChanged,
|
|
3618
|
+
onMetricsChange,
|
|
3490
3619
|
onLayout: onLayoutProp,
|
|
3491
3620
|
onLoad,
|
|
3492
3621
|
onMomentumScrollEnd,
|
|
@@ -3535,6 +3664,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3535
3664
|
const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
|
|
3536
3665
|
const keyExtractor = keyExtractorProp != null ? keyExtractorProp : (_item, index) => index.toString();
|
|
3537
3666
|
const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
|
|
3667
|
+
const alwaysRenderIndices = React2.useMemo(() => {
|
|
3668
|
+
const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
|
|
3669
|
+
return { arr: indices, set: new Set(indices) };
|
|
3670
|
+
}, [
|
|
3671
|
+
alwaysRender == null ? void 0 : alwaysRender.top,
|
|
3672
|
+
alwaysRender == null ? void 0 : alwaysRender.bottom,
|
|
3673
|
+
(_a3 = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _a3.join(","),
|
|
3674
|
+
(_b = alwaysRender == null ? void 0 : alwaysRender.keys) == null ? void 0 : _b.join(","),
|
|
3675
|
+
dataProp,
|
|
3676
|
+
dataVersion,
|
|
3677
|
+
keyExtractor
|
|
3678
|
+
]);
|
|
3538
3679
|
if (IS_DEV && stickyIndicesDeprecated && !stickyHeaderIndicesProp) {
|
|
3539
3680
|
warnDevOnce(
|
|
3540
3681
|
"stickyIndices",
|
|
@@ -3566,7 +3707,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3566
3707
|
attempts: 0,
|
|
3567
3708
|
index: initialScrollProp.index,
|
|
3568
3709
|
settledTicks: 0,
|
|
3569
|
-
viewOffset: (
|
|
3710
|
+
viewOffset: (_c = initialScrollProp.viewOffset) != null ? _c : 0,
|
|
3570
3711
|
viewPosition: initialScrollProp.viewPosition
|
|
3571
3712
|
} : void 0,
|
|
3572
3713
|
initialScroll: initialScrollProp,
|
|
@@ -3580,6 +3721,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3580
3721
|
lastScrollDelta: 0,
|
|
3581
3722
|
loadStartTime: Date.now(),
|
|
3582
3723
|
minIndexSizeChanged: 0,
|
|
3724
|
+
contentInsetOverride: void 0,
|
|
3725
|
+
nativeContentInset: void 0,
|
|
3583
3726
|
nativeMarginTop: 0,
|
|
3584
3727
|
positions: /* @__PURE__ */ new Map(),
|
|
3585
3728
|
props: {},
|
|
@@ -3626,6 +3769,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3626
3769
|
const throttleScrollFn = scrollEventThrottle && onScrollProp ? useThrottledOnScroll(onScrollProp, scrollEventThrottle) : onScrollProp;
|
|
3627
3770
|
state.props = {
|
|
3628
3771
|
alignItemsAtEnd,
|
|
3772
|
+
alwaysRender,
|
|
3773
|
+
alwaysRenderIndicesArr: alwaysRenderIndices.arr,
|
|
3774
|
+
alwaysRenderIndicesSet: alwaysRenderIndices.set,
|
|
3629
3775
|
animatedProps: animatedPropsInternal,
|
|
3630
3776
|
contentInset,
|
|
3631
3777
|
data: dataProp,
|
|
@@ -3803,6 +3949,34 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3803
3949
|
stylePaddingBottomState,
|
|
3804
3950
|
stylePaddingTopState
|
|
3805
3951
|
]);
|
|
3952
|
+
React2.useEffect(() => {
|
|
3953
|
+
if (!onMetricsChange) {
|
|
3954
|
+
return;
|
|
3955
|
+
}
|
|
3956
|
+
let lastMetrics;
|
|
3957
|
+
const emitMetrics = () => {
|
|
3958
|
+
const metrics = {
|
|
3959
|
+
alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
|
|
3960
|
+
footerSize: peek$(ctx, "footerSize") || 0,
|
|
3961
|
+
headerSize: peek$(ctx, "headerSize") || 0
|
|
3962
|
+
};
|
|
3963
|
+
if (!lastMetrics || metrics.alignItemsAtEndPadding !== lastMetrics.alignItemsAtEndPadding || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
|
|
3964
|
+
lastMetrics = metrics;
|
|
3965
|
+
onMetricsChange(metrics);
|
|
3966
|
+
}
|
|
3967
|
+
};
|
|
3968
|
+
emitMetrics();
|
|
3969
|
+
const unsubscribe = [
|
|
3970
|
+
listen$(ctx, "alignItemsPaddingTop", emitMetrics),
|
|
3971
|
+
listen$(ctx, "headerSize", emitMetrics),
|
|
3972
|
+
listen$(ctx, "footerSize", emitMetrics)
|
|
3973
|
+
];
|
|
3974
|
+
return () => {
|
|
3975
|
+
for (const unsub of unsubscribe) {
|
|
3976
|
+
unsub();
|
|
3977
|
+
}
|
|
3978
|
+
};
|
|
3979
|
+
}, [ctx, onMetricsChange]);
|
|
3806
3980
|
React2.useEffect(() => {
|
|
3807
3981
|
const viewability = setupViewability({
|
|
3808
3982
|
onViewableItemsChanged,
|
|
@@ -3865,7 +4039,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3865
4039
|
}
|
|
3866
4040
|
),
|
|
3867
4041
|
refScrollView: combinedRef,
|
|
3868
|
-
scrollAdjustHandler: (
|
|
4042
|
+
scrollAdjustHandler: (_d = refState.current) == null ? void 0 : _d.scrollAdjustHandler,
|
|
3869
4043
|
scrollEventThrottle: 0,
|
|
3870
4044
|
snapToIndices,
|
|
3871
4045
|
stickyHeaderConfig,
|