@legendapp/list 3.0.0-beta.25 → 3.0.0-beta.27
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 +34 -75
- package/index.mjs +34 -75
- package/index.native.d.mts +1 -3
- package/index.native.d.ts +1 -3
- package/index.native.js +34 -75
- package/index.native.mjs +34 -75
- package/keyboard.js +28 -10
- package/keyboard.mjs +28 -10
- package/keyboard.native.js +28 -10
- package/keyboard.native.mjs +28 -10
- 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) {
|
|
@@ -3561,6 +3497,10 @@ function createImperativeHandle(ctx) {
|
|
|
3561
3497
|
start: state.startNoBuffer,
|
|
3562
3498
|
startBuffered: state.startBuffered
|
|
3563
3499
|
}),
|
|
3500
|
+
reportContentInset: (inset) => {
|
|
3501
|
+
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3502
|
+
updateScroll(ctx, state.scroll, true);
|
|
3503
|
+
},
|
|
3564
3504
|
scrollIndexIntoView,
|
|
3565
3505
|
scrollItemIntoView: ({ item, ...props }) => {
|
|
3566
3506
|
const data = state.props.data;
|
|
@@ -3593,10 +3533,6 @@ function createImperativeHandle(ctx) {
|
|
|
3593
3533
|
}
|
|
3594
3534
|
},
|
|
3595
3535
|
scrollToOffset: (params) => scrollTo(ctx, params),
|
|
3596
|
-
reportContentInset: (inset) => {
|
|
3597
|
-
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3598
|
-
updateScroll(ctx, state.scroll, true);
|
|
3599
|
-
},
|
|
3600
3536
|
setScrollProcessingEnabled: (enabled) => {
|
|
3601
3537
|
state.scrollProcessingEnabled = enabled;
|
|
3602
3538
|
},
|
|
@@ -3702,6 +3638,23 @@ function normalizeMaintainVisibleContentPosition(value) {
|
|
|
3702
3638
|
}
|
|
3703
3639
|
return { data: false, size: true };
|
|
3704
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
|
+
}
|
|
3705
3658
|
function useThrottleDebounce(mode) {
|
|
3706
3659
|
const timeoutRef = React3.useRef(null);
|
|
3707
3660
|
const lastCallTimeRef = React3.useRef(0);
|
|
@@ -3833,7 +3786,15 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3833
3786
|
} = props;
|
|
3834
3787
|
const animatedPropsInternal = props.animatedPropsInternal;
|
|
3835
3788
|
const { childrenMode } = rest;
|
|
3836
|
-
const contentContainerStyle = {
|
|
3789
|
+
const contentContainerStyle = {
|
|
3790
|
+
...StyleSheet.flatten(contentContainerStyleProp),
|
|
3791
|
+
...alignItemsAtEnd ? {
|
|
3792
|
+
display: "flex",
|
|
3793
|
+
flexDirection: horizontal ? "row" : "column",
|
|
3794
|
+
flexGrow: 1,
|
|
3795
|
+
justifyContent: "flex-end"
|
|
3796
|
+
} : {}
|
|
3797
|
+
};
|
|
3837
3798
|
const style = { ...StyleSheet.flatten(styleProp) };
|
|
3838
3799
|
const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
|
|
3839
3800
|
const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
|
|
@@ -4138,18 +4099,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4138
4099
|
let lastMetrics;
|
|
4139
4100
|
const emitMetrics = () => {
|
|
4140
4101
|
const metrics = {
|
|
4141
|
-
alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
|
|
4142
4102
|
footerSize: peek$(ctx, "footerSize") || 0,
|
|
4143
4103
|
headerSize: peek$(ctx, "headerSize") || 0
|
|
4144
4104
|
};
|
|
4145
|
-
if (!lastMetrics || metrics.
|
|
4105
|
+
if (!lastMetrics || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
|
|
4146
4106
|
lastMetrics = metrics;
|
|
4147
4107
|
onMetricsChange(metrics);
|
|
4148
4108
|
}
|
|
4149
4109
|
};
|
|
4150
4110
|
emitMetrics();
|
|
4151
4111
|
const unsubscribe = [
|
|
4152
|
-
listen$(ctx, "alignItemsPaddingTop", emitMetrics),
|
|
4153
4112
|
listen$(ctx, "headerSize", emitMetrics),
|
|
4154
4113
|
listen$(ctx, "footerSize", emitMetrics)
|
|
4155
4114
|
];
|
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) {
|
|
@@ -3540,6 +3476,10 @@ function createImperativeHandle(ctx) {
|
|
|
3540
3476
|
start: state.startNoBuffer,
|
|
3541
3477
|
startBuffered: state.startBuffered
|
|
3542
3478
|
}),
|
|
3479
|
+
reportContentInset: (inset) => {
|
|
3480
|
+
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3481
|
+
updateScroll(ctx, state.scroll, true);
|
|
3482
|
+
},
|
|
3543
3483
|
scrollIndexIntoView,
|
|
3544
3484
|
scrollItemIntoView: ({ item, ...props }) => {
|
|
3545
3485
|
const data = state.props.data;
|
|
@@ -3572,10 +3512,6 @@ function createImperativeHandle(ctx) {
|
|
|
3572
3512
|
}
|
|
3573
3513
|
},
|
|
3574
3514
|
scrollToOffset: (params) => scrollTo(ctx, params),
|
|
3575
|
-
reportContentInset: (inset) => {
|
|
3576
|
-
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3577
|
-
updateScroll(ctx, state.scroll, true);
|
|
3578
|
-
},
|
|
3579
3515
|
setScrollProcessingEnabled: (enabled) => {
|
|
3580
3516
|
state.scrollProcessingEnabled = enabled;
|
|
3581
3517
|
},
|
|
@@ -3681,6 +3617,23 @@ function normalizeMaintainVisibleContentPosition(value) {
|
|
|
3681
3617
|
}
|
|
3682
3618
|
return { data: false, size: true };
|
|
3683
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
|
+
}
|
|
3684
3637
|
function useThrottleDebounce(mode) {
|
|
3685
3638
|
const timeoutRef = useRef(null);
|
|
3686
3639
|
const lastCallTimeRef = useRef(0);
|
|
@@ -3812,7 +3765,15 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3812
3765
|
} = props;
|
|
3813
3766
|
const animatedPropsInternal = props.animatedPropsInternal;
|
|
3814
3767
|
const { childrenMode } = rest;
|
|
3815
|
-
const contentContainerStyle = {
|
|
3768
|
+
const contentContainerStyle = {
|
|
3769
|
+
...StyleSheet.flatten(contentContainerStyleProp),
|
|
3770
|
+
...alignItemsAtEnd ? {
|
|
3771
|
+
display: "flex",
|
|
3772
|
+
flexDirection: horizontal ? "row" : "column",
|
|
3773
|
+
flexGrow: 1,
|
|
3774
|
+
justifyContent: "flex-end"
|
|
3775
|
+
} : {}
|
|
3776
|
+
};
|
|
3816
3777
|
const style = { ...StyleSheet.flatten(styleProp) };
|
|
3817
3778
|
const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
|
|
3818
3779
|
const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
|
|
@@ -4117,18 +4078,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
4117
4078
|
let lastMetrics;
|
|
4118
4079
|
const emitMetrics = () => {
|
|
4119
4080
|
const metrics = {
|
|
4120
|
-
alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
|
|
4121
4081
|
footerSize: peek$(ctx, "footerSize") || 0,
|
|
4122
4082
|
headerSize: peek$(ctx, "headerSize") || 0
|
|
4123
4083
|
};
|
|
4124
|
-
if (!lastMetrics || metrics.
|
|
4084
|
+
if (!lastMetrics || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
|
|
4125
4085
|
lastMetrics = metrics;
|
|
4126
4086
|
onMetricsChange(metrics);
|
|
4127
4087
|
}
|
|
4128
4088
|
};
|
|
4129
4089
|
emitMetrics();
|
|
4130
4090
|
const unsubscribe = [
|
|
4131
|
-
listen$(ctx, "alignItemsPaddingTop", emitMetrics),
|
|
4132
4091
|
listen$(ctx, "headerSize", emitMetrics),
|
|
4133
4092
|
listen$(ctx, "footerSize", emitMetrics)
|
|
4134
4093
|
];
|
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
|
}
|
package/index.native.js
CHANGED
|
@@ -78,7 +78,6 @@ function StateProvider({ children }) {
|
|
|
78
78
|
positionListeners: /* @__PURE__ */ new Map(),
|
|
79
79
|
state: void 0,
|
|
80
80
|
values: /* @__PURE__ */ new Map([
|
|
81
|
-
["alignItemsPaddingTop", 0],
|
|
82
81
|
["stylePaddingTop", 0],
|
|
83
82
|
["headerSize", 0],
|
|
84
83
|
["numContainers", 0],
|
|
@@ -874,26 +873,6 @@ function DevNumbers() {
|
|
|
874
873
|
});
|
|
875
874
|
}
|
|
876
875
|
var ListComponentScrollView = reactNative.Animated.ScrollView;
|
|
877
|
-
function Padding() {
|
|
878
|
-
const animPaddingTop = useValue$("alignItemsPaddingTop", { delay: 0 });
|
|
879
|
-
return /* @__PURE__ */ React2__namespace.createElement(reactNative.Animated.View, { style: { paddingTop: animPaddingTop } });
|
|
880
|
-
}
|
|
881
|
-
function PaddingDevMode() {
|
|
882
|
-
const animPaddingTop = useValue$("alignItemsPaddingTop", { delay: 0 });
|
|
883
|
-
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Animated.View, { style: { paddingTop: animPaddingTop } }), /* @__PURE__ */ React2__namespace.createElement(
|
|
884
|
-
reactNative.Animated.View,
|
|
885
|
-
{
|
|
886
|
-
style: {
|
|
887
|
-
backgroundColor: "green",
|
|
888
|
-
height: animPaddingTop,
|
|
889
|
-
left: 0,
|
|
890
|
-
position: "absolute",
|
|
891
|
-
right: 0,
|
|
892
|
-
top: 0
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
));
|
|
896
|
-
}
|
|
897
876
|
function ScrollAdjust() {
|
|
898
877
|
const bias = 1e7;
|
|
899
878
|
const [scrollAdjust, scrollAdjustUserOffset] = useArr$(["scrollAdjust", "scrollAdjustUserOffset"]);
|
|
@@ -930,7 +909,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
930
909
|
initialContentOffset,
|
|
931
910
|
recycleItems,
|
|
932
911
|
ItemSeparatorComponent,
|
|
933
|
-
alignItemsAtEnd,
|
|
912
|
+
alignItemsAtEnd: _alignItemsAtEnd,
|
|
934
913
|
waitForInitialLayout,
|
|
935
914
|
onScroll: onScroll2,
|
|
936
915
|
onLayout,
|
|
@@ -977,7 +956,6 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
977
956
|
style
|
|
978
957
|
},
|
|
979
958
|
/* @__PURE__ */ React2__namespace.createElement(ScrollAdjust, null),
|
|
980
|
-
ENABLE_DEVMODE ? /* @__PURE__ */ React2__namespace.createElement(PaddingDevMode, null) : /* @__PURE__ */ React2__namespace.createElement(Padding, null),
|
|
981
959
|
ListHeaderComponent && /* @__PURE__ */ React2__namespace.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
|
|
982
960
|
ListEmptyComponent && getComponent(ListEmptyComponent),
|
|
983
961
|
canRender && !ListEmptyComponent && /* @__PURE__ */ React2__namespace.createElement(
|
|
@@ -1037,47 +1015,9 @@ function calculateOffsetForIndex(ctx, index) {
|
|
|
1037
1015
|
return position;
|
|
1038
1016
|
}
|
|
1039
1017
|
|
|
1040
|
-
// src/utils/setPaddingTop.ts
|
|
1041
|
-
function setPaddingTop(ctx, { stylePaddingTop, alignItemsPaddingTop }) {
|
|
1042
|
-
const state = ctx.state;
|
|
1043
|
-
if (stylePaddingTop !== void 0) {
|
|
1044
|
-
const prevStylePaddingTop = peek$(ctx, "stylePaddingTop") || 0;
|
|
1045
|
-
if (stylePaddingTop < prevStylePaddingTop) {
|
|
1046
|
-
let prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
1047
|
-
set$(ctx, "totalSize", prevTotalSize + prevStylePaddingTop);
|
|
1048
|
-
state.timeoutSetPaddingTop = setTimeout(() => {
|
|
1049
|
-
prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
1050
|
-
set$(ctx, "totalSize", prevTotalSize - prevStylePaddingTop);
|
|
1051
|
-
}, 16);
|
|
1052
|
-
}
|
|
1053
|
-
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
1054
|
-
}
|
|
1055
|
-
if (alignItemsPaddingTop !== void 0) {
|
|
1056
|
-
set$(ctx, "alignItemsPaddingTop", alignItemsPaddingTop);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
// src/utils/updateAlignItemsPaddingTop.ts
|
|
1061
|
-
function updateAlignItemsPaddingTop(ctx) {
|
|
1062
|
-
const state = ctx.state;
|
|
1063
|
-
const {
|
|
1064
|
-
scrollLength,
|
|
1065
|
-
props: { alignItemsAtEnd, data }
|
|
1066
|
-
} = state;
|
|
1067
|
-
if (alignItemsAtEnd) {
|
|
1068
|
-
let alignItemsPaddingTop = 0;
|
|
1069
|
-
if ((data == null ? void 0 : data.length) > 0) {
|
|
1070
|
-
const contentSize = getContentSize(ctx);
|
|
1071
|
-
alignItemsPaddingTop = Math.max(0, Math.floor(scrollLength - contentSize));
|
|
1072
|
-
}
|
|
1073
|
-
setPaddingTop(ctx, { alignItemsPaddingTop });
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
1018
|
// src/core/addTotalSize.ts
|
|
1078
1019
|
function addTotalSize(ctx, key, add) {
|
|
1079
1020
|
const state = ctx.state;
|
|
1080
|
-
const { alignItemsAtEnd } = state.props;
|
|
1081
1021
|
const prevTotalSize = state.totalSize;
|
|
1082
1022
|
let totalSize = state.totalSize;
|
|
1083
1023
|
if (key === null) {
|
|
@@ -1096,9 +1036,6 @@ function addTotalSize(ctx, key, add) {
|
|
|
1096
1036
|
state.pendingTotalSize = void 0;
|
|
1097
1037
|
state.totalSize = totalSize;
|
|
1098
1038
|
set$(ctx, "totalSize", totalSize);
|
|
1099
|
-
if (alignItemsAtEnd) {
|
|
1100
|
-
updateAlignItemsPaddingTop(ctx);
|
|
1101
|
-
}
|
|
1102
1039
|
}
|
|
1103
1040
|
}
|
|
1104
1041
|
}
|
|
@@ -2828,8 +2765,8 @@ function doMaintainScrollAtEnd(ctx, animated) {
|
|
|
2828
2765
|
props: { maintainScrollAtEnd }
|
|
2829
2766
|
} = state;
|
|
2830
2767
|
if (isAtEnd && maintainScrollAtEnd && didContainersLayout) {
|
|
2831
|
-
const
|
|
2832
|
-
if (
|
|
2768
|
+
const contentSize = getContentSize(ctx);
|
|
2769
|
+
if (contentSize < state.scrollLength) {
|
|
2833
2770
|
state.scroll = 0;
|
|
2834
2771
|
}
|
|
2835
2772
|
requestAnimationFrame(() => {
|
|
@@ -3007,7 +2944,6 @@ function handleLayout(ctx, layout, setCanRender) {
|
|
|
3007
2944
|
if (maintainScrollAtEnd === true || maintainScrollAtEnd.onLayout) {
|
|
3008
2945
|
doMaintainScrollAtEnd(ctx, false);
|
|
3009
2946
|
}
|
|
3010
|
-
updateAlignItemsPaddingTop(ctx);
|
|
3011
2947
|
checkAtBottom(ctx);
|
|
3012
2948
|
checkAtTop(state);
|
|
3013
2949
|
if (state) {
|
|
@@ -3363,6 +3299,10 @@ function createImperativeHandle(ctx) {
|
|
|
3363
3299
|
start: state.startNoBuffer,
|
|
3364
3300
|
startBuffered: state.startBuffered
|
|
3365
3301
|
}),
|
|
3302
|
+
reportContentInset: (inset) => {
|
|
3303
|
+
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3304
|
+
updateScroll(ctx, state.scroll, true);
|
|
3305
|
+
},
|
|
3366
3306
|
scrollIndexIntoView,
|
|
3367
3307
|
scrollItemIntoView: ({ item, ...props }) => {
|
|
3368
3308
|
const data = state.props.data;
|
|
@@ -3395,10 +3335,6 @@ function createImperativeHandle(ctx) {
|
|
|
3395
3335
|
}
|
|
3396
3336
|
},
|
|
3397
3337
|
scrollToOffset: (params) => scrollTo(ctx, params),
|
|
3398
|
-
reportContentInset: (inset) => {
|
|
3399
|
-
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3400
|
-
updateScroll(ctx, state.scroll, true);
|
|
3401
|
-
},
|
|
3402
3338
|
setScrollProcessingEnabled: (enabled) => {
|
|
3403
3339
|
state.scrollProcessingEnabled = enabled;
|
|
3404
3340
|
},
|
|
@@ -3504,6 +3440,23 @@ function normalizeMaintainVisibleContentPosition(value) {
|
|
|
3504
3440
|
}
|
|
3505
3441
|
return { data: false, size: true };
|
|
3506
3442
|
}
|
|
3443
|
+
|
|
3444
|
+
// src/utils/setPaddingTop.ts
|
|
3445
|
+
function setPaddingTop(ctx, { stylePaddingTop }) {
|
|
3446
|
+
const state = ctx.state;
|
|
3447
|
+
if (stylePaddingTop !== void 0) {
|
|
3448
|
+
const prevStylePaddingTop = peek$(ctx, "stylePaddingTop") || 0;
|
|
3449
|
+
if (stylePaddingTop < prevStylePaddingTop) {
|
|
3450
|
+
let prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
3451
|
+
set$(ctx, "totalSize", prevTotalSize + prevStylePaddingTop);
|
|
3452
|
+
state.timeoutSetPaddingTop = setTimeout(() => {
|
|
3453
|
+
prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
3454
|
+
set$(ctx, "totalSize", prevTotalSize - prevStylePaddingTop);
|
|
3455
|
+
}, 16);
|
|
3456
|
+
}
|
|
3457
|
+
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3507
3460
|
function useThrottleDebounce(mode) {
|
|
3508
3461
|
const timeoutRef = React2.useRef(null);
|
|
3509
3462
|
const lastCallTimeRef = React2.useRef(0);
|
|
@@ -3635,7 +3588,15 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3635
3588
|
} = props;
|
|
3636
3589
|
const animatedPropsInternal = props.animatedPropsInternal;
|
|
3637
3590
|
const { childrenMode } = rest;
|
|
3638
|
-
const contentContainerStyle = {
|
|
3591
|
+
const contentContainerStyle = {
|
|
3592
|
+
...StyleSheet.flatten(contentContainerStyleProp),
|
|
3593
|
+
...alignItemsAtEnd ? {
|
|
3594
|
+
display: "flex",
|
|
3595
|
+
flexDirection: horizontal ? "row" : "column",
|
|
3596
|
+
flexGrow: 1,
|
|
3597
|
+
justifyContent: "flex-end"
|
|
3598
|
+
} : {}
|
|
3599
|
+
};
|
|
3639
3600
|
const style = { ...StyleSheet.flatten(styleProp) };
|
|
3640
3601
|
const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
|
|
3641
3602
|
const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
|
|
@@ -3952,18 +3913,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3952
3913
|
let lastMetrics;
|
|
3953
3914
|
const emitMetrics = () => {
|
|
3954
3915
|
const metrics = {
|
|
3955
|
-
alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
|
|
3956
3916
|
footerSize: peek$(ctx, "footerSize") || 0,
|
|
3957
3917
|
headerSize: peek$(ctx, "headerSize") || 0
|
|
3958
3918
|
};
|
|
3959
|
-
if (!lastMetrics || metrics.
|
|
3919
|
+
if (!lastMetrics || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
|
|
3960
3920
|
lastMetrics = metrics;
|
|
3961
3921
|
onMetricsChange(metrics);
|
|
3962
3922
|
}
|
|
3963
3923
|
};
|
|
3964
3924
|
emitMetrics();
|
|
3965
3925
|
const unsubscribe = [
|
|
3966
|
-
listen$(ctx, "alignItemsPaddingTop", emitMetrics),
|
|
3967
3926
|
listen$(ctx, "headerSize", emitMetrics),
|
|
3968
3927
|
listen$(ctx, "footerSize", emitMetrics)
|
|
3969
3928
|
];
|
package/index.native.mjs
CHANGED
|
@@ -57,7 +57,6 @@ function StateProvider({ children }) {
|
|
|
57
57
|
positionListeners: /* @__PURE__ */ new Map(),
|
|
58
58
|
state: void 0,
|
|
59
59
|
values: /* @__PURE__ */ new Map([
|
|
60
|
-
["alignItemsPaddingTop", 0],
|
|
61
60
|
["stylePaddingTop", 0],
|
|
62
61
|
["headerSize", 0],
|
|
63
62
|
["numContainers", 0],
|
|
@@ -853,26 +852,6 @@ function DevNumbers() {
|
|
|
853
852
|
});
|
|
854
853
|
}
|
|
855
854
|
var ListComponentScrollView = Animated.ScrollView;
|
|
856
|
-
function Padding() {
|
|
857
|
-
const animPaddingTop = useValue$("alignItemsPaddingTop", { delay: 0 });
|
|
858
|
-
return /* @__PURE__ */ React2.createElement(Animated.View, { style: { paddingTop: animPaddingTop } });
|
|
859
|
-
}
|
|
860
|
-
function PaddingDevMode() {
|
|
861
|
-
const animPaddingTop = useValue$("alignItemsPaddingTop", { delay: 0 });
|
|
862
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Animated.View, { style: { paddingTop: animPaddingTop } }), /* @__PURE__ */ React2.createElement(
|
|
863
|
-
Animated.View,
|
|
864
|
-
{
|
|
865
|
-
style: {
|
|
866
|
-
backgroundColor: "green",
|
|
867
|
-
height: animPaddingTop,
|
|
868
|
-
left: 0,
|
|
869
|
-
position: "absolute",
|
|
870
|
-
right: 0,
|
|
871
|
-
top: 0
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
));
|
|
875
|
-
}
|
|
876
855
|
function ScrollAdjust() {
|
|
877
856
|
const bias = 1e7;
|
|
878
857
|
const [scrollAdjust, scrollAdjustUserOffset] = useArr$(["scrollAdjust", "scrollAdjustUserOffset"]);
|
|
@@ -909,7 +888,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
909
888
|
initialContentOffset,
|
|
910
889
|
recycleItems,
|
|
911
890
|
ItemSeparatorComponent,
|
|
912
|
-
alignItemsAtEnd,
|
|
891
|
+
alignItemsAtEnd: _alignItemsAtEnd,
|
|
913
892
|
waitForInitialLayout,
|
|
914
893
|
onScroll: onScroll2,
|
|
915
894
|
onLayout,
|
|
@@ -956,7 +935,6 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
956
935
|
style
|
|
957
936
|
},
|
|
958
937
|
/* @__PURE__ */ React2.createElement(ScrollAdjust, null),
|
|
959
|
-
ENABLE_DEVMODE ? /* @__PURE__ */ React2.createElement(PaddingDevMode, null) : /* @__PURE__ */ React2.createElement(Padding, null),
|
|
960
938
|
ListHeaderComponent && /* @__PURE__ */ React2.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
|
|
961
939
|
ListEmptyComponent && getComponent(ListEmptyComponent),
|
|
962
940
|
canRender && !ListEmptyComponent && /* @__PURE__ */ React2.createElement(
|
|
@@ -1016,47 +994,9 @@ function calculateOffsetForIndex(ctx, index) {
|
|
|
1016
994
|
return position;
|
|
1017
995
|
}
|
|
1018
996
|
|
|
1019
|
-
// src/utils/setPaddingTop.ts
|
|
1020
|
-
function setPaddingTop(ctx, { stylePaddingTop, alignItemsPaddingTop }) {
|
|
1021
|
-
const state = ctx.state;
|
|
1022
|
-
if (stylePaddingTop !== void 0) {
|
|
1023
|
-
const prevStylePaddingTop = peek$(ctx, "stylePaddingTop") || 0;
|
|
1024
|
-
if (stylePaddingTop < prevStylePaddingTop) {
|
|
1025
|
-
let prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
1026
|
-
set$(ctx, "totalSize", prevTotalSize + prevStylePaddingTop);
|
|
1027
|
-
state.timeoutSetPaddingTop = setTimeout(() => {
|
|
1028
|
-
prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
1029
|
-
set$(ctx, "totalSize", prevTotalSize - prevStylePaddingTop);
|
|
1030
|
-
}, 16);
|
|
1031
|
-
}
|
|
1032
|
-
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
1033
|
-
}
|
|
1034
|
-
if (alignItemsPaddingTop !== void 0) {
|
|
1035
|
-
set$(ctx, "alignItemsPaddingTop", alignItemsPaddingTop);
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
// src/utils/updateAlignItemsPaddingTop.ts
|
|
1040
|
-
function updateAlignItemsPaddingTop(ctx) {
|
|
1041
|
-
const state = ctx.state;
|
|
1042
|
-
const {
|
|
1043
|
-
scrollLength,
|
|
1044
|
-
props: { alignItemsAtEnd, data }
|
|
1045
|
-
} = state;
|
|
1046
|
-
if (alignItemsAtEnd) {
|
|
1047
|
-
let alignItemsPaddingTop = 0;
|
|
1048
|
-
if ((data == null ? void 0 : data.length) > 0) {
|
|
1049
|
-
const contentSize = getContentSize(ctx);
|
|
1050
|
-
alignItemsPaddingTop = Math.max(0, Math.floor(scrollLength - contentSize));
|
|
1051
|
-
}
|
|
1052
|
-
setPaddingTop(ctx, { alignItemsPaddingTop });
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
997
|
// src/core/addTotalSize.ts
|
|
1057
998
|
function addTotalSize(ctx, key, add) {
|
|
1058
999
|
const state = ctx.state;
|
|
1059
|
-
const { alignItemsAtEnd } = state.props;
|
|
1060
1000
|
const prevTotalSize = state.totalSize;
|
|
1061
1001
|
let totalSize = state.totalSize;
|
|
1062
1002
|
if (key === null) {
|
|
@@ -1075,9 +1015,6 @@ function addTotalSize(ctx, key, add) {
|
|
|
1075
1015
|
state.pendingTotalSize = void 0;
|
|
1076
1016
|
state.totalSize = totalSize;
|
|
1077
1017
|
set$(ctx, "totalSize", totalSize);
|
|
1078
|
-
if (alignItemsAtEnd) {
|
|
1079
|
-
updateAlignItemsPaddingTop(ctx);
|
|
1080
|
-
}
|
|
1081
1018
|
}
|
|
1082
1019
|
}
|
|
1083
1020
|
}
|
|
@@ -2807,8 +2744,8 @@ function doMaintainScrollAtEnd(ctx, animated) {
|
|
|
2807
2744
|
props: { maintainScrollAtEnd }
|
|
2808
2745
|
} = state;
|
|
2809
2746
|
if (isAtEnd && maintainScrollAtEnd && didContainersLayout) {
|
|
2810
|
-
const
|
|
2811
|
-
if (
|
|
2747
|
+
const contentSize = getContentSize(ctx);
|
|
2748
|
+
if (contentSize < state.scrollLength) {
|
|
2812
2749
|
state.scroll = 0;
|
|
2813
2750
|
}
|
|
2814
2751
|
requestAnimationFrame(() => {
|
|
@@ -2986,7 +2923,6 @@ function handleLayout(ctx, layout, setCanRender) {
|
|
|
2986
2923
|
if (maintainScrollAtEnd === true || maintainScrollAtEnd.onLayout) {
|
|
2987
2924
|
doMaintainScrollAtEnd(ctx, false);
|
|
2988
2925
|
}
|
|
2989
|
-
updateAlignItemsPaddingTop(ctx);
|
|
2990
2926
|
checkAtBottom(ctx);
|
|
2991
2927
|
checkAtTop(state);
|
|
2992
2928
|
if (state) {
|
|
@@ -3342,6 +3278,10 @@ function createImperativeHandle(ctx) {
|
|
|
3342
3278
|
start: state.startNoBuffer,
|
|
3343
3279
|
startBuffered: state.startBuffered
|
|
3344
3280
|
}),
|
|
3281
|
+
reportContentInset: (inset) => {
|
|
3282
|
+
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3283
|
+
updateScroll(ctx, state.scroll, true);
|
|
3284
|
+
},
|
|
3345
3285
|
scrollIndexIntoView,
|
|
3346
3286
|
scrollItemIntoView: ({ item, ...props }) => {
|
|
3347
3287
|
const data = state.props.data;
|
|
@@ -3374,10 +3314,6 @@ function createImperativeHandle(ctx) {
|
|
|
3374
3314
|
}
|
|
3375
3315
|
},
|
|
3376
3316
|
scrollToOffset: (params) => scrollTo(ctx, params),
|
|
3377
|
-
reportContentInset: (inset) => {
|
|
3378
|
-
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
3379
|
-
updateScroll(ctx, state.scroll, true);
|
|
3380
|
-
},
|
|
3381
3317
|
setScrollProcessingEnabled: (enabled) => {
|
|
3382
3318
|
state.scrollProcessingEnabled = enabled;
|
|
3383
3319
|
},
|
|
@@ -3483,6 +3419,23 @@ function normalizeMaintainVisibleContentPosition(value) {
|
|
|
3483
3419
|
}
|
|
3484
3420
|
return { data: false, size: true };
|
|
3485
3421
|
}
|
|
3422
|
+
|
|
3423
|
+
// src/utils/setPaddingTop.ts
|
|
3424
|
+
function setPaddingTop(ctx, { stylePaddingTop }) {
|
|
3425
|
+
const state = ctx.state;
|
|
3426
|
+
if (stylePaddingTop !== void 0) {
|
|
3427
|
+
const prevStylePaddingTop = peek$(ctx, "stylePaddingTop") || 0;
|
|
3428
|
+
if (stylePaddingTop < prevStylePaddingTop) {
|
|
3429
|
+
let prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
3430
|
+
set$(ctx, "totalSize", prevTotalSize + prevStylePaddingTop);
|
|
3431
|
+
state.timeoutSetPaddingTop = setTimeout(() => {
|
|
3432
|
+
prevTotalSize = peek$(ctx, "totalSize") || 0;
|
|
3433
|
+
set$(ctx, "totalSize", prevTotalSize - prevStylePaddingTop);
|
|
3434
|
+
}, 16);
|
|
3435
|
+
}
|
|
3436
|
+
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3486
3439
|
function useThrottleDebounce(mode) {
|
|
3487
3440
|
const timeoutRef = useRef(null);
|
|
3488
3441
|
const lastCallTimeRef = useRef(0);
|
|
@@ -3614,7 +3567,15 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3614
3567
|
} = props;
|
|
3615
3568
|
const animatedPropsInternal = props.animatedPropsInternal;
|
|
3616
3569
|
const { childrenMode } = rest;
|
|
3617
|
-
const contentContainerStyle = {
|
|
3570
|
+
const contentContainerStyle = {
|
|
3571
|
+
...StyleSheet.flatten(contentContainerStyleProp),
|
|
3572
|
+
...alignItemsAtEnd ? {
|
|
3573
|
+
display: "flex",
|
|
3574
|
+
flexDirection: horizontal ? "row" : "column",
|
|
3575
|
+
flexGrow: 1,
|
|
3576
|
+
justifyContent: "flex-end"
|
|
3577
|
+
} : {}
|
|
3578
|
+
};
|
|
3618
3579
|
const style = { ...StyleSheet.flatten(styleProp) };
|
|
3619
3580
|
const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
|
|
3620
3581
|
const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
|
|
@@ -3931,18 +3892,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3931
3892
|
let lastMetrics;
|
|
3932
3893
|
const emitMetrics = () => {
|
|
3933
3894
|
const metrics = {
|
|
3934
|
-
alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
|
|
3935
3895
|
footerSize: peek$(ctx, "footerSize") || 0,
|
|
3936
3896
|
headerSize: peek$(ctx, "headerSize") || 0
|
|
3937
3897
|
};
|
|
3938
|
-
if (!lastMetrics || metrics.
|
|
3898
|
+
if (!lastMetrics || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
|
|
3939
3899
|
lastMetrics = metrics;
|
|
3940
3900
|
onMetricsChange(metrics);
|
|
3941
3901
|
}
|
|
3942
3902
|
};
|
|
3943
3903
|
emitMetrics();
|
|
3944
3904
|
const unsubscribe = [
|
|
3945
|
-
listen$(ctx, "alignItemsPaddingTop", emitMetrics),
|
|
3946
3905
|
listen$(ctx, "headerSize", emitMetrics),
|
|
3947
3906
|
listen$(ctx, "footerSize", emitMetrics)
|
|
3948
3907
|
];
|
package/keyboard.js
CHANGED
|
@@ -99,7 +99,6 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
99
99
|
const keyboardHeight = reactNativeReanimated.useSharedValue(0);
|
|
100
100
|
const contentLength = reactNativeReanimated.useSharedValue(0);
|
|
101
101
|
const scrollLength = reactNativeReanimated.useSharedValue(0);
|
|
102
|
-
const alignItemsAtEndPadding = reactNativeReanimated.useSharedValue(0);
|
|
103
102
|
const isOpening = reactNativeReanimated.useSharedValue(false);
|
|
104
103
|
const didInteractive = reactNativeReanimated.useSharedValue(false);
|
|
105
104
|
const isKeyboardOpen = reactNativeReanimated.useSharedValue(false);
|
|
@@ -140,11 +139,9 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
140
139
|
const handleMetricsChange = React.useCallback(
|
|
141
140
|
(metrics) => {
|
|
142
141
|
updateScrollMetrics();
|
|
143
|
-
const nextPadding = metrics.alignItemsAtEndPadding || 0;
|
|
144
|
-
alignItemsAtEndPadding.set(nextPadding);
|
|
145
142
|
onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
|
|
146
143
|
},
|
|
147
|
-
[
|
|
144
|
+
[onMetricsChangeProp, updateScrollMetrics]
|
|
148
145
|
);
|
|
149
146
|
reactNativeKeyboardController.useKeyboardHandler(
|
|
150
147
|
// biome-ignore assist/source/useSortedKeys: prefer start/move/end
|
|
@@ -160,9 +157,30 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
160
157
|
if (event.height > 0) {
|
|
161
158
|
keyboardHeight.set(event.height - safeAreaInsetBottom);
|
|
162
159
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
const vIsOpening = progress > 0;
|
|
161
|
+
isOpening.set(vIsOpening);
|
|
162
|
+
const vScrollOffset = scrollOffsetY.get();
|
|
163
|
+
scrollOffsetAtKeyboardStart.set(vScrollOffset);
|
|
164
|
+
if (isIos) {
|
|
165
|
+
const vContentLength = contentLength.get();
|
|
166
|
+
const vScrollLength = scrollLength.get();
|
|
167
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
168
|
+
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
169
|
+
vKeyboardHeight,
|
|
170
|
+
vContentLength,
|
|
171
|
+
vScrollLength,
|
|
172
|
+
alignItemsAtEnd
|
|
173
|
+
);
|
|
174
|
+
const targetOffset = Math.max(
|
|
175
|
+
0,
|
|
176
|
+
vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
|
|
177
|
+
);
|
|
178
|
+
scrollOffsetY.set(targetOffset);
|
|
179
|
+
animatedOffsetY.set(targetOffset);
|
|
180
|
+
keyboardInset.set(vEffectiveKeyboardHeight);
|
|
181
|
+
} else if (isAndroid) {
|
|
182
|
+
animatedOffsetY.set(vScrollOffset);
|
|
183
|
+
}
|
|
166
184
|
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
|
|
167
185
|
}
|
|
168
186
|
},
|
|
@@ -180,7 +198,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
180
198
|
keyboardInset.set(newInset);
|
|
181
199
|
}
|
|
182
200
|
},
|
|
183
|
-
onMove: (event) => {
|
|
201
|
+
onMove: isAndroid ? (event) => {
|
|
184
202
|
"worklet";
|
|
185
203
|
if (!didInteractive.get()) {
|
|
186
204
|
const progress = clampProgress(event.progress);
|
|
@@ -200,12 +218,12 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
200
218
|
);
|
|
201
219
|
scrollOffsetY.set(targetOffset);
|
|
202
220
|
animatedOffsetY.set(targetOffset);
|
|
203
|
-
if (!horizontal) {
|
|
221
|
+
if (isAndroid && !horizontal) {
|
|
204
222
|
const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
|
|
205
223
|
keyboardInset.set(newInset);
|
|
206
224
|
}
|
|
207
225
|
}
|
|
208
|
-
},
|
|
226
|
+
} : void 0,
|
|
209
227
|
onEnd: (event) => {
|
|
210
228
|
"worklet";
|
|
211
229
|
const wasInteractive = didInteractive.get();
|
package/keyboard.mjs
CHANGED
|
@@ -78,7 +78,6 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
78
78
|
const keyboardHeight = useSharedValue(0);
|
|
79
79
|
const contentLength = useSharedValue(0);
|
|
80
80
|
const scrollLength = useSharedValue(0);
|
|
81
|
-
const alignItemsAtEndPadding = useSharedValue(0);
|
|
82
81
|
const isOpening = useSharedValue(false);
|
|
83
82
|
const didInteractive = useSharedValue(false);
|
|
84
83
|
const isKeyboardOpen = useSharedValue(false);
|
|
@@ -119,11 +118,9 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
119
118
|
const handleMetricsChange = useCallback(
|
|
120
119
|
(metrics) => {
|
|
121
120
|
updateScrollMetrics();
|
|
122
|
-
const nextPadding = metrics.alignItemsAtEndPadding || 0;
|
|
123
|
-
alignItemsAtEndPadding.set(nextPadding);
|
|
124
121
|
onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
|
|
125
122
|
},
|
|
126
|
-
[
|
|
123
|
+
[onMetricsChangeProp, updateScrollMetrics]
|
|
127
124
|
);
|
|
128
125
|
useKeyboardHandler(
|
|
129
126
|
// biome-ignore assist/source/useSortedKeys: prefer start/move/end
|
|
@@ -139,9 +136,30 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
139
136
|
if (event.height > 0) {
|
|
140
137
|
keyboardHeight.set(event.height - safeAreaInsetBottom);
|
|
141
138
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
const vIsOpening = progress > 0;
|
|
140
|
+
isOpening.set(vIsOpening);
|
|
141
|
+
const vScrollOffset = scrollOffsetY.get();
|
|
142
|
+
scrollOffsetAtKeyboardStart.set(vScrollOffset);
|
|
143
|
+
if (isIos) {
|
|
144
|
+
const vContentLength = contentLength.get();
|
|
145
|
+
const vScrollLength = scrollLength.get();
|
|
146
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
147
|
+
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
148
|
+
vKeyboardHeight,
|
|
149
|
+
vContentLength,
|
|
150
|
+
vScrollLength,
|
|
151
|
+
alignItemsAtEnd
|
|
152
|
+
);
|
|
153
|
+
const targetOffset = Math.max(
|
|
154
|
+
0,
|
|
155
|
+
vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
|
|
156
|
+
);
|
|
157
|
+
scrollOffsetY.set(targetOffset);
|
|
158
|
+
animatedOffsetY.set(targetOffset);
|
|
159
|
+
keyboardInset.set(vEffectiveKeyboardHeight);
|
|
160
|
+
} else if (isAndroid) {
|
|
161
|
+
animatedOffsetY.set(vScrollOffset);
|
|
162
|
+
}
|
|
145
163
|
runOnJS(setScrollProcessingEnabled)(false);
|
|
146
164
|
}
|
|
147
165
|
},
|
|
@@ -159,7 +177,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
159
177
|
keyboardInset.set(newInset);
|
|
160
178
|
}
|
|
161
179
|
},
|
|
162
|
-
onMove: (event) => {
|
|
180
|
+
onMove: isAndroid ? (event) => {
|
|
163
181
|
"worklet";
|
|
164
182
|
if (!didInteractive.get()) {
|
|
165
183
|
const progress = clampProgress(event.progress);
|
|
@@ -179,12 +197,12 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
179
197
|
);
|
|
180
198
|
scrollOffsetY.set(targetOffset);
|
|
181
199
|
animatedOffsetY.set(targetOffset);
|
|
182
|
-
if (!horizontal) {
|
|
200
|
+
if (isAndroid && !horizontal) {
|
|
183
201
|
const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
|
|
184
202
|
keyboardInset.set(newInset);
|
|
185
203
|
}
|
|
186
204
|
}
|
|
187
|
-
},
|
|
205
|
+
} : void 0,
|
|
188
206
|
onEnd: (event) => {
|
|
189
207
|
"worklet";
|
|
190
208
|
const wasInteractive = didInteractive.get();
|
package/keyboard.native.js
CHANGED
|
@@ -99,7 +99,6 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
99
99
|
const keyboardHeight = reactNativeReanimated.useSharedValue(0);
|
|
100
100
|
const contentLength = reactNativeReanimated.useSharedValue(0);
|
|
101
101
|
const scrollLength = reactNativeReanimated.useSharedValue(0);
|
|
102
|
-
const alignItemsAtEndPadding = reactNativeReanimated.useSharedValue(0);
|
|
103
102
|
const isOpening = reactNativeReanimated.useSharedValue(false);
|
|
104
103
|
const didInteractive = reactNativeReanimated.useSharedValue(false);
|
|
105
104
|
const isKeyboardOpen = reactNativeReanimated.useSharedValue(false);
|
|
@@ -140,11 +139,9 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
140
139
|
const handleMetricsChange = React.useCallback(
|
|
141
140
|
(metrics) => {
|
|
142
141
|
updateScrollMetrics();
|
|
143
|
-
const nextPadding = metrics.alignItemsAtEndPadding || 0;
|
|
144
|
-
alignItemsAtEndPadding.set(nextPadding);
|
|
145
142
|
onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
|
|
146
143
|
},
|
|
147
|
-
[
|
|
144
|
+
[onMetricsChangeProp, updateScrollMetrics]
|
|
148
145
|
);
|
|
149
146
|
reactNativeKeyboardController.useKeyboardHandler(
|
|
150
147
|
// biome-ignore assist/source/useSortedKeys: prefer start/move/end
|
|
@@ -160,9 +157,30 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
160
157
|
if (event.height > 0) {
|
|
161
158
|
keyboardHeight.set(event.height - safeAreaInsetBottom);
|
|
162
159
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
const vIsOpening = progress > 0;
|
|
161
|
+
isOpening.set(vIsOpening);
|
|
162
|
+
const vScrollOffset = scrollOffsetY.get();
|
|
163
|
+
scrollOffsetAtKeyboardStart.set(vScrollOffset);
|
|
164
|
+
if (isIos) {
|
|
165
|
+
const vContentLength = contentLength.get();
|
|
166
|
+
const vScrollLength = scrollLength.get();
|
|
167
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
168
|
+
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
169
|
+
vKeyboardHeight,
|
|
170
|
+
vContentLength,
|
|
171
|
+
vScrollLength,
|
|
172
|
+
alignItemsAtEnd
|
|
173
|
+
);
|
|
174
|
+
const targetOffset = Math.max(
|
|
175
|
+
0,
|
|
176
|
+
vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
|
|
177
|
+
);
|
|
178
|
+
scrollOffsetY.set(targetOffset);
|
|
179
|
+
animatedOffsetY.set(targetOffset);
|
|
180
|
+
keyboardInset.set(vEffectiveKeyboardHeight);
|
|
181
|
+
} else if (isAndroid) {
|
|
182
|
+
animatedOffsetY.set(vScrollOffset);
|
|
183
|
+
}
|
|
166
184
|
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
|
|
167
185
|
}
|
|
168
186
|
},
|
|
@@ -180,7 +198,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
180
198
|
keyboardInset.set(newInset);
|
|
181
199
|
}
|
|
182
200
|
},
|
|
183
|
-
onMove: (event) => {
|
|
201
|
+
onMove: isAndroid ? (event) => {
|
|
184
202
|
"worklet";
|
|
185
203
|
if (!didInteractive.get()) {
|
|
186
204
|
const progress = clampProgress(event.progress);
|
|
@@ -200,12 +218,12 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
200
218
|
);
|
|
201
219
|
scrollOffsetY.set(targetOffset);
|
|
202
220
|
animatedOffsetY.set(targetOffset);
|
|
203
|
-
if (!horizontal) {
|
|
221
|
+
if (isAndroid && !horizontal) {
|
|
204
222
|
const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
|
|
205
223
|
keyboardInset.set(newInset);
|
|
206
224
|
}
|
|
207
225
|
}
|
|
208
|
-
},
|
|
226
|
+
} : void 0,
|
|
209
227
|
onEnd: (event) => {
|
|
210
228
|
"worklet";
|
|
211
229
|
const wasInteractive = didInteractive.get();
|
package/keyboard.native.mjs
CHANGED
|
@@ -78,7 +78,6 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
78
78
|
const keyboardHeight = useSharedValue(0);
|
|
79
79
|
const contentLength = useSharedValue(0);
|
|
80
80
|
const scrollLength = useSharedValue(0);
|
|
81
|
-
const alignItemsAtEndPadding = useSharedValue(0);
|
|
82
81
|
const isOpening = useSharedValue(false);
|
|
83
82
|
const didInteractive = useSharedValue(false);
|
|
84
83
|
const isKeyboardOpen = useSharedValue(false);
|
|
@@ -119,11 +118,9 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
119
118
|
const handleMetricsChange = useCallback(
|
|
120
119
|
(metrics) => {
|
|
121
120
|
updateScrollMetrics();
|
|
122
|
-
const nextPadding = metrics.alignItemsAtEndPadding || 0;
|
|
123
|
-
alignItemsAtEndPadding.set(nextPadding);
|
|
124
121
|
onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
|
|
125
122
|
},
|
|
126
|
-
[
|
|
123
|
+
[onMetricsChangeProp, updateScrollMetrics]
|
|
127
124
|
);
|
|
128
125
|
useKeyboardHandler(
|
|
129
126
|
// biome-ignore assist/source/useSortedKeys: prefer start/move/end
|
|
@@ -139,9 +136,30 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
139
136
|
if (event.height > 0) {
|
|
140
137
|
keyboardHeight.set(event.height - safeAreaInsetBottom);
|
|
141
138
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
const vIsOpening = progress > 0;
|
|
140
|
+
isOpening.set(vIsOpening);
|
|
141
|
+
const vScrollOffset = scrollOffsetY.get();
|
|
142
|
+
scrollOffsetAtKeyboardStart.set(vScrollOffset);
|
|
143
|
+
if (isIos) {
|
|
144
|
+
const vContentLength = contentLength.get();
|
|
145
|
+
const vScrollLength = scrollLength.get();
|
|
146
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
147
|
+
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
148
|
+
vKeyboardHeight,
|
|
149
|
+
vContentLength,
|
|
150
|
+
vScrollLength,
|
|
151
|
+
alignItemsAtEnd
|
|
152
|
+
);
|
|
153
|
+
const targetOffset = Math.max(
|
|
154
|
+
0,
|
|
155
|
+
vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
|
|
156
|
+
);
|
|
157
|
+
scrollOffsetY.set(targetOffset);
|
|
158
|
+
animatedOffsetY.set(targetOffset);
|
|
159
|
+
keyboardInset.set(vEffectiveKeyboardHeight);
|
|
160
|
+
} else if (isAndroid) {
|
|
161
|
+
animatedOffsetY.set(vScrollOffset);
|
|
162
|
+
}
|
|
145
163
|
runOnJS(setScrollProcessingEnabled)(false);
|
|
146
164
|
}
|
|
147
165
|
},
|
|
@@ -159,7 +177,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
159
177
|
keyboardInset.set(newInset);
|
|
160
178
|
}
|
|
161
179
|
},
|
|
162
|
-
onMove: (event) => {
|
|
180
|
+
onMove: isAndroid ? (event) => {
|
|
163
181
|
"worklet";
|
|
164
182
|
if (!didInteractive.get()) {
|
|
165
183
|
const progress = clampProgress(event.progress);
|
|
@@ -179,12 +197,12 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
|
|
|
179
197
|
);
|
|
180
198
|
scrollOffsetY.set(targetOffset);
|
|
181
199
|
animatedOffsetY.set(targetOffset);
|
|
182
|
-
if (!horizontal) {
|
|
200
|
+
if (isAndroid && !horizontal) {
|
|
183
201
|
const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
|
|
184
202
|
keyboardInset.set(newInset);
|
|
185
203
|
}
|
|
186
204
|
}
|
|
187
|
-
},
|
|
205
|
+
} : void 0,
|
|
188
206
|
onEnd: (event) => {
|
|
189
207
|
"worklet";
|
|
190
208
|
const wasInteractive = didInteractive.get();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/list",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.27",
|
|
4
4
|
"description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|