@legendapp/list 3.0.0-beta.51 → 3.0.0-beta.53
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.d.ts +6 -1
- package/index.d.ts +6 -0
- package/index.js +164 -67
- package/index.mjs +164 -67
- package/index.native.js +137 -62
- package/index.native.mjs +137 -62
- package/keyboard-chat.d.ts +24 -3
- package/keyboard-chat.js +25 -4
- package/keyboard-chat.mjs +26 -6
- package/keyboard-test.d.ts +6 -2
- package/keyboard-test.js +8 -3
- package/keyboard-test.mjs +4 -3
- package/package.json +1 -1
- package/react-native.d.ts +6 -1
- package/react-native.js +137 -62
- package/react-native.mjs +137 -62
- package/react-native.web.d.ts +5 -1
- package/react-native.web.js +164 -67
- package/react-native.web.mjs +164 -67
- package/react.d.ts +5 -1
- package/react.js +164 -67
- package/react.mjs +164 -67
- package/reanimated.d.ts +6 -1
- package/section-list.d.ts +6 -1
package/react-native.web.js
CHANGED
|
@@ -166,7 +166,10 @@ function useSelector$(signalName, selector) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
// src/state/getContentInsetEnd.ts
|
|
169
|
-
function
|
|
169
|
+
function getContentInsetEndAdjustmentEnd(adjustment) {
|
|
170
|
+
return Math.max(0, adjustment != null ? adjustment : 0);
|
|
171
|
+
}
|
|
172
|
+
function getContentInsetEnd(ctx, contentInsetEndAdjustmentOverride) {
|
|
170
173
|
var _a3, _b;
|
|
171
174
|
const state = ctx.state;
|
|
172
175
|
const { props } = state;
|
|
@@ -174,14 +177,21 @@ function getContentInsetEnd(ctx) {
|
|
|
174
177
|
const contentInset = props.contentInset;
|
|
175
178
|
const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
|
|
176
179
|
const baseEndInset = (horizontal ? baseInset == null ? void 0 : baseInset.right : baseInset == null ? void 0 : baseInset.bottom) || 0;
|
|
180
|
+
const contentInsetEndAdjustment = getContentInsetEndAdjustmentEnd(
|
|
181
|
+
contentInsetEndAdjustmentOverride != null ? contentInsetEndAdjustmentOverride : props.contentInsetEndAdjustment
|
|
182
|
+
);
|
|
177
183
|
const anchoredEndSpaceSize = peek$(ctx, "anchoredEndSpaceSize");
|
|
178
184
|
const anchoredEndInset = ((_a3 = props.anchoredEndSpace) == null ? void 0 : _a3.includeInEndInset) && anchoredEndSpaceSize ? anchoredEndSpaceSize : 0;
|
|
179
185
|
const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
|
|
186
|
+
const adjustedBaseEndInset = baseEndInset + contentInsetEndAdjustment;
|
|
180
187
|
if (overrideInset) {
|
|
181
188
|
const mergedInset = { bottom: 0, right: 0, ...baseInset, ...overrideInset };
|
|
182
|
-
return Math.max(
|
|
189
|
+
return Math.max(
|
|
190
|
+
((horizontal ? mergedInset.right : mergedInset.bottom) || 0) + contentInsetEndAdjustment,
|
|
191
|
+
anchoredEndInset
|
|
192
|
+
);
|
|
183
193
|
}
|
|
184
|
-
return Math.max(
|
|
194
|
+
return Math.max(adjustedBaseEndInset, anchoredEndInset);
|
|
185
195
|
}
|
|
186
196
|
|
|
187
197
|
// src/state/getContentSize.ts
|
|
@@ -682,6 +692,49 @@ function isInMVCPActiveMode(state) {
|
|
|
682
692
|
}
|
|
683
693
|
|
|
684
694
|
// src/components/Container.tsx
|
|
695
|
+
function getContainerPositionStyle({
|
|
696
|
+
columnWrapperStyle,
|
|
697
|
+
horizontal,
|
|
698
|
+
hasItemSeparator,
|
|
699
|
+
numColumns,
|
|
700
|
+
otherAxisPos,
|
|
701
|
+
otherAxisSize
|
|
702
|
+
}) {
|
|
703
|
+
let paddingStyles;
|
|
704
|
+
if (columnWrapperStyle) {
|
|
705
|
+
const { columnGap, rowGap, gap } = columnWrapperStyle;
|
|
706
|
+
if (horizontal) {
|
|
707
|
+
paddingStyles = {
|
|
708
|
+
paddingBottom: numColumns > 1 ? (rowGap || gap || 0) / 2 : void 0,
|
|
709
|
+
paddingRight: columnGap || gap || void 0,
|
|
710
|
+
paddingTop: numColumns > 1 ? (rowGap || gap || 0) / 2 : void 0
|
|
711
|
+
};
|
|
712
|
+
} else {
|
|
713
|
+
paddingStyles = {
|
|
714
|
+
paddingBottom: rowGap || gap || void 0,
|
|
715
|
+
paddingLeft: numColumns > 1 ? (columnGap || gap || 0) / 2 : void 0,
|
|
716
|
+
paddingRight: numColumns > 1 ? (columnGap || gap || 0) / 2 : void 0
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return horizontal ? {
|
|
721
|
+
boxSizing: paddingStyles ? "border-box" : void 0,
|
|
722
|
+
flexDirection: hasItemSeparator ? "row" : void 0,
|
|
723
|
+
height: otherAxisSize,
|
|
724
|
+
left: 0,
|
|
725
|
+
position: "absolute",
|
|
726
|
+
top: otherAxisPos,
|
|
727
|
+
...paddingStyles || {}
|
|
728
|
+
} : {
|
|
729
|
+
boxSizing: paddingStyles ? "border-box" : void 0,
|
|
730
|
+
left: otherAxisPos,
|
|
731
|
+
position: "absolute",
|
|
732
|
+
right: numColumns > 1 ? null : 0,
|
|
733
|
+
top: 0,
|
|
734
|
+
width: otherAxisSize,
|
|
735
|
+
...paddingStyles || {}
|
|
736
|
+
};
|
|
737
|
+
}
|
|
685
738
|
var Container = typedMemo(function Container2({
|
|
686
739
|
id,
|
|
687
740
|
recycleItems,
|
|
@@ -720,42 +773,17 @@ var Container = typedMemo(function Container2({
|
|
|
720
773
|
const resolvedSpan = Math.min(Math.max(span || 1, 1), numColumns);
|
|
721
774
|
const otherAxisPos = numColumns > 1 ? `${(resolvedColumn - 1) / numColumns * 100}%` : 0;
|
|
722
775
|
const otherAxisSize = numColumns > 1 ? `${resolvedSpan / numColumns * 100}%` : void 0;
|
|
723
|
-
const style = React3.useMemo(
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
paddingStyles = {
|
|
735
|
-
paddingBottom: rowGap || gap || void 0,
|
|
736
|
-
paddingLeft: numColumns > 1 ? (columnGap || gap || 0) / 2 : void 0,
|
|
737
|
-
paddingRight: numColumns > 1 ? (columnGap || gap || 0) / 2 : void 0
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
return horizontal ? {
|
|
742
|
-
boxSizing: paddingStyles ? "border-box" : void 0,
|
|
743
|
-
flexDirection: ItemSeparatorComponent ? "row" : void 0,
|
|
744
|
-
height: otherAxisSize,
|
|
745
|
-
left: 0,
|
|
746
|
-
position: "absolute",
|
|
747
|
-
top: otherAxisPos,
|
|
748
|
-
...paddingStyles || {}
|
|
749
|
-
} : {
|
|
750
|
-
boxSizing: paddingStyles ? "border-box" : void 0,
|
|
751
|
-
left: otherAxisPos,
|
|
752
|
-
position: "absolute",
|
|
753
|
-
right: numColumns > 1 ? null : 0,
|
|
754
|
-
top: 0,
|
|
755
|
-
width: otherAxisSize,
|
|
756
|
-
...paddingStyles || {}
|
|
757
|
-
};
|
|
758
|
-
}, [horizontal, otherAxisPos, otherAxisSize, columnWrapperStyle, numColumns]);
|
|
776
|
+
const style = React3.useMemo(
|
|
777
|
+
() => getContainerPositionStyle({
|
|
778
|
+
columnWrapperStyle,
|
|
779
|
+
hasItemSeparator: !!ItemSeparatorComponent,
|
|
780
|
+
horizontal,
|
|
781
|
+
numColumns,
|
|
782
|
+
otherAxisPos,
|
|
783
|
+
otherAxisSize
|
|
784
|
+
}),
|
|
785
|
+
[horizontal, otherAxisPos, otherAxisSize, columnWrapperStyle, numColumns, ItemSeparatorComponent]
|
|
786
|
+
);
|
|
759
787
|
const renderedItemInfo = React3.useMemo(
|
|
760
788
|
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
761
789
|
[itemKey, data, extraData]
|
|
@@ -1066,6 +1094,9 @@ function useRafCoalescer(callback) {
|
|
|
1066
1094
|
return coalescer;
|
|
1067
1095
|
}
|
|
1068
1096
|
|
|
1097
|
+
// src/components/webConstants.ts
|
|
1098
|
+
var LEGEND_LIST_CONTENT_CONTAINER_CLASS = "legend-list-content-container";
|
|
1099
|
+
|
|
1069
1100
|
// src/components/webScrollUtils.ts
|
|
1070
1101
|
function getDocumentScrollerNode() {
|
|
1071
1102
|
if (typeof document === "undefined") {
|
|
@@ -1150,6 +1181,11 @@ function resolveWindowScrollTarget({ clampedOffset, horizontal, listPos, scroll
|
|
|
1150
1181
|
}
|
|
1151
1182
|
|
|
1152
1183
|
// src/components/ListComponentScrollView.tsx
|
|
1184
|
+
function getContentInsetEndAdjustmentEnd2(ctx) {
|
|
1185
|
+
var _a3, _b;
|
|
1186
|
+
const adjustment = (_b = (_a3 = ctx.state) == null ? void 0 : _a3.props) == null ? void 0 : _b.contentInsetEndAdjustment;
|
|
1187
|
+
return Math.max(0, adjustment != null ? adjustment : 0);
|
|
1188
|
+
}
|
|
1153
1189
|
var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView2({
|
|
1154
1190
|
children,
|
|
1155
1191
|
style,
|
|
@@ -1167,7 +1203,9 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
|
|
|
1167
1203
|
onLayout,
|
|
1168
1204
|
...props
|
|
1169
1205
|
}, ref) {
|
|
1206
|
+
var _a3, _b, _c;
|
|
1170
1207
|
const ctx = useStateContext();
|
|
1208
|
+
const [anchoredEndSpaceSize] = useArr$(["anchoredEndSpaceSize"]);
|
|
1171
1209
|
const scrollRef = React3.useRef(null);
|
|
1172
1210
|
const contentRef = React3.useRef(null);
|
|
1173
1211
|
const isWindowScroll = useWindowScroll;
|
|
@@ -1229,10 +1267,9 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
|
|
|
1229
1267
|
React3.useImperativeHandle(ref, () => {
|
|
1230
1268
|
const api = {
|
|
1231
1269
|
getBoundingClientRect: () => {
|
|
1232
|
-
var
|
|
1233
|
-
return (
|
|
1270
|
+
var _a4;
|
|
1271
|
+
return (_a4 = scrollRef.current) == null ? void 0 : _a4.getBoundingClientRect();
|
|
1234
1272
|
},
|
|
1235
|
-
getContentNode: () => contentRef.current,
|
|
1236
1273
|
getCurrentScrollOffset,
|
|
1237
1274
|
getScrollableNode: () => resolveScrollableNode(scrollRef.current, isWindowScroll),
|
|
1238
1275
|
getScrollEventTarget: () => getScrollTarget(),
|
|
@@ -1358,6 +1395,10 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
|
|
|
1358
1395
|
},
|
|
1359
1396
|
...StyleSheet.flatten(style)
|
|
1360
1397
|
};
|
|
1398
|
+
const contentInsetEndAdjustment = getContentInsetEndAdjustmentEnd2(ctx);
|
|
1399
|
+
const anchoredEndInset = ((_c = (_b = (_a3 = ctx.state) == null ? void 0 : _a3.props) == null ? void 0 : _b.anchoredEndSpace) == null ? void 0 : _c.includeInEndInset) && anchoredEndSpaceSize ? anchoredEndSpaceSize : 0;
|
|
1400
|
+
const renderedContentInsetEndAdjustment = Math.max(0, contentInsetEndAdjustment - anchoredEndInset);
|
|
1401
|
+
const contentInsetEndAdjustmentSpacerStyle = renderedContentInsetEndAdjustment ? horizontal ? { flexShrink: 0, width: renderedContentInsetEndAdjustment } : { height: renderedContentInsetEndAdjustment } : void 0;
|
|
1361
1402
|
const contentStyle = {
|
|
1362
1403
|
display: horizontal ? "flex" : "block",
|
|
1363
1404
|
flexDirection: horizontal ? "row" : void 0,
|
|
@@ -1365,6 +1406,7 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
|
|
|
1365
1406
|
minWidth: horizontal ? "100%" : void 0,
|
|
1366
1407
|
...StyleSheet.flatten(contentContainerStyle)
|
|
1367
1408
|
};
|
|
1409
|
+
const className = contentContainerClassName ? `${LEGEND_LIST_CONTENT_CONTAINER_CLASS} ${contentContainerClassName}` : LEGEND_LIST_CONTENT_CONTAINER_CLASS;
|
|
1368
1410
|
const {
|
|
1369
1411
|
contentContainerClassName: _contentContainerClassName,
|
|
1370
1412
|
contentInset: _contentInset,
|
|
@@ -1373,7 +1415,7 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
|
|
|
1373
1415
|
useWindowScroll: _useWindowScroll,
|
|
1374
1416
|
...webProps
|
|
1375
1417
|
} = props;
|
|
1376
|
-
return /* @__PURE__ */ React3__namespace.createElement("div", { ref: scrollRef, ...webProps, style: scrollViewStyle }, refreshControl, /* @__PURE__ */ React3__namespace.createElement("div", { className
|
|
1418
|
+
return /* @__PURE__ */ React3__namespace.createElement("div", { ref: scrollRef, ...webProps, style: scrollViewStyle }, refreshControl, /* @__PURE__ */ React3__namespace.createElement("div", { className, ref: contentRef, style: contentStyle }, children, contentInsetEndAdjustmentSpacerStyle ? /* @__PURE__ */ React3__namespace.createElement("div", { "aria-hidden": true, style: contentInsetEndAdjustmentSpacerStyle }) : null));
|
|
1377
1419
|
});
|
|
1378
1420
|
function useValueListener$(key, callback) {
|
|
1379
1421
|
const ctx = useStateContext();
|
|
@@ -1401,11 +1443,18 @@ function getScrollAdjustAxis(horizontal) {
|
|
|
1401
1443
|
y: 1
|
|
1402
1444
|
};
|
|
1403
1445
|
}
|
|
1446
|
+
function resolveScrollAdjustContentNode(el, contentNode) {
|
|
1447
|
+
if ((contentNode == null ? void 0 : contentNode.isConnected) && contentNode.parentElement === el) {
|
|
1448
|
+
return contentNode;
|
|
1449
|
+
}
|
|
1450
|
+
return el.querySelector(`:scope > .${LEGEND_LIST_CONTENT_CONTAINER_CLASS}`);
|
|
1451
|
+
}
|
|
1404
1452
|
function ScrollAdjust() {
|
|
1405
1453
|
const ctx = useStateContext();
|
|
1406
1454
|
const lastScrollOffsetRef = React3__namespace.useRef(0);
|
|
1407
1455
|
const resetPaddingRafRef = React3__namespace.useRef(void 0);
|
|
1408
1456
|
const resetPaddingBaselineRef = React3__namespace.useRef(void 0);
|
|
1457
|
+
const contentNodeRef = React3__namespace.useRef(null);
|
|
1409
1458
|
const callback = React3__namespace.useCallback(() => {
|
|
1410
1459
|
var _a3, _b;
|
|
1411
1460
|
const scrollAdjust = peek$(ctx, "scrollAdjust");
|
|
@@ -1416,9 +1465,10 @@ function ScrollAdjust() {
|
|
|
1416
1465
|
const scrollDelta = scrollOffset - lastScrollOffsetRef.current;
|
|
1417
1466
|
if (scrollDelta !== 0) {
|
|
1418
1467
|
const axis = getScrollAdjustAxis(!!ctx.state.props.horizontal);
|
|
1419
|
-
const contentNode = scrollView.getContentNode();
|
|
1420
1468
|
const prevScroll = scrollView.getCurrentScrollOffset();
|
|
1421
1469
|
const el = scrollView.getScrollableNode();
|
|
1470
|
+
const contentNode = resolveScrollAdjustContentNode(el, contentNodeRef.current);
|
|
1471
|
+
contentNodeRef.current = contentNode;
|
|
1422
1472
|
const scrollBy = () => scrollView.scrollBy(axis.x * scrollDelta, axis.y * scrollDelta);
|
|
1423
1473
|
if (!contentNode) {
|
|
1424
1474
|
scrollBy();
|
|
@@ -3273,6 +3323,15 @@ function checkFinishedScrollFallback(ctx) {
|
|
|
3273
3323
|
}
|
|
3274
3324
|
|
|
3275
3325
|
// src/core/initialScrollLifecycle.ts
|
|
3326
|
+
function retargetActiveInitialScrollAtEnd(ctx) {
|
|
3327
|
+
var _a3;
|
|
3328
|
+
const state = ctx.state;
|
|
3329
|
+
const initialScroll = state.initialScroll;
|
|
3330
|
+
if (!initialScroll || state.didFinishInitialScroll || ((_a3 = state.initialScrollSession) == null ? void 0 : _a3.kind) === "offset" || initialScroll.viewPosition !== 1 || state.props.data.length === 0) {
|
|
3331
|
+
return false;
|
|
3332
|
+
}
|
|
3333
|
+
return advanceCurrentInitialScrollSession(ctx, { forceScroll: true });
|
|
3334
|
+
}
|
|
3276
3335
|
function handleInitialScrollLayoutReady(ctx) {
|
|
3277
3336
|
var _a3;
|
|
3278
3337
|
if (!ctx.state.initialScroll) {
|
|
@@ -5329,17 +5388,32 @@ function maybeUpdateAnchoredEndSpace(ctx) {
|
|
|
5329
5388
|
nextSize = Math.max(0, state.scrollLength - contentBelowAnchor - anchorOffset);
|
|
5330
5389
|
}
|
|
5331
5390
|
}
|
|
5332
|
-
if (previousSize
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
updateScroll(ctx, state.scroll, true);
|
|
5391
|
+
if (previousSize !== nextSize) {
|
|
5392
|
+
set$(ctx, "anchoredEndSpaceSize", nextSize);
|
|
5393
|
+
(_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
|
|
5394
|
+
if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
|
|
5395
|
+
updateScroll(ctx, state.scroll, true);
|
|
5396
|
+
}
|
|
5339
5397
|
}
|
|
5340
5398
|
return nextSize;
|
|
5341
5399
|
}
|
|
5342
5400
|
|
|
5401
|
+
// src/core/updateContentInsetEndAdjustment.ts
|
|
5402
|
+
function updateContentInsetEndAdjustment(ctx, previousContentInsetEndAdjustment) {
|
|
5403
|
+
const state = ctx.state;
|
|
5404
|
+
const previousContentInsetEnd = getContentInsetEnd(ctx, previousContentInsetEndAdjustment);
|
|
5405
|
+
const nextContentInsetEnd = getContentInsetEnd(ctx);
|
|
5406
|
+
const insetDiff = nextContentInsetEnd - previousContentInsetEnd;
|
|
5407
|
+
if (insetDiff !== 0) {
|
|
5408
|
+
const wasWithinEndThreshold = !!peek$(ctx, "isWithinMaintainScrollAtEndThreshold");
|
|
5409
|
+
updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
|
|
5410
|
+
const didRetargetInitialScroll = retargetActiveInitialScrollAtEnd(ctx);
|
|
5411
|
+
if (!didRetargetInitialScroll && wasWithinEndThreshold && (insetDiff > 0)) {
|
|
5412
|
+
requestAdjust(ctx, insetDiff);
|
|
5413
|
+
}
|
|
5414
|
+
}
|
|
5415
|
+
}
|
|
5416
|
+
|
|
5343
5417
|
// src/core/updateItemSize.ts
|
|
5344
5418
|
function runOrScheduleMVCPRecalculate(ctx) {
|
|
5345
5419
|
const state = ctx.state;
|
|
@@ -5564,14 +5638,14 @@ function createImperativeHandle(ctx) {
|
|
|
5564
5638
|
const IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES = 2;
|
|
5565
5639
|
let imperativeScrollToken = 0;
|
|
5566
5640
|
const isSettlingAfterDataChange = () => !!state.didDataChange || !!state.didColumnsChange || state.queuedMVCPRecalculate !== void 0 || state.ignoreScrollFromMVCP !== void 0;
|
|
5567
|
-
const
|
|
5641
|
+
const runWhenReady = (token, run, isReady) => {
|
|
5568
5642
|
const startedAt = Date.now();
|
|
5569
5643
|
let stableFrames = 0;
|
|
5570
5644
|
const check = () => {
|
|
5571
5645
|
if (token !== imperativeScrollToken) {
|
|
5572
5646
|
return;
|
|
5573
5647
|
}
|
|
5574
|
-
if (isSettlingAfterDataChange()) {
|
|
5648
|
+
if (isSettlingAfterDataChange() || !isReady()) {
|
|
5575
5649
|
stableFrames = 0;
|
|
5576
5650
|
} else {
|
|
5577
5651
|
stableFrames += 1;
|
|
@@ -5586,10 +5660,10 @@ function createImperativeHandle(ctx) {
|
|
|
5586
5660
|
requestAnimationFrame(check);
|
|
5587
5661
|
};
|
|
5588
5662
|
const runScrollWithPromise = (run, options) => new Promise((resolve) => {
|
|
5589
|
-
var _a3;
|
|
5663
|
+
var _a3, _b;
|
|
5590
5664
|
const token = ++imperativeScrollToken;
|
|
5591
|
-
const
|
|
5592
|
-
(
|
|
5665
|
+
const isReady = (_a3 = options == null ? void 0 : options.isReady) != null ? _a3 : (() => true);
|
|
5666
|
+
(_b = state.pendingScrollResolve) == null ? void 0 : _b.call(state);
|
|
5593
5667
|
state.pendingScrollResolve = resolve;
|
|
5594
5668
|
const runNow = () => {
|
|
5595
5669
|
if (token !== imperativeScrollToken) {
|
|
@@ -5603,11 +5677,10 @@ function createImperativeHandle(ctx) {
|
|
|
5603
5677
|
resolve();
|
|
5604
5678
|
}
|
|
5605
5679
|
};
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
runWhenSettled(token, execute);
|
|
5680
|
+
if (isSettlingAfterDataChange() || !isReady()) {
|
|
5681
|
+
runWhenReady(token, runNow, isReady);
|
|
5609
5682
|
} else {
|
|
5610
|
-
|
|
5683
|
+
runNow();
|
|
5611
5684
|
}
|
|
5612
5685
|
});
|
|
5613
5686
|
const scrollIndexIntoView = (options) => {
|
|
@@ -5688,8 +5761,14 @@ function createImperativeHandle(ctx) {
|
|
|
5688
5761
|
startBuffered: state.startBuffered
|
|
5689
5762
|
}),
|
|
5690
5763
|
reportContentInset: (inset) => {
|
|
5764
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
5765
|
+
const previousInset = state.contentInsetOverride;
|
|
5691
5766
|
state.contentInsetOverride = inset != null ? inset : void 0;
|
|
5767
|
+
const didChange = ((_a3 = previousInset == null ? void 0 : previousInset.top) != null ? _a3 : 0) !== ((_c = (_b = state.contentInsetOverride) == null ? void 0 : _b.top) != null ? _c : 0) || ((_d = previousInset == null ? void 0 : previousInset.bottom) != null ? _d : 0) !== ((_f = (_e = state.contentInsetOverride) == null ? void 0 : _e.bottom) != null ? _f : 0) || ((_g = previousInset == null ? void 0 : previousInset.left) != null ? _g : 0) !== ((_i = (_h = state.contentInsetOverride) == null ? void 0 : _h.left) != null ? _i : 0) || ((_j = previousInset == null ? void 0 : previousInset.right) != null ? _j : 0) !== ((_l = (_k = state.contentInsetOverride) == null ? void 0 : _k.right) != null ? _l : 0);
|
|
5692
5768
|
updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
|
|
5769
|
+
if (didChange) {
|
|
5770
|
+
retargetActiveInitialScrollAtEnd(ctx);
|
|
5771
|
+
}
|
|
5693
5772
|
},
|
|
5694
5773
|
scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
|
|
5695
5774
|
scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
|
|
@@ -5718,15 +5797,24 @@ function createImperativeHandle(ctx) {
|
|
|
5718
5797
|
}
|
|
5719
5798
|
return false;
|
|
5720
5799
|
}),
|
|
5721
|
-
scrollToIndex: (params) =>
|
|
5722
|
-
|
|
5800
|
+
scrollToIndex: (params) => {
|
|
5801
|
+
const shouldWaitForOutOfRangeTarget = params.index >= 0 && params.index >= state.props.data.length;
|
|
5802
|
+
const options = shouldWaitForOutOfRangeTarget ? {
|
|
5803
|
+
isReady: () => {
|
|
5804
|
+
var _a3;
|
|
5805
|
+
const props = state.props;
|
|
5806
|
+
const anchorIndex = (_a3 = props.anchoredEndSpace) == null ? void 0 : _a3.anchorIndex;
|
|
5807
|
+
const lastIndex = props.data.length - 1;
|
|
5808
|
+
const isInRange = params.index < props.data.length;
|
|
5809
|
+
const shouldWaitForAnchorSize = isInRange && anchorIndex !== void 0 && anchorIndex >= 0 && params.index >= anchorIndex && !props.getFixedItemSize && !state.sizesKnown.has(getId(state, lastIndex));
|
|
5810
|
+
return isInRange && !shouldWaitForAnchorSize;
|
|
5811
|
+
}
|
|
5812
|
+
} : void 0;
|
|
5813
|
+
return runScrollWithPromise(() => {
|
|
5723
5814
|
scrollToIndex(ctx, params);
|
|
5724
5815
|
return true;
|
|
5725
|
-
},
|
|
5726
|
-
|
|
5727
|
-
shouldWaitOneFrame: params.index >= 0 && params.index >= state.props.data.length
|
|
5728
|
-
}
|
|
5729
|
-
),
|
|
5816
|
+
}, options);
|
|
5817
|
+
},
|
|
5730
5818
|
scrollToItem: ({ item, ...props }) => runScrollWithPromise(() => {
|
|
5731
5819
|
const data = state.props.data;
|
|
5732
5820
|
const index = data.indexOf(item);
|
|
@@ -5981,6 +6069,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5981
6069
|
data: dataProp = [],
|
|
5982
6070
|
dataVersion,
|
|
5983
6071
|
drawDistance = 250,
|
|
6072
|
+
contentInsetEndAdjustment,
|
|
5984
6073
|
estimatedItemSize = 100,
|
|
5985
6074
|
estimatedListSize,
|
|
5986
6075
|
extraData,
|
|
@@ -6090,6 +6179,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6090
6179
|
const combinedRef = useCombinedRef(refScroller, refScrollView);
|
|
6091
6180
|
const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
|
|
6092
6181
|
const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
|
|
6182
|
+
const contentInsetEndAdjustmentResolved = contentInsetEndAdjustment ;
|
|
6183
|
+
const previousContentInsetEndAdjustmentRef = React3.useRef(contentInsetEndAdjustmentResolved);
|
|
6093
6184
|
const alwaysRenderIndices = React3.useMemo(() => {
|
|
6094
6185
|
const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
|
|
6095
6186
|
return { arr: indices, set: new Set(indices) };
|
|
@@ -6209,6 +6300,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6209
6300
|
anchoredEndSpace: anchoredEndSpaceResolved,
|
|
6210
6301
|
animatedProps: animatedPropsInternal,
|
|
6211
6302
|
contentInset,
|
|
6303
|
+
contentInsetEndAdjustment: contentInsetEndAdjustmentResolved,
|
|
6212
6304
|
data: dataProp,
|
|
6213
6305
|
dataVersion,
|
|
6214
6306
|
drawDistance,
|
|
@@ -6326,6 +6418,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
6326
6418
|
didAnchoredEndSpaceAnchorIndexChange,
|
|
6327
6419
|
numColumnsProp
|
|
6328
6420
|
]);
|
|
6421
|
+
React3.useLayoutEffect(() => {
|
|
6422
|
+
const previousContentInsetEndAdjustment = previousContentInsetEndAdjustmentRef.current;
|
|
6423
|
+
previousContentInsetEndAdjustmentRef.current = contentInsetEndAdjustmentResolved;
|
|
6424
|
+
updateContentInsetEndAdjustment(ctx, previousContentInsetEndAdjustment);
|
|
6425
|
+
}, [ctx, contentInsetEndAdjustmentResolved]);
|
|
6329
6426
|
const onLayoutFooter = React3.useCallback(
|
|
6330
6427
|
(layout) => {
|
|
6331
6428
|
if (!usesBootstrapInitialScroll) {
|