@legendapp/list 3.0.0-beta.26 → 3.0.0-beta.28
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 +1 -3
- package/index.d.ts +1 -3
- package/index.js +33 -76
- package/index.mjs +33 -76
- package/index.native.d.mts +1 -3
- package/index.native.d.ts +1 -3
- package/index.native.js +33 -76
- package/index.native.mjs +33 -76
- package/keyboard.js +101 -23
- package/keyboard.mjs +102 -24
- package/keyboard.native.js +101 -23
- package/keyboard.native.mjs +102 -24
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -5,11 +5,10 @@ import Reanimated from 'react-native-reanimated';
|
|
|
5
5
|
|
|
6
6
|
type AnimatedValue = number;
|
|
7
7
|
|
|
8
|
-
type ListenerType = "activeStickyIndex" | "
|
|
8
|
+
type ListenerType = "activeStickyIndex" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | `containerColumn${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}` | `containerStickyOffset${number}`;
|
|
9
9
|
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
10
10
|
type ListenerTypeValueMap = {
|
|
11
11
|
activeStickyIndex: number;
|
|
12
|
-
alignItemsPaddingTop: number;
|
|
13
12
|
animatedScrollY: any;
|
|
14
13
|
debugComputedScroll: number;
|
|
15
14
|
debugRawScroll: number;
|
|
@@ -401,7 +400,6 @@ interface ColumnWrapperStyle {
|
|
|
401
400
|
columnGap?: number;
|
|
402
401
|
}
|
|
403
402
|
interface LegendListMetrics {
|
|
404
|
-
alignItemsAtEndPadding: number;
|
|
405
403
|
headerSize: number;
|
|
406
404
|
footerSize: number;
|
|
407
405
|
}
|
package/index.d.ts
CHANGED
|
@@ -5,11 +5,10 @@ import Reanimated from 'react-native-reanimated';
|
|
|
5
5
|
|
|
6
6
|
type AnimatedValue = number;
|
|
7
7
|
|
|
8
|
-
type ListenerType = "activeStickyIndex" | "
|
|
8
|
+
type ListenerType = "activeStickyIndex" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | `containerColumn${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}` | `containerStickyOffset${number}`;
|
|
9
9
|
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
10
10
|
type ListenerTypeValueMap = {
|
|
11
11
|
activeStickyIndex: number;
|
|
12
|
-
alignItemsPaddingTop: number;
|
|
13
12
|
animatedScrollY: any;
|
|
14
13
|
debugComputedScroll: number;
|
|
15
14
|
debugRawScroll: number;
|
|
@@ -401,7 +400,6 @@ interface ColumnWrapperStyle {
|
|
|
401
400
|
columnGap?: number;
|
|
402
401
|
}
|
|
403
402
|
interface LegendListMetrics {
|
|
404
|
-
alignItemsAtEndPadding: number;
|
|
405
403
|
headerSize: number;
|
|
406
404
|
footerSize: number;
|
|
407
405
|
}
|
package/index.js
CHANGED
|
@@ -84,7 +84,6 @@ function StateProvider({ children }) {
|
|
|
84
84
|
positionListeners: /* @__PURE__ */ new Map(),
|
|
85
85
|
state: void 0,
|
|
86
86
|
values: /* @__PURE__ */ new Map([
|
|
87
|
-
["alignItemsPaddingTop", 0],
|
|
88
87
|
["stylePaddingTop", 0],
|
|
89
88
|
["headerSize", 0],
|
|
90
89
|
["numContainers", 0],
|
|
@@ -1104,26 +1103,6 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
|
|
|
1104
1103
|
const { contentInset, scrollEventThrottle, ScrollComponent, ...webProps } = props;
|
|
1105
1104
|
return /* @__PURE__ */ React3__namespace.createElement("div", { ref: scrollRef, ...webProps, style: scrollViewStyle }, refreshControl, /* @__PURE__ */ React3__namespace.createElement("div", { ref: contentRef, style: contentStyle }, children));
|
|
1106
1105
|
});
|
|
1107
|
-
function Padding() {
|
|
1108
|
-
const [paddingTop] = useArr$(["alignItemsPaddingTop"]);
|
|
1109
|
-
return /* @__PURE__ */ React3__namespace.createElement("div", { style: { paddingTop } });
|
|
1110
|
-
}
|
|
1111
|
-
function PaddingDevMode() {
|
|
1112
|
-
const [paddingTop] = useArr$(["alignItemsPaddingTop"]);
|
|
1113
|
-
return /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, /* @__PURE__ */ React3__namespace.createElement("div", { style: { paddingTop } }), /* @__PURE__ */ React3__namespace.createElement(
|
|
1114
|
-
"div",
|
|
1115
|
-
{
|
|
1116
|
-
style: {
|
|
1117
|
-
backgroundColor: "green",
|
|
1118
|
-
height: paddingTop,
|
|
1119
|
-
left: 0,
|
|
1120
|
-
position: "absolute",
|
|
1121
|
-
right: 0,
|
|
1122
|
-
top: 0
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
));
|
|
1126
|
-
}
|
|
1127
1106
|
function useValueListener$(key, callback) {
|
|
1128
1107
|
const ctx = useStateContext();
|
|
1129
1108
|
React3.useLayoutEffect(() => {
|
|
@@ -1200,7 +1179,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1200
1179
|
initialContentOffset,
|
|
1201
1180
|
recycleItems,
|
|
1202
1181
|
ItemSeparatorComponent,
|
|
1203
|
-
alignItemsAtEnd,
|
|
1182
|
+
alignItemsAtEnd: _alignItemsAtEnd,
|
|
1204
1183
|
waitForInitialLayout,
|
|
1205
1184
|
onScroll: onScroll2,
|
|
1206
1185
|
onLayout,
|
|
@@ -1247,7 +1226,6 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1247
1226
|
style
|
|
1248
1227
|
},
|
|
1249
1228
|
/* @__PURE__ */ React3__namespace.createElement(ScrollAdjust, null),
|
|
1250
|
-
ENABLE_DEVMODE ? /* @__PURE__ */ React3__namespace.createElement(PaddingDevMode, null) : /* @__PURE__ */ React3__namespace.createElement(Padding, null),
|
|
1251
1229
|
ListHeaderComponent && /* @__PURE__ */ React3__namespace.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
|
|
1252
1230
|
ListEmptyComponent && getComponent(ListEmptyComponent),
|
|
1253
1231
|
canRender && !ListEmptyComponent && /* @__PURE__ */ React3__namespace.createElement(
|
|
@@ -1307,47 +1285,9 @@ function calculateOffsetForIndex(ctx, index) {
|
|
|
1307
1285
|
return position;
|
|
1308
1286
|
}
|
|
1309
1287
|
|
|
1310
|
-
// src/utils/setPaddingTop.ts
|
|
1311
|
-
function setPaddingTop(ctx, { stylePaddingTop, alignItemsPaddingTop }) {
|
|
1312
|
-
const state = ctx.state;
|
|
1313
|
-
if (stylePaddingTop !== void 0) {
|
|
1314
|
-
const prevStylePaddingTop = peek$(ctx, "stylePaddingTop") || 0;
|
|
1315
|
-
if (stylePaddingTop < prevStylePaddingTop) {
|
|
1316
|
-
let prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
1317
|
-
set$(ctx, "totalSize", prevTotalSize + prevStylePaddingTop);
|
|
1318
|
-
state.timeoutSetPaddingTop = setTimeout(() => {
|
|
1319
|
-
prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
1320
|
-
set$(ctx, "totalSize", prevTotalSize - prevStylePaddingTop);
|
|
1321
|
-
}, 16);
|
|
1322
|
-
}
|
|
1323
|
-
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
1324
|
-
}
|
|
1325
|
-
if (alignItemsPaddingTop !== void 0) {
|
|
1326
|
-
set$(ctx, "alignItemsPaddingTop", alignItemsPaddingTop);
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
// src/utils/updateAlignItemsPaddingTop.ts
|
|
1331
|
-
function updateAlignItemsPaddingTop(ctx) {
|
|
1332
|
-
const state = ctx.state;
|
|
1333
|
-
const {
|
|
1334
|
-
scrollLength,
|
|
1335
|
-
props: { alignItemsAtEnd, data }
|
|
1336
|
-
} = state;
|
|
1337
|
-
if (alignItemsAtEnd) {
|
|
1338
|
-
let alignItemsPaddingTop = 0;
|
|
1339
|
-
if ((data == null ? void 0 : data.length) > 0) {
|
|
1340
|
-
const contentSize = getContentSize(ctx);
|
|
1341
|
-
alignItemsPaddingTop = Math.max(0, Math.floor(scrollLength - contentSize));
|
|
1342
|
-
}
|
|
1343
|
-
setPaddingTop(ctx, { alignItemsPaddingTop });
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
1288
|
// src/core/addTotalSize.ts
|
|
1348
1289
|
function addTotalSize(ctx, key, add) {
|
|
1349
1290
|
const state = ctx.state;
|
|
1350
|
-
const { alignItemsAtEnd } = state.props;
|
|
1351
1291
|
const prevTotalSize = state.totalSize;
|
|
1352
1292
|
let totalSize = state.totalSize;
|
|
1353
1293
|
if (key === null) {
|
|
@@ -1364,9 +1304,6 @@ function addTotalSize(ctx, key, add) {
|
|
|
1364
1304
|
state.pendingTotalSize = void 0;
|
|
1365
1305
|
state.totalSize = totalSize;
|
|
1366
1306
|
set$(ctx, "totalSize", totalSize);
|
|
1367
|
-
if (alignItemsAtEnd) {
|
|
1368
|
-
updateAlignItemsPaddingTop(ctx);
|
|
1369
|
-
}
|
|
1370
1307
|
}
|
|
1371
1308
|
}
|
|
1372
1309
|
}
|
|
@@ -3045,8 +2982,8 @@ function doMaintainScrollAtEnd(ctx, animated) {
|
|
|
3045
2982
|
props: { maintainScrollAtEnd }
|
|
3046
2983
|
} = state;
|
|
3047
2984
|
if (isAtEnd && maintainScrollAtEnd && didContainersLayout) {
|
|
3048
|
-
const
|
|
3049
|
-
if (
|
|
2985
|
+
const contentSize = getContentSize(ctx);
|
|
2986
|
+
if (contentSize < state.scrollLength) {
|
|
3050
2987
|
state.scroll = 0;
|
|
3051
2988
|
}
|
|
3052
2989
|
requestAnimationFrame(() => {
|
|
@@ -3224,7 +3161,6 @@ function handleLayout(ctx, layout, setCanRender) {
|
|
|
3224
3161
|
if (maintainScrollAtEnd === true || maintainScrollAtEnd.onLayout) {
|
|
3225
3162
|
doMaintainScrollAtEnd(ctx, false);
|
|
3226
3163
|
}
|
|
3227
|
-
updateAlignItemsPaddingTop(ctx);
|
|
3228
3164
|
checkAtBottom(ctx);
|
|
3229
3165
|
checkAtTop(state);
|
|
3230
3166
|
if (state) {
|
|
@@ -3563,7 +3499,6 @@ function createImperativeHandle(ctx) {
|
|
|
3563
3499
|
}),
|
|
3564
3500
|
reportContentInset: (inset) => {
|
|
3565
3501
|
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3566
|
-
updateAlignItemsPaddingTop(ctx);
|
|
3567
3502
|
updateScroll(ctx, state.scroll, true);
|
|
3568
3503
|
},
|
|
3569
3504
|
scrollIndexIntoView,
|
|
@@ -3703,6 +3638,23 @@ function normalizeMaintainVisibleContentPosition(value) {
|
|
|
3703
3638
|
}
|
|
3704
3639
|
return { data: false, size: true };
|
|
3705
3640
|
}
|
|
3641
|
+
|
|
3642
|
+
// src/utils/setPaddingTop.ts
|
|
3643
|
+
function setPaddingTop(ctx, { stylePaddingTop }) {
|
|
3644
|
+
const state = ctx.state;
|
|
3645
|
+
if (stylePaddingTop !== void 0) {
|
|
3646
|
+
const prevStylePaddingTop = peek$(ctx, "stylePaddingTop") || 0;
|
|
3647
|
+
if (stylePaddingTop < prevStylePaddingTop) {
|
|
3648
|
+
let prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
3649
|
+
set$(ctx, "totalSize", prevTotalSize + prevStylePaddingTop);
|
|
3650
|
+
state.timeoutSetPaddingTop = setTimeout(() => {
|
|
3651
|
+
prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
3652
|
+
set$(ctx, "totalSize", prevTotalSize - prevStylePaddingTop);
|
|
3653
|
+
}, 16);
|
|
3654
|
+
}
|
|
3655
|
+
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3706
3658
|
function useThrottleDebounce(mode) {
|
|
3707
3659
|
const timeoutRef = React3.useRef(null);
|
|
3708
3660
|
const lastCallTimeRef = React3.useRef(0);
|
|
@@ -3834,7 +3786,17 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3834
3786
|
} = props;
|
|
3835
3787
|
const animatedPropsInternal = props.animatedPropsInternal;
|
|
3836
3788
|
const { childrenMode } = rest;
|
|
3837
|
-
const
|
|
3789
|
+
const contentContainerStyleBase = StyleSheet.flatten(contentContainerStyleProp);
|
|
3790
|
+
const shouldFlexGrow = alignItemsAtEnd && (horizontal ? (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minWidth) == null : (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minHeight) == null);
|
|
3791
|
+
const contentContainerStyle = {
|
|
3792
|
+
...contentContainerStyleBase,
|
|
3793
|
+
...alignItemsAtEnd ? {
|
|
3794
|
+
display: "flex",
|
|
3795
|
+
flexDirection: horizontal ? "row" : "column",
|
|
3796
|
+
...shouldFlexGrow ? { flexGrow: 1 } : {},
|
|
3797
|
+
justifyContent: "flex-end"
|
|
3798
|
+
} : {}
|
|
3799
|
+
};
|
|
3838
3800
|
const style = { ...StyleSheet.flatten(styleProp) };
|
|
3839
3801
|
const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
|
|
3840
3802
|
const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
|
|
@@ -4139,21 +4101,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4139
4101
|
let lastMetrics;
|
|
4140
4102
|
const emitMetrics = () => {
|
|
4141
4103
|
const metrics = {
|
|
4142
|
-
alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
|
|
4143
4104
|
footerSize: peek$(ctx, "footerSize") || 0,
|
|
4144
4105
|
headerSize: peek$(ctx, "headerSize") || 0
|
|
4145
4106
|
};
|
|
4146
|
-
if (!lastMetrics || metrics.
|
|
4107
|
+
if (!lastMetrics || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
|
|
4147
4108
|
lastMetrics = metrics;
|
|
4148
4109
|
onMetricsChange(metrics);
|
|
4149
4110
|
}
|
|
4150
4111
|
};
|
|
4151
4112
|
emitMetrics();
|
|
4152
|
-
const unsubscribe = [
|
|
4153
|
-
listen$(ctx, "alignItemsPaddingTop", emitMetrics),
|
|
4154
|
-
listen$(ctx, "headerSize", emitMetrics),
|
|
4155
|
-
listen$(ctx, "footerSize", emitMetrics)
|
|
4156
|
-
];
|
|
4113
|
+
const unsubscribe = [listen$(ctx, "headerSize", emitMetrics), listen$(ctx, "footerSize", emitMetrics)];
|
|
4157
4114
|
return () => {
|
|
4158
4115
|
for (const unsub of unsubscribe) {
|
|
4159
4116
|
unsub();
|
package/index.mjs
CHANGED
|
@@ -63,7 +63,6 @@ function StateProvider({ children }) {
|
|
|
63
63
|
positionListeners: /* @__PURE__ */ new Map(),
|
|
64
64
|
state: void 0,
|
|
65
65
|
values: /* @__PURE__ */ new Map([
|
|
66
|
-
["alignItemsPaddingTop", 0],
|
|
67
66
|
["stylePaddingTop", 0],
|
|
68
67
|
["headerSize", 0],
|
|
69
68
|
["numContainers", 0],
|
|
@@ -1083,26 +1082,6 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
|
|
|
1083
1082
|
const { contentInset, scrollEventThrottle, ScrollComponent, ...webProps } = props;
|
|
1084
1083
|
return /* @__PURE__ */ React3.createElement("div", { ref: scrollRef, ...webProps, style: scrollViewStyle }, refreshControl, /* @__PURE__ */ React3.createElement("div", { ref: contentRef, style: contentStyle }, children));
|
|
1085
1084
|
});
|
|
1086
|
-
function Padding() {
|
|
1087
|
-
const [paddingTop] = useArr$(["alignItemsPaddingTop"]);
|
|
1088
|
-
return /* @__PURE__ */ React3.createElement("div", { style: { paddingTop } });
|
|
1089
|
-
}
|
|
1090
|
-
function PaddingDevMode() {
|
|
1091
|
-
const [paddingTop] = useArr$(["alignItemsPaddingTop"]);
|
|
1092
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("div", { style: { paddingTop } }), /* @__PURE__ */ React3.createElement(
|
|
1093
|
-
"div",
|
|
1094
|
-
{
|
|
1095
|
-
style: {
|
|
1096
|
-
backgroundColor: "green",
|
|
1097
|
-
height: paddingTop,
|
|
1098
|
-
left: 0,
|
|
1099
|
-
position: "absolute",
|
|
1100
|
-
right: 0,
|
|
1101
|
-
top: 0
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
));
|
|
1105
|
-
}
|
|
1106
1085
|
function useValueListener$(key, callback) {
|
|
1107
1086
|
const ctx = useStateContext();
|
|
1108
1087
|
useLayoutEffect(() => {
|
|
@@ -1179,7 +1158,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1179
1158
|
initialContentOffset,
|
|
1180
1159
|
recycleItems,
|
|
1181
1160
|
ItemSeparatorComponent,
|
|
1182
|
-
alignItemsAtEnd,
|
|
1161
|
+
alignItemsAtEnd: _alignItemsAtEnd,
|
|
1183
1162
|
waitForInitialLayout,
|
|
1184
1163
|
onScroll: onScroll2,
|
|
1185
1164
|
onLayout,
|
|
@@ -1226,7 +1205,6 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1226
1205
|
style
|
|
1227
1206
|
},
|
|
1228
1207
|
/* @__PURE__ */ React3.createElement(ScrollAdjust, null),
|
|
1229
|
-
ENABLE_DEVMODE ? /* @__PURE__ */ React3.createElement(PaddingDevMode, null) : /* @__PURE__ */ React3.createElement(Padding, null),
|
|
1230
1208
|
ListHeaderComponent && /* @__PURE__ */ React3.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
|
|
1231
1209
|
ListEmptyComponent && getComponent(ListEmptyComponent),
|
|
1232
1210
|
canRender && !ListEmptyComponent && /* @__PURE__ */ React3.createElement(
|
|
@@ -1286,47 +1264,9 @@ function calculateOffsetForIndex(ctx, index) {
|
|
|
1286
1264
|
return position;
|
|
1287
1265
|
}
|
|
1288
1266
|
|
|
1289
|
-
// src/utils/setPaddingTop.ts
|
|
1290
|
-
function setPaddingTop(ctx, { stylePaddingTop, alignItemsPaddingTop }) {
|
|
1291
|
-
const state = ctx.state;
|
|
1292
|
-
if (stylePaddingTop !== void 0) {
|
|
1293
|
-
const prevStylePaddingTop = peek$(ctx, "stylePaddingTop") || 0;
|
|
1294
|
-
if (stylePaddingTop < prevStylePaddingTop) {
|
|
1295
|
-
let prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
1296
|
-
set$(ctx, "totalSize", prevTotalSize + prevStylePaddingTop);
|
|
1297
|
-
state.timeoutSetPaddingTop = setTimeout(() => {
|
|
1298
|
-
prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
1299
|
-
set$(ctx, "totalSize", prevTotalSize - prevStylePaddingTop);
|
|
1300
|
-
}, 16);
|
|
1301
|
-
}
|
|
1302
|
-
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
1303
|
-
}
|
|
1304
|
-
if (alignItemsPaddingTop !== void 0) {
|
|
1305
|
-
set$(ctx, "alignItemsPaddingTop", alignItemsPaddingTop);
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
// src/utils/updateAlignItemsPaddingTop.ts
|
|
1310
|
-
function updateAlignItemsPaddingTop(ctx) {
|
|
1311
|
-
const state = ctx.state;
|
|
1312
|
-
const {
|
|
1313
|
-
scrollLength,
|
|
1314
|
-
props: { alignItemsAtEnd, data }
|
|
1315
|
-
} = state;
|
|
1316
|
-
if (alignItemsAtEnd) {
|
|
1317
|
-
let alignItemsPaddingTop = 0;
|
|
1318
|
-
if ((data == null ? void 0 : data.length) > 0) {
|
|
1319
|
-
const contentSize = getContentSize(ctx);
|
|
1320
|
-
alignItemsPaddingTop = Math.max(0, Math.floor(scrollLength - contentSize));
|
|
1321
|
-
}
|
|
1322
|
-
setPaddingTop(ctx, { alignItemsPaddingTop });
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
1267
|
// src/core/addTotalSize.ts
|
|
1327
1268
|
function addTotalSize(ctx, key, add) {
|
|
1328
1269
|
const state = ctx.state;
|
|
1329
|
-
const { alignItemsAtEnd } = state.props;
|
|
1330
1270
|
const prevTotalSize = state.totalSize;
|
|
1331
1271
|
let totalSize = state.totalSize;
|
|
1332
1272
|
if (key === null) {
|
|
@@ -1343,9 +1283,6 @@ function addTotalSize(ctx, key, add) {
|
|
|
1343
1283
|
state.pendingTotalSize = void 0;
|
|
1344
1284
|
state.totalSize = totalSize;
|
|
1345
1285
|
set$(ctx, "totalSize", totalSize);
|
|
1346
|
-
if (alignItemsAtEnd) {
|
|
1347
|
-
updateAlignItemsPaddingTop(ctx);
|
|
1348
|
-
}
|
|
1349
1286
|
}
|
|
1350
1287
|
}
|
|
1351
1288
|
}
|
|
@@ -3024,8 +2961,8 @@ function doMaintainScrollAtEnd(ctx, animated) {
|
|
|
3024
2961
|
props: { maintainScrollAtEnd }
|
|
3025
2962
|
} = state;
|
|
3026
2963
|
if (isAtEnd && maintainScrollAtEnd && didContainersLayout) {
|
|
3027
|
-
const
|
|
3028
|
-
if (
|
|
2964
|
+
const contentSize = getContentSize(ctx);
|
|
2965
|
+
if (contentSize < state.scrollLength) {
|
|
3029
2966
|
state.scroll = 0;
|
|
3030
2967
|
}
|
|
3031
2968
|
requestAnimationFrame(() => {
|
|
@@ -3203,7 +3140,6 @@ function handleLayout(ctx, layout, setCanRender) {
|
|
|
3203
3140
|
if (maintainScrollAtEnd === true || maintainScrollAtEnd.onLayout) {
|
|
3204
3141
|
doMaintainScrollAtEnd(ctx, false);
|
|
3205
3142
|
}
|
|
3206
|
-
updateAlignItemsPaddingTop(ctx);
|
|
3207
3143
|
checkAtBottom(ctx);
|
|
3208
3144
|
checkAtTop(state);
|
|
3209
3145
|
if (state) {
|
|
@@ -3542,7 +3478,6 @@ function createImperativeHandle(ctx) {
|
|
|
3542
3478
|
}),
|
|
3543
3479
|
reportContentInset: (inset) => {
|
|
3544
3480
|
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3545
|
-
updateAlignItemsPaddingTop(ctx);
|
|
3546
3481
|
updateScroll(ctx, state.scroll, true);
|
|
3547
3482
|
},
|
|
3548
3483
|
scrollIndexIntoView,
|
|
@@ -3682,6 +3617,23 @@ function normalizeMaintainVisibleContentPosition(value) {
|
|
|
3682
3617
|
}
|
|
3683
3618
|
return { data: false, size: true };
|
|
3684
3619
|
}
|
|
3620
|
+
|
|
3621
|
+
// src/utils/setPaddingTop.ts
|
|
3622
|
+
function setPaddingTop(ctx, { stylePaddingTop }) {
|
|
3623
|
+
const state = ctx.state;
|
|
3624
|
+
if (stylePaddingTop !== void 0) {
|
|
3625
|
+
const prevStylePaddingTop = peek$(ctx, "stylePaddingTop") || 0;
|
|
3626
|
+
if (stylePaddingTop < prevStylePaddingTop) {
|
|
3627
|
+
let prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
3628
|
+
set$(ctx, "totalSize", prevTotalSize + prevStylePaddingTop);
|
|
3629
|
+
state.timeoutSetPaddingTop = setTimeout(() => {
|
|
3630
|
+
prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
3631
|
+
set$(ctx, "totalSize", prevTotalSize - prevStylePaddingTop);
|
|
3632
|
+
}, 16);
|
|
3633
|
+
}
|
|
3634
|
+
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3685
3637
|
function useThrottleDebounce(mode) {
|
|
3686
3638
|
const timeoutRef = useRef(null);
|
|
3687
3639
|
const lastCallTimeRef = useRef(0);
|
|
@@ -3813,7 +3765,17 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3813
3765
|
} = props;
|
|
3814
3766
|
const animatedPropsInternal = props.animatedPropsInternal;
|
|
3815
3767
|
const { childrenMode } = rest;
|
|
3816
|
-
const
|
|
3768
|
+
const contentContainerStyleBase = StyleSheet.flatten(contentContainerStyleProp);
|
|
3769
|
+
const shouldFlexGrow = alignItemsAtEnd && (horizontal ? (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minWidth) == null : (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minHeight) == null);
|
|
3770
|
+
const contentContainerStyle = {
|
|
3771
|
+
...contentContainerStyleBase,
|
|
3772
|
+
...alignItemsAtEnd ? {
|
|
3773
|
+
display: "flex",
|
|
3774
|
+
flexDirection: horizontal ? "row" : "column",
|
|
3775
|
+
...shouldFlexGrow ? { flexGrow: 1 } : {},
|
|
3776
|
+
justifyContent: "flex-end"
|
|
3777
|
+
} : {}
|
|
3778
|
+
};
|
|
3817
3779
|
const style = { ...StyleSheet.flatten(styleProp) };
|
|
3818
3780
|
const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
|
|
3819
3781
|
const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
|
|
@@ -4118,21 +4080,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4118
4080
|
let lastMetrics;
|
|
4119
4081
|
const emitMetrics = () => {
|
|
4120
4082
|
const metrics = {
|
|
4121
|
-
alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
|
|
4122
4083
|
footerSize: peek$(ctx, "footerSize") || 0,
|
|
4123
4084
|
headerSize: peek$(ctx, "headerSize") || 0
|
|
4124
4085
|
};
|
|
4125
|
-
if (!lastMetrics || metrics.
|
|
4086
|
+
if (!lastMetrics || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
|
|
4126
4087
|
lastMetrics = metrics;
|
|
4127
4088
|
onMetricsChange(metrics);
|
|
4128
4089
|
}
|
|
4129
4090
|
};
|
|
4130
4091
|
emitMetrics();
|
|
4131
|
-
const unsubscribe = [
|
|
4132
|
-
listen$(ctx, "alignItemsPaddingTop", emitMetrics),
|
|
4133
|
-
listen$(ctx, "headerSize", emitMetrics),
|
|
4134
|
-
listen$(ctx, "footerSize", emitMetrics)
|
|
4135
|
-
];
|
|
4092
|
+
const unsubscribe = [listen$(ctx, "headerSize", emitMetrics), listen$(ctx, "footerSize", emitMetrics)];
|
|
4136
4093
|
return () => {
|
|
4137
4094
|
for (const unsub of unsubscribe) {
|
|
4138
4095
|
unsub();
|
package/index.native.d.mts
CHANGED
|
@@ -5,11 +5,10 @@ import Reanimated from 'react-native-reanimated';
|
|
|
5
5
|
|
|
6
6
|
type AnimatedValue = number;
|
|
7
7
|
|
|
8
|
-
type ListenerType = "activeStickyIndex" | "
|
|
8
|
+
type ListenerType = "activeStickyIndex" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | `containerColumn${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}` | `containerStickyOffset${number}`;
|
|
9
9
|
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
10
10
|
type ListenerTypeValueMap = {
|
|
11
11
|
activeStickyIndex: number;
|
|
12
|
-
alignItemsPaddingTop: number;
|
|
13
12
|
animatedScrollY: any;
|
|
14
13
|
debugComputedScroll: number;
|
|
15
14
|
debugRawScroll: number;
|
|
@@ -401,7 +400,6 @@ interface ColumnWrapperStyle {
|
|
|
401
400
|
columnGap?: number;
|
|
402
401
|
}
|
|
403
402
|
interface LegendListMetrics {
|
|
404
|
-
alignItemsAtEndPadding: number;
|
|
405
403
|
headerSize: number;
|
|
406
404
|
footerSize: number;
|
|
407
405
|
}
|
package/index.native.d.ts
CHANGED
|
@@ -5,11 +5,10 @@ import Reanimated from 'react-native-reanimated';
|
|
|
5
5
|
|
|
6
6
|
type AnimatedValue = number;
|
|
7
7
|
|
|
8
|
-
type ListenerType = "activeStickyIndex" | "
|
|
8
|
+
type ListenerType = "activeStickyIndex" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | `containerColumn${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}` | `containerStickyOffset${number}`;
|
|
9
9
|
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
10
10
|
type ListenerTypeValueMap = {
|
|
11
11
|
activeStickyIndex: number;
|
|
12
|
-
alignItemsPaddingTop: number;
|
|
13
12
|
animatedScrollY: any;
|
|
14
13
|
debugComputedScroll: number;
|
|
15
14
|
debugRawScroll: number;
|
|
@@ -401,7 +400,6 @@ interface ColumnWrapperStyle {
|
|
|
401
400
|
columnGap?: number;
|
|
402
401
|
}
|
|
403
402
|
interface LegendListMetrics {
|
|
404
|
-
alignItemsAtEndPadding: number;
|
|
405
403
|
headerSize: number;
|
|
406
404
|
footerSize: number;
|
|
407
405
|
}
|