@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.mjs
CHANGED
|
@@ -10,7 +10,7 @@ var Text = Text$1;
|
|
|
10
10
|
|
|
11
11
|
// src/state/getContentInsetEnd.ts
|
|
12
12
|
function getContentInsetEnd(state) {
|
|
13
|
-
var _a3;
|
|
13
|
+
var _a3, _b;
|
|
14
14
|
const { props } = state;
|
|
15
15
|
const horizontal = props.horizontal;
|
|
16
16
|
let contentInset = props.contentInset;
|
|
@@ -24,7 +24,16 @@ function getContentInsetEnd(state) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
|
|
28
|
+
const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
|
|
29
|
+
if (overrideInset) {
|
|
30
|
+
const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
|
|
31
|
+
return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
|
|
32
|
+
}
|
|
33
|
+
if (baseInset) {
|
|
34
|
+
return (horizontal ? baseInset.right : baseInset.bottom) || 0;
|
|
35
|
+
}
|
|
36
|
+
return 0;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
// src/state/getContentSize.ts
|
|
@@ -228,7 +237,8 @@ var ENABLE_DEVMODE = IS_DEV && false;
|
|
|
228
237
|
var ENABLE_DEBUG_VIEW = IS_DEV && false;
|
|
229
238
|
|
|
230
239
|
// src/constants-platform.native.ts
|
|
231
|
-
var
|
|
240
|
+
var f = global.nativeFabricUIManager;
|
|
241
|
+
var IsNewArchitecture = f !== void 0 && f != null;
|
|
232
242
|
var useAnimatedValue = (initialValue) => {
|
|
233
243
|
const [animAnimatedValue] = useState(() => new Animated.Value(initialValue));
|
|
234
244
|
return animAnimatedValue;
|
|
@@ -2331,7 +2341,7 @@ function getActiveStickyIndices(ctx, stickyHeaderIndices) {
|
|
|
2331
2341
|
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))
|
|
2332
2342
|
);
|
|
2333
2343
|
}
|
|
2334
|
-
function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
|
|
2344
|
+
function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, needNewContainersSet, startBuffered, endBuffered) {
|
|
2335
2345
|
var _a3;
|
|
2336
2346
|
const state = ctx.state;
|
|
2337
2347
|
const activeIndices = getActiveStickyIndices(ctx, stickyHeaderIndices);
|
|
@@ -2341,18 +2351,20 @@ function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentSt
|
|
|
2341
2351
|
if (idx < 0 || activeIndices.has(stickyArray[idx])) continue;
|
|
2342
2352
|
const stickyIndex = stickyArray[idx];
|
|
2343
2353
|
const stickyId = (_a3 = state.idCache[stickyIndex]) != null ? _a3 : getId(state, stickyIndex);
|
|
2344
|
-
if (stickyId && !state.containerItemKeys.has(stickyId) && (stickyIndex < startBuffered || stickyIndex > endBuffered)) {
|
|
2354
|
+
if (stickyId && !state.containerItemKeys.has(stickyId) && (stickyIndex < startBuffered || stickyIndex > endBuffered) && !needNewContainersSet.has(stickyIndex)) {
|
|
2355
|
+
needNewContainersSet.add(stickyIndex);
|
|
2345
2356
|
needNewContainers.push(stickyIndex);
|
|
2346
2357
|
}
|
|
2347
2358
|
}
|
|
2348
2359
|
}
|
|
2349
|
-
function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentStickyIdx, pendingRemoval) {
|
|
2360
|
+
function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentStickyIdx, pendingRemoval, alwaysRenderIndicesSet) {
|
|
2350
2361
|
var _a3, _b, _c;
|
|
2351
2362
|
const state = ctx.state;
|
|
2352
2363
|
for (const containerIndex of state.stickyContainerPool) {
|
|
2353
2364
|
const itemKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
2354
2365
|
const itemIndex = itemKey ? state.indexByKey.get(itemKey) : void 0;
|
|
2355
2366
|
if (itemIndex === void 0) continue;
|
|
2367
|
+
if (alwaysRenderIndicesSet.has(itemIndex)) continue;
|
|
2356
2368
|
const arrayIdx = stickyArray.indexOf(itemIndex);
|
|
2357
2369
|
if (arrayIdx === -1) {
|
|
2358
2370
|
state.stickyContainerPool.delete(containerIndex);
|
|
@@ -2384,7 +2396,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentSt
|
|
|
2384
2396
|
function calculateItemsInView(ctx, params = {}) {
|
|
2385
2397
|
const state = ctx.state;
|
|
2386
2398
|
unstable_batchedUpdates(() => {
|
|
2387
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2399
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2388
2400
|
const {
|
|
2389
2401
|
columns,
|
|
2390
2402
|
containerItemKeys,
|
|
@@ -2394,7 +2406,15 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2394
2406
|
initialScroll,
|
|
2395
2407
|
minIndexSizeChanged,
|
|
2396
2408
|
positions,
|
|
2397
|
-
props: {
|
|
2409
|
+
props: {
|
|
2410
|
+
alwaysRenderIndicesArr,
|
|
2411
|
+
alwaysRenderIndicesSet,
|
|
2412
|
+
getItemType,
|
|
2413
|
+
itemsAreEqual,
|
|
2414
|
+
keyExtractor,
|
|
2415
|
+
onStickyHeaderChange,
|
|
2416
|
+
scrollBuffer
|
|
2417
|
+
},
|
|
2398
2418
|
scrollForNextCalculateItemsInView,
|
|
2399
2419
|
scrollLength,
|
|
2400
2420
|
sizes,
|
|
@@ -2404,6 +2424,8 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2404
2424
|
const { data } = state.props;
|
|
2405
2425
|
const stickyIndicesArr = state.props.stickyIndicesArr || [];
|
|
2406
2426
|
const stickyIndicesSet = state.props.stickyIndicesSet || /* @__PURE__ */ new Set();
|
|
2427
|
+
const alwaysRenderArr = alwaysRenderIndicesArr || [];
|
|
2428
|
+
const alwaysRenderSet = alwaysRenderIndicesSet || /* @__PURE__ */ new Set();
|
|
2407
2429
|
const prevNumContainers = peek$(ctx, "numContainers");
|
|
2408
2430
|
if (!data || scrollLength === 0 || !prevNumContainers) {
|
|
2409
2431
|
if (!IsNewArchitecture && state.initialAnchor) {
|
|
@@ -2586,12 +2608,24 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2586
2608
|
}
|
|
2587
2609
|
if (startBuffered !== null && endBuffered !== null) {
|
|
2588
2610
|
const needNewContainers = [];
|
|
2611
|
+
const needNewContainersSet = /* @__PURE__ */ new Set();
|
|
2589
2612
|
for (let i = startBuffered; i <= endBuffered; i++) {
|
|
2590
2613
|
const id = (_h = idCache[i]) != null ? _h : getId(state, i);
|
|
2591
2614
|
if (!containerItemKeys.has(id)) {
|
|
2615
|
+
needNewContainersSet.add(i);
|
|
2592
2616
|
needNewContainers.push(i);
|
|
2593
2617
|
}
|
|
2594
2618
|
}
|
|
2619
|
+
if (alwaysRenderArr.length > 0) {
|
|
2620
|
+
for (const index of alwaysRenderArr) {
|
|
2621
|
+
if (index < 0 || index >= dataLength) continue;
|
|
2622
|
+
const id = (_i = idCache[index]) != null ? _i : getId(state, index);
|
|
2623
|
+
if (id && !containerItemKeys.has(id) && !needNewContainersSet.has(index)) {
|
|
2624
|
+
needNewContainersSet.add(index);
|
|
2625
|
+
needNewContainers.push(index);
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2595
2629
|
if (stickyIndicesArr.length > 0) {
|
|
2596
2630
|
handleStickyActivation(
|
|
2597
2631
|
ctx,
|
|
@@ -2599,6 +2633,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2599
2633
|
stickyIndicesArr,
|
|
2600
2634
|
currentStickyIdx,
|
|
2601
2635
|
needNewContainers,
|
|
2636
|
+
needNewContainersSet,
|
|
2602
2637
|
startBuffered,
|
|
2603
2638
|
endBuffered
|
|
2604
2639
|
);
|
|
@@ -2622,7 +2657,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2622
2657
|
for (let idx = 0; idx < needNewContainers.length; idx++) {
|
|
2623
2658
|
const i = needNewContainers[idx];
|
|
2624
2659
|
const containerIndex = availableContainers[idx];
|
|
2625
|
-
const id = (
|
|
2660
|
+
const id = (_j = idCache[i]) != null ? _j : getId(state, i);
|
|
2626
2661
|
const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
2627
2662
|
if (oldKey && oldKey !== id) {
|
|
2628
2663
|
containerItemKeys.delete(oldKey);
|
|
@@ -2634,14 +2669,23 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2634
2669
|
}
|
|
2635
2670
|
containerItemKeys.set(id, containerIndex);
|
|
2636
2671
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
2637
|
-
|
|
2672
|
+
const isSticky = stickyIndicesSet.has(i);
|
|
2673
|
+
const isAlwaysRender = alwaysRenderSet.has(i);
|
|
2674
|
+
if (isSticky) {
|
|
2638
2675
|
set$(ctx, containerSticky, true);
|
|
2639
2676
|
const topPadding = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
|
|
2640
2677
|
set$(ctx, `containerStickyOffset${containerIndex}`, topPadding);
|
|
2641
2678
|
state.stickyContainerPool.add(containerIndex);
|
|
2642
|
-
} else
|
|
2643
|
-
|
|
2644
|
-
|
|
2679
|
+
} else {
|
|
2680
|
+
if (peek$(ctx, containerSticky)) {
|
|
2681
|
+
set$(ctx, containerSticky, false);
|
|
2682
|
+
set$(ctx, `containerStickyOffset${containerIndex}`, void 0);
|
|
2683
|
+
}
|
|
2684
|
+
if (isAlwaysRender) {
|
|
2685
|
+
state.stickyContainerPool.add(containerIndex);
|
|
2686
|
+
} else if (state.stickyContainerPool.has(containerIndex)) {
|
|
2687
|
+
state.stickyContainerPool.delete(containerIndex);
|
|
2688
|
+
}
|
|
2645
2689
|
}
|
|
2646
2690
|
if (containerIndex >= numContainers) {
|
|
2647
2691
|
numContainers = containerIndex + 1;
|
|
@@ -2654,9 +2698,27 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2654
2698
|
}
|
|
2655
2699
|
}
|
|
2656
2700
|
}
|
|
2701
|
+
if (alwaysRenderArr.length > 0) {
|
|
2702
|
+
for (const index of alwaysRenderArr) {
|
|
2703
|
+
if (index < 0 || index >= dataLength) continue;
|
|
2704
|
+
const id = (_k = idCache[index]) != null ? _k : getId(state, index);
|
|
2705
|
+
const containerIndex = containerItemKeys.get(id);
|
|
2706
|
+
if (containerIndex !== void 0) {
|
|
2707
|
+
state.stickyContainerPool.add(containerIndex);
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2657
2711
|
}
|
|
2658
|
-
if (
|
|
2659
|
-
handleStickyRecycling(
|
|
2712
|
+
if (state.stickyContainerPool.size > 0) {
|
|
2713
|
+
handleStickyRecycling(
|
|
2714
|
+
ctx,
|
|
2715
|
+
stickyIndicesArr,
|
|
2716
|
+
scroll,
|
|
2717
|
+
scrollBuffer,
|
|
2718
|
+
currentStickyIdx,
|
|
2719
|
+
pendingRemoval,
|
|
2720
|
+
alwaysRenderSet
|
|
2721
|
+
);
|
|
2660
2722
|
}
|
|
2661
2723
|
let didChangePositions = false;
|
|
2662
2724
|
for (let i = 0; i < numContainers; i++) {
|
|
@@ -2679,7 +2741,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
2679
2741
|
const itemIndex = indexByKey.get(itemKey);
|
|
2680
2742
|
const item = data[itemIndex];
|
|
2681
2743
|
if (item !== void 0) {
|
|
2682
|
-
const id = (
|
|
2744
|
+
const id = (_l = idCache[itemIndex]) != null ? _l : getId(state, itemIndex);
|
|
2683
2745
|
const positionValue = positions.get(id);
|
|
2684
2746
|
if (positionValue === void 0) {
|
|
2685
2747
|
set$(ctx, `containerPosition${i}`, POSITION_OUT_OF_VIEW);
|
|
@@ -2953,7 +3015,7 @@ function handleLayout(ctx, layout, setCanRender) {
|
|
|
2953
3015
|
|
|
2954
3016
|
// src/core/onScroll.ts
|
|
2955
3017
|
function onScroll(ctx, event) {
|
|
2956
|
-
var _a3, _b, _c;
|
|
3018
|
+
var _a3, _b, _c, _d;
|
|
2957
3019
|
const state = ctx.state;
|
|
2958
3020
|
const {
|
|
2959
3021
|
scrollProcessingEnabled,
|
|
@@ -2965,6 +3027,15 @@ function onScroll(ctx, event) {
|
|
|
2965
3027
|
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) {
|
|
2966
3028
|
return;
|
|
2967
3029
|
}
|
|
3030
|
+
let insetChanged = false;
|
|
3031
|
+
if ((_d = event.nativeEvent) == null ? void 0 : _d.contentInset) {
|
|
3032
|
+
const { contentInset } = event.nativeEvent;
|
|
3033
|
+
const prevInset = state.nativeContentInset;
|
|
3034
|
+
if (!prevInset || prevInset.top !== contentInset.top || prevInset.bottom !== contentInset.bottom || prevInset.left !== contentInset.left || prevInset.right !== contentInset.right) {
|
|
3035
|
+
state.nativeContentInset = contentInset;
|
|
3036
|
+
insetChanged = true;
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
2968
3039
|
let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
|
|
2969
3040
|
if (state.scrollingTo) {
|
|
2970
3041
|
const maxOffset = clampScrollOffset(ctx, newScroll);
|
|
@@ -2980,7 +3051,7 @@ function onScroll(ctx, event) {
|
|
|
2980
3051
|
}
|
|
2981
3052
|
}
|
|
2982
3053
|
state.scrollPending = newScroll;
|
|
2983
|
-
updateScroll(ctx, newScroll);
|
|
3054
|
+
updateScroll(ctx, newScroll, insetChanged);
|
|
2984
3055
|
if (state.scrollingTo) {
|
|
2985
3056
|
checkFinishedScroll(ctx);
|
|
2986
3057
|
}
|
|
@@ -3153,7 +3224,10 @@ function updateOneItemSize(ctx, itemKey, sizeObj) {
|
|
|
3153
3224
|
if (!averages) {
|
|
3154
3225
|
averages = averageSizes[itemType] = { avg: 0, num: 0 };
|
|
3155
3226
|
}
|
|
3156
|
-
if (
|
|
3227
|
+
if (averages.num === 0) {
|
|
3228
|
+
averages.avg = size;
|
|
3229
|
+
averages.num++;
|
|
3230
|
+
} else if (prevSizeKnown !== void 0 && prevSizeKnown > 0) {
|
|
3157
3231
|
averages.avg += (size - prevSizeKnown) / averages.num;
|
|
3158
3232
|
} else {
|
|
3159
3233
|
averages.avg = (averages.avg * averages.num + size) / (averages.num + 1);
|
|
@@ -3257,7 +3331,7 @@ function createImperativeHandle(ctx) {
|
|
|
3257
3331
|
getScrollResponder: () => refScroller.current.getScrollResponder(),
|
|
3258
3332
|
getState: () => ({
|
|
3259
3333
|
activeStickyIndex: peek$(ctx, "activeStickyIndex"),
|
|
3260
|
-
contentLength:
|
|
3334
|
+
contentLength: getContentSize(ctx),
|
|
3261
3335
|
data: state.props.data,
|
|
3262
3336
|
elementAtIndex: (index) => {
|
|
3263
3337
|
var _a3;
|
|
@@ -3273,6 +3347,7 @@ function createImperativeHandle(ctx) {
|
|
|
3273
3347
|
positions: state.positions,
|
|
3274
3348
|
scroll: state.scroll,
|
|
3275
3349
|
scrollLength: state.scrollLength,
|
|
3350
|
+
scrollVelocity: getScrollVelocity(state),
|
|
3276
3351
|
sizeAtIndex: (index) => state.sizesKnown.get(getId(state, index)),
|
|
3277
3352
|
sizes: state.sizesKnown,
|
|
3278
3353
|
start: state.startNoBuffer,
|
|
@@ -3310,6 +3385,10 @@ function createImperativeHandle(ctx) {
|
|
|
3310
3385
|
}
|
|
3311
3386
|
},
|
|
3312
3387
|
scrollToOffset: (params) => scrollTo(ctx, params),
|
|
3388
|
+
reportContentInset: (inset) => {
|
|
3389
|
+
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3390
|
+
updateScroll(ctx, state.scroll, true);
|
|
3391
|
+
},
|
|
3313
3392
|
setScrollProcessingEnabled: (enabled) => {
|
|
3314
3393
|
state.scrollProcessingEnabled = enabled;
|
|
3315
3394
|
},
|
|
@@ -3319,6 +3398,54 @@ function createImperativeHandle(ctx) {
|
|
|
3319
3398
|
}
|
|
3320
3399
|
};
|
|
3321
3400
|
}
|
|
3401
|
+
|
|
3402
|
+
// src/utils/getAlwaysRenderIndices.ts
|
|
3403
|
+
var sortAsc = (a, b) => a - b;
|
|
3404
|
+
var toCount = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : 0;
|
|
3405
|
+
var addIndex = (result, dataLength, index) => {
|
|
3406
|
+
if (index >= 0 && index < dataLength) {
|
|
3407
|
+
result.add(index);
|
|
3408
|
+
}
|
|
3409
|
+
};
|
|
3410
|
+
function getAlwaysRenderIndices(config, data, keyExtractor) {
|
|
3411
|
+
var _a3, _b;
|
|
3412
|
+
if (!config || data.length === 0) {
|
|
3413
|
+
return [];
|
|
3414
|
+
}
|
|
3415
|
+
const result = /* @__PURE__ */ new Set();
|
|
3416
|
+
const dataLength = data.length;
|
|
3417
|
+
const topCount = toCount(config.top);
|
|
3418
|
+
if (topCount > 0) {
|
|
3419
|
+
for (let i = 0; i < Math.min(topCount, dataLength); i++) {
|
|
3420
|
+
addIndex(result, dataLength, i);
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
const bottomCount = toCount(config.bottom);
|
|
3424
|
+
if (bottomCount > 0) {
|
|
3425
|
+
for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
|
|
3426
|
+
addIndex(result, dataLength, i);
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
|
|
3430
|
+
for (const index of config.indices) {
|
|
3431
|
+
if (!Number.isFinite(index)) continue;
|
|
3432
|
+
addIndex(result, dataLength, Math.floor(index));
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
if ((_b = config.keys) == null ? void 0 : _b.length) {
|
|
3436
|
+
const keys = new Set(config.keys);
|
|
3437
|
+
for (let i = 0; i < dataLength && keys.size > 0; i++) {
|
|
3438
|
+
const key = keyExtractor(data[i], i);
|
|
3439
|
+
if (keys.has(key)) {
|
|
3440
|
+
addIndex(result, dataLength, i);
|
|
3441
|
+
keys.delete(key);
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
const indices = Array.from(result);
|
|
3446
|
+
indices.sort(sortAsc);
|
|
3447
|
+
return indices;
|
|
3448
|
+
}
|
|
3322
3449
|
function getRenderedItem(ctx, key) {
|
|
3323
3450
|
var _a3;
|
|
3324
3451
|
const state = ctx.state;
|
|
@@ -3435,9 +3562,10 @@ var LegendList = typedMemo(
|
|
|
3435
3562
|
})
|
|
3436
3563
|
);
|
|
3437
3564
|
var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
|
|
3438
|
-
var _a3, _b;
|
|
3565
|
+
var _a3, _b, _c, _d;
|
|
3439
3566
|
const {
|
|
3440
3567
|
alignItemsAtEnd = false,
|
|
3568
|
+
alwaysRender,
|
|
3441
3569
|
columnWrapperStyle,
|
|
3442
3570
|
contentContainerStyle: contentContainerStyleProp,
|
|
3443
3571
|
contentInset,
|
|
@@ -3466,6 +3594,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3466
3594
|
onEndReached,
|
|
3467
3595
|
onEndReachedThreshold = 0.5,
|
|
3468
3596
|
onItemSizeChanged,
|
|
3597
|
+
onMetricsChange,
|
|
3469
3598
|
onLayout: onLayoutProp,
|
|
3470
3599
|
onLoad,
|
|
3471
3600
|
onMomentumScrollEnd,
|
|
@@ -3514,6 +3643,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3514
3643
|
const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
|
|
3515
3644
|
const keyExtractor = keyExtractorProp != null ? keyExtractorProp : (_item, index) => index.toString();
|
|
3516
3645
|
const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
|
|
3646
|
+
const alwaysRenderIndices = useMemo(() => {
|
|
3647
|
+
const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
|
|
3648
|
+
return { arr: indices, set: new Set(indices) };
|
|
3649
|
+
}, [
|
|
3650
|
+
alwaysRender == null ? void 0 : alwaysRender.top,
|
|
3651
|
+
alwaysRender == null ? void 0 : alwaysRender.bottom,
|
|
3652
|
+
(_a3 = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _a3.join(","),
|
|
3653
|
+
(_b = alwaysRender == null ? void 0 : alwaysRender.keys) == null ? void 0 : _b.join(","),
|
|
3654
|
+
dataProp,
|
|
3655
|
+
dataVersion,
|
|
3656
|
+
keyExtractor
|
|
3657
|
+
]);
|
|
3517
3658
|
if (IS_DEV && stickyIndicesDeprecated && !stickyHeaderIndicesProp) {
|
|
3518
3659
|
warnDevOnce(
|
|
3519
3660
|
"stickyIndices",
|
|
@@ -3545,7 +3686,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3545
3686
|
attempts: 0,
|
|
3546
3687
|
index: initialScrollProp.index,
|
|
3547
3688
|
settledTicks: 0,
|
|
3548
|
-
viewOffset: (
|
|
3689
|
+
viewOffset: (_c = initialScrollProp.viewOffset) != null ? _c : 0,
|
|
3549
3690
|
viewPosition: initialScrollProp.viewPosition
|
|
3550
3691
|
} : void 0,
|
|
3551
3692
|
initialScroll: initialScrollProp,
|
|
@@ -3559,6 +3700,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3559
3700
|
lastScrollDelta: 0,
|
|
3560
3701
|
loadStartTime: Date.now(),
|
|
3561
3702
|
minIndexSizeChanged: 0,
|
|
3703
|
+
contentInsetOverride: void 0,
|
|
3704
|
+
nativeContentInset: void 0,
|
|
3562
3705
|
nativeMarginTop: 0,
|
|
3563
3706
|
positions: /* @__PURE__ */ new Map(),
|
|
3564
3707
|
props: {},
|
|
@@ -3605,6 +3748,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3605
3748
|
const throttleScrollFn = scrollEventThrottle && onScrollProp ? useThrottledOnScroll(onScrollProp, scrollEventThrottle) : onScrollProp;
|
|
3606
3749
|
state.props = {
|
|
3607
3750
|
alignItemsAtEnd,
|
|
3751
|
+
alwaysRender,
|
|
3752
|
+
alwaysRenderIndicesArr: alwaysRenderIndices.arr,
|
|
3753
|
+
alwaysRenderIndicesSet: alwaysRenderIndices.set,
|
|
3608
3754
|
animatedProps: animatedPropsInternal,
|
|
3609
3755
|
contentInset,
|
|
3610
3756
|
data: dataProp,
|
|
@@ -3782,6 +3928,34 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3782
3928
|
stylePaddingBottomState,
|
|
3783
3929
|
stylePaddingTopState
|
|
3784
3930
|
]);
|
|
3931
|
+
useEffect(() => {
|
|
3932
|
+
if (!onMetricsChange) {
|
|
3933
|
+
return;
|
|
3934
|
+
}
|
|
3935
|
+
let lastMetrics;
|
|
3936
|
+
const emitMetrics = () => {
|
|
3937
|
+
const metrics = {
|
|
3938
|
+
alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
|
|
3939
|
+
footerSize: peek$(ctx, "footerSize") || 0,
|
|
3940
|
+
headerSize: peek$(ctx, "headerSize") || 0
|
|
3941
|
+
};
|
|
3942
|
+
if (!lastMetrics || metrics.alignItemsAtEndPadding !== lastMetrics.alignItemsAtEndPadding || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
|
|
3943
|
+
lastMetrics = metrics;
|
|
3944
|
+
onMetricsChange(metrics);
|
|
3945
|
+
}
|
|
3946
|
+
};
|
|
3947
|
+
emitMetrics();
|
|
3948
|
+
const unsubscribe = [
|
|
3949
|
+
listen$(ctx, "alignItemsPaddingTop", emitMetrics),
|
|
3950
|
+
listen$(ctx, "headerSize", emitMetrics),
|
|
3951
|
+
listen$(ctx, "footerSize", emitMetrics)
|
|
3952
|
+
];
|
|
3953
|
+
return () => {
|
|
3954
|
+
for (const unsub of unsubscribe) {
|
|
3955
|
+
unsub();
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
}, [ctx, onMetricsChange]);
|
|
3785
3959
|
useEffect(() => {
|
|
3786
3960
|
const viewability = setupViewability({
|
|
3787
3961
|
onViewableItemsChanged,
|
|
@@ -3844,7 +4018,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3844
4018
|
}
|
|
3845
4019
|
),
|
|
3846
4020
|
refScrollView: combinedRef,
|
|
3847
|
-
scrollAdjustHandler: (
|
|
4021
|
+
scrollAdjustHandler: (_d = refState.current) == null ? void 0 : _d.scrollAdjustHandler,
|
|
3848
4022
|
scrollEventThrottle: 0,
|
|
3849
4023
|
snapToIndices,
|
|
3850
4024
|
stickyHeaderConfig,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LegendList as LegendList$1, LegendListProps, LegendListRef } from '@legendapp/list';
|
|
3
|
+
import { AnimatedLegendList } from '@legendapp/list/animated';
|
|
4
|
+
import { AnimatedLegendList as AnimatedLegendList$1 } from '@legendapp/list/reanimated';
|
|
5
|
+
|
|
6
|
+
declare const LegendList: <ItemT, ListT extends typeof LegendList$1 | typeof AnimatedLegendList | typeof AnimatedLegendList$1 = (<T>(props: LegendListProps<T> & React.RefAttributes<LegendListRef>) => React.ReactNode) & {
|
|
7
|
+
displayName?: string;
|
|
8
|
+
}>(props: (LegendListProps<ItemT> & {
|
|
9
|
+
LegendList?: ListT;
|
|
10
|
+
}) & React.RefAttributes<LegendListRef>) => React.ReactNode;
|
|
11
|
+
|
|
12
|
+
export { LegendList };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LegendList as LegendList$1, LegendListProps, LegendListRef } from '@legendapp/list';
|
|
3
|
+
import { AnimatedLegendList } from '@legendapp/list/animated';
|
|
4
|
+
import { AnimatedLegendList as AnimatedLegendList$1 } from '@legendapp/list/reanimated';
|
|
5
|
+
|
|
6
|
+
declare const LegendList: <ItemT, ListT extends typeof LegendList$1 | typeof AnimatedLegendList | typeof AnimatedLegendList$1 = (<T>(props: LegendListProps<T> & React.RefAttributes<LegendListRef>) => React.ReactNode) & {
|
|
7
|
+
displayName?: string;
|
|
8
|
+
}>(props: (LegendListProps<ItemT> & {
|
|
9
|
+
LegendList?: ListT;
|
|
10
|
+
}) & React.RefAttributes<LegendListRef>) => React.ReactNode;
|
|
11
|
+
|
|
12
|
+
export { LegendList };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactNative = require('react-native');
|
|
5
|
+
var reactNativeKeyboardController = require('react-native-keyboard-controller');
|
|
6
|
+
var reactNativeReanimated = require('react-native-reanimated');
|
|
7
|
+
var list = require('@legendapp/list');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
|
+
|
|
29
|
+
// src/integrations/keyboard-controller.tsx
|
|
30
|
+
var typedForwardRef = React.forwardRef;
|
|
31
|
+
var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
|
|
32
|
+
const {
|
|
33
|
+
LegendList: LegendListProp,
|
|
34
|
+
contentContainerStyle: contentContainerStyleProp,
|
|
35
|
+
scrollIndicatorInsets: scrollIndicatorInsetsProp,
|
|
36
|
+
...rest
|
|
37
|
+
} = props;
|
|
38
|
+
const [padding, setPadding] = React.useState(0);
|
|
39
|
+
const updatePadding = (height) => {
|
|
40
|
+
setPadding(height);
|
|
41
|
+
};
|
|
42
|
+
reactNativeKeyboardController.useKeyboardHandler({
|
|
43
|
+
onEnd: (e) => {
|
|
44
|
+
"worklet";
|
|
45
|
+
reactNativeReanimated.runOnJS(updatePadding)(e.height);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const LegendListComponent = LegendListProp != null ? LegendListProp : list.LegendList;
|
|
49
|
+
const contentContainerStyleFlattened = reactNative.StyleSheet.flatten(contentContainerStyleProp) || {};
|
|
50
|
+
const contentContainerStyle = { ...contentContainerStyleFlattened, paddingTop: padding };
|
|
51
|
+
const scrollIndicatorInsets = scrollIndicatorInsetsProp ? { ...scrollIndicatorInsetsProp } : {};
|
|
52
|
+
if (!props.horizontal) {
|
|
53
|
+
scrollIndicatorInsets.top = ((scrollIndicatorInsets == null ? void 0 : scrollIndicatorInsets.top) || 0) + padding;
|
|
54
|
+
}
|
|
55
|
+
return (
|
|
56
|
+
// @ts-expect-error TODO: Fix this type
|
|
57
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
58
|
+
LegendListComponent,
|
|
59
|
+
{
|
|
60
|
+
...rest,
|
|
61
|
+
contentContainerStyle,
|
|
62
|
+
ref: forwardedRef,
|
|
63
|
+
scrollIndicatorInsets
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
exports.LegendList = LegendList;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState, forwardRef } from 'react';
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { useKeyboardHandler } from 'react-native-keyboard-controller';
|
|
5
|
+
import { runOnJS } from 'react-native-reanimated';
|
|
6
|
+
import { LegendList as LegendList$1 } from '@legendapp/list';
|
|
7
|
+
|
|
8
|
+
// src/integrations/keyboard-controller.tsx
|
|
9
|
+
var typedForwardRef = forwardRef;
|
|
10
|
+
var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
|
|
11
|
+
const {
|
|
12
|
+
LegendList: LegendListProp,
|
|
13
|
+
contentContainerStyle: contentContainerStyleProp,
|
|
14
|
+
scrollIndicatorInsets: scrollIndicatorInsetsProp,
|
|
15
|
+
...rest
|
|
16
|
+
} = props;
|
|
17
|
+
const [padding, setPadding] = useState(0);
|
|
18
|
+
const updatePadding = (height) => {
|
|
19
|
+
setPadding(height);
|
|
20
|
+
};
|
|
21
|
+
useKeyboardHandler({
|
|
22
|
+
onEnd: (e) => {
|
|
23
|
+
"worklet";
|
|
24
|
+
runOnJS(updatePadding)(e.height);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const LegendListComponent = LegendListProp != null ? LegendListProp : LegendList$1;
|
|
28
|
+
const contentContainerStyleFlattened = StyleSheet.flatten(contentContainerStyleProp) || {};
|
|
29
|
+
const contentContainerStyle = { ...contentContainerStyleFlattened, paddingTop: padding };
|
|
30
|
+
const scrollIndicatorInsets = scrollIndicatorInsetsProp ? { ...scrollIndicatorInsetsProp } : {};
|
|
31
|
+
if (!props.horizontal) {
|
|
32
|
+
scrollIndicatorInsets.top = ((scrollIndicatorInsets == null ? void 0 : scrollIndicatorInsets.top) || 0) + padding;
|
|
33
|
+
}
|
|
34
|
+
return (
|
|
35
|
+
// @ts-expect-error TODO: Fix this type
|
|
36
|
+
/* @__PURE__ */ React.createElement(
|
|
37
|
+
LegendListComponent,
|
|
38
|
+
{
|
|
39
|
+
...rest,
|
|
40
|
+
contentContainerStyle,
|
|
41
|
+
ref: forwardedRef,
|
|
42
|
+
scrollIndicatorInsets
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { LegendList };
|