@legendapp/list 3.0.0-beta.54 → 3.0.0-beta.55

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.js CHANGED
@@ -34,6 +34,115 @@ var View = React3.forwardRef(function View2(props, ref) {
34
34
  });
35
35
  var Text = View;
36
36
 
37
+ // src/platform/Platform.ts
38
+ var Platform = {
39
+ // Widen the type to avoid unreachable-branch lints in cross-platform code that compares against other OSes
40
+ OS: "web"
41
+ };
42
+
43
+ // src/utils/rtl.ts
44
+ function clampHorizontalOffset(offset, maxOffset) {
45
+ if (maxOffset === void 0) {
46
+ return offset;
47
+ }
48
+ return Math.max(0, Math.min(maxOffset, offset));
49
+ }
50
+ function getHorizontalMaxOffset(state, contentWidth) {
51
+ if (contentWidth === void 0 || !Number.isFinite(contentWidth) || !Number.isFinite(state.scrollLength) || contentWidth <= state.scrollLength) {
52
+ return contentWidth !== void 0 && Number.isFinite(contentWidth) && Number.isFinite(state.scrollLength) ? 0 : void 0;
53
+ }
54
+ return Math.max(0, contentWidth - state.scrollLength);
55
+ }
56
+ function getDefaultHorizontalRTLScrollType() {
57
+ return "normal" ;
58
+ }
59
+ function getNativeHorizontalRTLScrollType(state) {
60
+ var _a3;
61
+ return (_a3 = state == null ? void 0 : state.horizontalRTLScrollType) != null ? _a3 : getDefaultHorizontalRTLScrollType();
62
+ }
63
+ function isRTLProps(props) {
64
+ var _a3;
65
+ return (_a3 = props == null ? void 0 : props.rtl) != null ? _a3 : false;
66
+ }
67
+ function isHorizontalRTL(state) {
68
+ return isHorizontalRTLProps(state == null ? void 0 : state.props);
69
+ }
70
+ function isHorizontalRTLProps(props) {
71
+ return !!(props == null ? void 0 : props.horizontal) && isRTLProps(props);
72
+ }
73
+ function getLogicalHorizontalMaxOffset(state, contentWidth) {
74
+ var _a3;
75
+ return (_a3 = getHorizontalMaxOffset(state, contentWidth)) != null ? _a3 : 0;
76
+ }
77
+ function getHorizontalInsetEnd(state, inset) {
78
+ if (!inset) {
79
+ return 0;
80
+ }
81
+ return (isHorizontalRTL(state) ? inset.left : inset.right) || 0;
82
+ }
83
+ function toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, listSize) {
84
+ if (!isHorizontalRTL(state) || listSize === void 0 || !Number.isFinite(listSize)) {
85
+ return logicalPosition;
86
+ }
87
+ return Math.max(0, listSize - logicalPosition - itemSize);
88
+ }
89
+ function toNativeHorizontalOffset(state, logicalOffset, contentWidth) {
90
+ if (!state || !isHorizontalRTL(state)) {
91
+ return logicalOffset;
92
+ }
93
+ const maxOffset = getHorizontalMaxOffset(state, contentWidth);
94
+ const clampedLogicalOffset = clampHorizontalOffset(logicalOffset, maxOffset);
95
+ const mode = getNativeHorizontalRTLScrollType(state);
96
+ if (mode === "negative") {
97
+ return clampedLogicalOffset === 0 ? 0 : -clampedLogicalOffset;
98
+ }
99
+ if (mode === "inverted") {
100
+ if (maxOffset === void 0) {
101
+ return clampedLogicalOffset;
102
+ }
103
+ return clampHorizontalOffset(maxOffset - clampedLogicalOffset, maxOffset);
104
+ }
105
+ return clampedLogicalOffset;
106
+ }
107
+ function toLogicalHorizontalOffset(state, rawOffset, contentWidth) {
108
+ if (!isHorizontalRTL(state)) {
109
+ state.horizontalRTLScrollType = void 0;
110
+ return rawOffset;
111
+ }
112
+ const maxOffset = getHorizontalMaxOffset(state, contentWidth);
113
+ if (rawOffset < 0) {
114
+ state.horizontalRTLScrollType = "negative";
115
+ return clampHorizontalOffset(-rawOffset, maxOffset);
116
+ }
117
+ if (maxOffset === void 0) {
118
+ return rawOffset;
119
+ }
120
+ const normalOffset = rawOffset;
121
+ const invertedOffset = maxOffset - rawOffset;
122
+ if (!Number.isFinite(invertedOffset)) {
123
+ state.horizontalRTLScrollType = "normal";
124
+ return normalOffset;
125
+ }
126
+ const previousMode = state.horizontalRTLScrollType;
127
+ if (previousMode === "inverted") {
128
+ return clampHorizontalOffset(invertedOffset, maxOffset);
129
+ }
130
+ if (previousMode === "normal") {
131
+ return clampHorizontalOffset(normalOffset, maxOffset);
132
+ }
133
+ if (!state.hasScrolled) {
134
+ const defaultMode = getDefaultHorizontalRTLScrollType();
135
+ state.horizontalRTLScrollType = defaultMode;
136
+ return clampHorizontalOffset(normalOffset, maxOffset);
137
+ }
138
+ const referenceScroll = state.scroll;
139
+ const distanceNormal = Math.abs(normalOffset - referenceScroll);
140
+ const distanceInverted = Math.abs(invertedOffset - referenceScroll);
141
+ const useInverted = distanceInverted + 0.5 < distanceNormal;
142
+ state.horizontalRTLScrollType = useInverted ? "inverted" : "normal";
143
+ return clampHorizontalOffset(useInverted ? invertedOffset : normalOffset, maxOffset);
144
+ }
145
+
37
146
  // src/platform/Animated.tsx
38
147
  var createAnimatedValue = (value) => value;
39
148
 
@@ -176,7 +285,7 @@ function getContentInsetEnd(ctx, contentInsetEndAdjustmentOverride) {
176
285
  const horizontal = props.horizontal;
177
286
  const contentInset = props.contentInset;
178
287
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
179
- const baseEndInset = (horizontal ? baseInset == null ? void 0 : baseInset.right : baseInset == null ? void 0 : baseInset.bottom) || 0;
288
+ const baseEndInset = (horizontal ? getHorizontalInsetEnd(state, baseInset) : baseInset == null ? void 0 : baseInset.bottom) || 0;
180
289
  const contentInsetEndAdjustment = getContentInsetEndAdjustmentEnd(
181
290
  contentInsetEndAdjustmentOverride != null ? contentInsetEndAdjustmentOverride : props.contentInsetEndAdjustment
182
291
  );
@@ -185,9 +294,9 @@ function getContentInsetEnd(ctx, contentInsetEndAdjustmentOverride) {
185
294
  const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
186
295
  const adjustedBaseEndInset = baseEndInset + contentInsetEndAdjustment;
187
296
  if (overrideInset) {
188
- const mergedInset = { bottom: 0, right: 0, ...baseInset, ...overrideInset };
297
+ const mergedInset = { bottom: 0, left: 0, right: 0, ...baseInset, ...overrideInset };
189
298
  return Math.max(
190
- ((horizontal ? mergedInset.right : mergedInset.bottom) || 0) + contentInsetEndAdjustment,
299
+ ((horizontal ? getHorizontalInsetEnd(state, mergedInset) : mergedInset.bottom) || 0) + contentInsetEndAdjustment,
191
300
  anchoredEndInset
192
301
  );
193
302
  }
@@ -281,6 +390,15 @@ var ENABLE_DEVMODE = IS_DEV && false;
281
390
  var ENABLE_DEBUG_VIEW = IS_DEV && false;
282
391
  var typedForwardRef = React3__namespace.forwardRef;
283
392
  var typedMemo = React3__namespace.memo;
393
+ var getComponent = (Component) => {
394
+ if (React3__namespace.isValidElement(Component)) {
395
+ return Component;
396
+ }
397
+ if (Component) {
398
+ return /* @__PURE__ */ React3__namespace.createElement(Component, null);
399
+ }
400
+ return null;
401
+ };
284
402
 
285
403
  // src/utils/helpers.ts
286
404
  function isFunction(obj) {
@@ -307,7 +425,8 @@ function comparatorDefault(a, b) {
307
425
  }
308
426
  function getPadding(s, type) {
309
427
  var _a3, _b, _c;
310
- return (_c = (_b = (_a3 = s[`padding${type}`]) != null ? _a3 : s.paddingVertical) != null ? _b : s.padding) != null ? _c : 0;
428
+ const axisPadding = type === "Left" || type === "Right" ? s.paddingHorizontal : s.paddingVertical;
429
+ return (_c = (_b = (_a3 = s[`padding${type}`]) != null ? _a3 : axisPadding) != null ? _b : s.padding) != null ? _c : 0;
311
430
  }
312
431
  function extractPadding(style, contentContainerStyle, type) {
313
432
  return getPadding(style, type) + getPadding(contentContainerStyle, type);
@@ -329,6 +448,14 @@ function findContainerId(ctx, key) {
329
448
  }
330
449
 
331
450
  // src/components/PositionView.tsx
451
+ var isRNWeb = typeof document !== "undefined" && !!document.getElementById("react-native-stylesheet");
452
+ var baseCss = {
453
+ contain: "paint layout style",
454
+ ...isRNWeb ? {
455
+ display: "flex",
456
+ flexDirection: "column"
457
+ } : {}
458
+ };
332
459
  var PositionViewState = typedMemo(function PositionViewState2({
333
460
  id,
334
461
  horizontal,
@@ -337,11 +464,8 @@ var PositionViewState = typedMemo(function PositionViewState2({
337
464
  ...props
338
465
  }) {
339
466
  const [position = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);
340
- const base = {
341
- contain: "paint layout style"
342
- };
343
467
  const composed = isArray(style) ? Object.assign({}, ...style) : style;
344
- const combinedStyle = horizontal ? { ...base, ...composed, left: position } : { ...base, ...composed, top: position };
468
+ const combinedStyle = horizontal ? { ...baseCss, ...composed, left: position } : { ...baseCss, ...composed, top: position };
345
469
  const {
346
470
  animatedScrollY: _animatedScrollY,
347
471
  index,
@@ -369,9 +493,6 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
369
493
  `containerPosition${id}`,
370
494
  "activeStickyIndex"
371
495
  ]);
372
- const base = {
373
- contain: "paint layout style"
374
- };
375
496
  const composed = React3__namespace.useMemo(
376
497
  () => {
377
498
  var _a3;
@@ -381,10 +502,9 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
381
502
  );
382
503
  const viewStyle = React3__namespace.useMemo(() => {
383
504
  var _a3;
384
- const styleBase = { ...base, ...composed };
505
+ const styleBase = { ...baseCss, ...composed };
385
506
  delete styleBase.transform;
386
- const stickyConfigOffset = (_a3 = stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset) != null ? _a3 : 0;
387
- const offset = stickyConfigOffset != null ? stickyConfigOffset : 0;
507
+ const offset = (_a3 = stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset) != null ? _a3 : 0;
388
508
  const isActive = activeStickyIndex === index;
389
509
  styleBase.position = isActive ? "sticky" : "absolute";
390
510
  styleBase.zIndex = index + 1e3;
@@ -395,6 +515,20 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
395
515
  }
396
516
  return styleBase;
397
517
  }, [composed, horizontal, position, index, activeStickyIndex, stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset]);
518
+ const renderStickyHeaderBackdrop = React3__namespace.useMemo(
519
+ () => (stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.backdropComponent) ? /* @__PURE__ */ React3__namespace.createElement(
520
+ "div",
521
+ {
522
+ style: {
523
+ inset: 0,
524
+ pointerEvents: "none",
525
+ position: "absolute"
526
+ }
527
+ },
528
+ getComponent(stickyHeaderConfig.backdropComponent)
529
+ ) : null,
530
+ [stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.backdropComponent]
531
+ );
398
532
  return /* @__PURE__ */ React3__namespace.createElement(
399
533
  "div",
400
534
  {
@@ -403,6 +537,7 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
403
537
  style: viewStyle,
404
538
  ...webProps
405
539
  },
540
+ renderStickyHeaderBackdrop,
406
541
  children
407
542
  );
408
543
  });
@@ -664,12 +799,6 @@ function toLayout(rect) {
664
799
  };
665
800
  }
666
801
 
667
- // src/platform/Platform.ts
668
- var Platform = {
669
- // Widen the type to avoid unreachable-branch lints in cross-platform code that compares against other OSes
670
- OS: "web"
671
- };
672
-
673
802
  // src/utils/hasActiveMVCPAnchorLock.ts
674
803
  function hasActiveMVCPAnchorLock(state) {
675
804
  const lock = state.mvcpAnchorLock;
@@ -693,6 +822,7 @@ function getContainerPositionStyle({
693
822
  columnWrapperStyle,
694
823
  horizontal,
695
824
  hasItemSeparator,
825
+ isHorizontalRTLList,
696
826
  numColumns,
697
827
  otherAxisPos,
698
828
  otherAxisSize
@@ -716,6 +846,7 @@ function getContainerPositionStyle({
716
846
  }
717
847
  return horizontal ? {
718
848
  boxSizing: paddingStyles ? "border-box" : void 0,
849
+ direction: isHorizontalRTLList && Platform.OS === "web" ? "ltr" : void 0,
719
850
  flexDirection: hasItemSeparator ? "row" : void 0,
720
851
  height: otherAxisSize,
721
852
  left: 0,
@@ -744,6 +875,7 @@ var Container = typedMemo(function Container2({
744
875
  }) {
745
876
  const ctx = useStateContext();
746
877
  const { columnWrapperStyle, animatedScrollY } = ctx;
878
+ const isHorizontalRTLList = isHorizontalRTL(ctx.state);
747
879
  const positionComponentInternal = ctx.state.props.positionComponentInternal;
748
880
  const stickyPositionComponentInternal = ctx.state.props.stickyPositionComponentInternal;
749
881
  const [column = 0, span = 1, data, numColumns = 1, extraData, isSticky] = useArr$([
@@ -775,11 +907,20 @@ var Container = typedMemo(function Container2({
775
907
  columnWrapperStyle,
776
908
  hasItemSeparator: !!ItemSeparatorComponent,
777
909
  horizontal,
910
+ isHorizontalRTLList,
778
911
  numColumns,
779
912
  otherAxisPos,
780
913
  otherAxisSize
781
914
  }),
782
- [horizontal, otherAxisPos, otherAxisSize, columnWrapperStyle, numColumns, ItemSeparatorComponent]
915
+ [
916
+ horizontal,
917
+ isHorizontalRTLList,
918
+ otherAxisPos,
919
+ otherAxisSize,
920
+ columnWrapperStyle,
921
+ numColumns,
922
+ ItemSeparatorComponent
923
+ ]
783
924
  );
784
925
  const renderedItemInfo = React3.useMemo(
785
926
  () => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
@@ -1019,9 +1160,16 @@ var ContainersInner = typedMemo(function ContainersInner2({ horizontal, numColum
1019
1160
  const ref = React3.useRef(null);
1020
1161
  const ctx = useStateContext();
1021
1162
  const columnWrapperStyle = ctx.columnWrapperStyle;
1163
+ const isHorizontalRTLList = isHorizontalRTL(ctx.state);
1022
1164
  const [otherAxisSize, readyToRender, totalSize] = useArr$(["otherAxisSize", "readyToRender", "totalSize"]);
1023
1165
  useDOMOrder(ref);
1024
- const style = horizontal ? { minHeight: otherAxisSize, opacity: readyToRender ? 1 : 0, position: "relative", width: totalSize } : { height: totalSize, minWidth: otherAxisSize, opacity: readyToRender ? 1 : 0, position: "relative" };
1166
+ const style = horizontal ? {
1167
+ direction: isHorizontalRTLList ? "ltr" : void 0,
1168
+ minHeight: otherAxisSize,
1169
+ opacity: readyToRender ? 1 : 0,
1170
+ position: "relative",
1171
+ width: totalSize
1172
+ } : { height: totalSize, minWidth: otherAxisSize, opacity: readyToRender ? 1 : 0, position: "relative" };
1025
1173
  if (!readyToRender) {
1026
1174
  style.pointerEvents = "none";
1027
1175
  }
@@ -1232,6 +1380,31 @@ function getContentInsetEndAdjustmentEnd2(ctx) {
1232
1380
  const adjustment = (_b = (_a3 = ctx.state) == null ? void 0 : _a3.props) == null ? void 0 : _b.contentInsetEndAdjustment;
1233
1381
  return Math.max(0, adjustment != null ? adjustment : 0);
1234
1382
  }
1383
+ function getFiniteSnapOffsets(snapToOffsets) {
1384
+ if (!(snapToOffsets == null ? void 0 : snapToOffsets.length)) {
1385
+ return [];
1386
+ }
1387
+ const snapOffsets = [];
1388
+ const seen = /* @__PURE__ */ new Set();
1389
+ for (const offset of snapToOffsets) {
1390
+ if (Number.isFinite(offset) && !seen.has(offset)) {
1391
+ seen.add(offset);
1392
+ snapOffsets.push(offset);
1393
+ }
1394
+ }
1395
+ return snapOffsets;
1396
+ }
1397
+ function getSnapAnchorStyle(offset, horizontal) {
1398
+ return {
1399
+ height: horizontal ? "100%" : 1,
1400
+ left: horizontal ? offset : 0,
1401
+ pointerEvents: "none",
1402
+ position: "absolute",
1403
+ scrollSnapAlign: "start",
1404
+ top: horizontal ? 0 : offset,
1405
+ width: horizontal ? 1 : "100%"
1406
+ };
1407
+ }
1235
1408
  var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView2({
1236
1409
  children,
1237
1410
  style,
@@ -1249,7 +1422,7 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
1249
1422
  onLayout,
1250
1423
  ...props
1251
1424
  }, ref) {
1252
- var _a3, _b, _c;
1425
+ var _a3, _b, _c, _d;
1253
1426
  const ctx = useStateContext();
1254
1427
  const [anchoredEndSpaceSize] = useArr$(["anchoredEndSpaceSize"]);
1255
1428
  const scrollRef = React3.useRef(null);
@@ -1464,10 +1637,16 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
1464
1637
  contentInset: _contentInset,
1465
1638
  scrollEventThrottle: _scrollEventThrottle,
1466
1639
  ScrollComponent: _ScrollComponent,
1640
+ snapToOffsets,
1467
1641
  useWindowScroll: _useWindowScroll,
1468
1642
  className: scrollViewClassNameProp,
1469
1643
  ...webProps
1470
1644
  } = props;
1645
+ const snapOffsets = !isWindowScroll ? getFiniteSnapOffsets(snapToOffsets) : [];
1646
+ if (snapOffsets.length > 0) {
1647
+ scrollViewStyle.scrollSnapType = horizontal ? "x mandatory" : "y mandatory";
1648
+ contentStyle.position = (_d = contentStyle.position) != null ? _d : "relative";
1649
+ }
1471
1650
  const scrollViewClassName = hiddenScrollIndicatorClassName ? scrollViewClassNameProp ? `${scrollViewClassNameProp} ${hiddenScrollIndicatorClassName}` : hiddenScrollIndicatorClassName : scrollViewClassNameProp;
1472
1651
  if (IS_DEV) {
1473
1652
  if (/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(
@@ -1488,9 +1667,29 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
1488
1667
  style: scrollViewStyle
1489
1668
  },
1490
1669
  refreshControl,
1491
- /* @__PURE__ */ React3__namespace.createElement("div", { className, ref: contentRef, style: contentStyle }, children, contentInsetEndAdjustmentSpacerStyle ? /* @__PURE__ */ React3__namespace.createElement("div", { "aria-hidden": true, style: contentInsetEndAdjustmentSpacerStyle }) : null)
1670
+ /* @__PURE__ */ React3__namespace.createElement("div", { className, ref: contentRef, style: contentStyle }, snapOffsets.map((offset) => /* @__PURE__ */ React3__namespace.createElement(
1671
+ "div",
1672
+ {
1673
+ "aria-hidden": true,
1674
+ "data-legend-list-snap-anchor": offset,
1675
+ key: `snap-${offset}`,
1676
+ style: getSnapAnchorStyle(offset, horizontal)
1677
+ }
1678
+ )), children, contentInsetEndAdjustmentSpacerStyle ? /* @__PURE__ */ React3__namespace.createElement("div", { "aria-hidden": true, style: contentInsetEndAdjustmentSpacerStyle }) : null)
1492
1679
  );
1493
1680
  });
1681
+
1682
+ // src/components/listComponentStyles.ts
1683
+ function getAutoOtherAxisStyle({
1684
+ horizontal,
1685
+ needsOtherAxisSize,
1686
+ otherAxisSize
1687
+ }) {
1688
+ if (!needsOtherAxisSize || !otherAxisSize || otherAxisSize <= 0) {
1689
+ return void 0;
1690
+ }
1691
+ return horizontal ? { height: otherAxisSize } : { width: otherAxisSize };
1692
+ }
1494
1693
  function useValueListener$(key, callback) {
1495
1694
  const ctx = useStateContext();
1496
1695
  React3.useLayoutEffect(() => {
@@ -1585,10 +1784,10 @@ function ScrollAdjust() {
1585
1784
  useValueListener$("scrollAdjustUserOffset", callback);
1586
1785
  return null;
1587
1786
  }
1588
- function SnapWrapper({ ScrollComponent, ...props }) {
1787
+ var SnapWrapper = React3__namespace.forwardRef(function SnapWrapperInner({ ScrollComponent, ...props }, ref) {
1589
1788
  const [snapToOffsets] = useArr$(["snapToOffsets"]);
1590
- return /* @__PURE__ */ React3__namespace.createElement(ScrollComponent, { ...props, snapToOffsets });
1591
- }
1789
+ return /* @__PURE__ */ React3__namespace.createElement(ScrollComponent, { ...props, ref, snapToOffsets });
1790
+ });
1592
1791
  function WebAnchoredEndSpace({ horizontal }) {
1593
1792
  const ctx = useStateContext();
1594
1793
  const [anchoredEndSpaceSize] = useArr$(["anchoredEndSpaceSize"]);
@@ -1605,15 +1804,6 @@ var LayoutView = ({ onLayoutChange, refView, children, ...rest }) => {
1605
1804
  useOnLayoutSync({ onLayoutChange, ref });
1606
1805
  return /* @__PURE__ */ React3__namespace.createElement("div", { ...rest, ref }, children);
1607
1806
  };
1608
- var getComponent = (Component) => {
1609
- if (React3__namespace.isValidElement(Component)) {
1610
- return Component;
1611
- }
1612
- if (Component) {
1613
- return /* @__PURE__ */ React3__namespace.createElement(Component, null);
1614
- }
1615
- return null;
1616
- };
1617
1807
 
1618
1808
  // src/components/ListComponent.tsx
1619
1809
  var ListComponent = typedMemo(function ListComponent2({
@@ -1646,6 +1836,12 @@ var ListComponent = typedMemo(function ListComponent2({
1646
1836
  }) {
1647
1837
  const ctx = useStateContext();
1648
1838
  const maintainVisibleContentPosition = ctx.state.props.maintainVisibleContentPosition;
1839
+ const [otherAxisSize = 0] = useArr$(["otherAxisSize"]);
1840
+ const autoOtherAxisStyle = getAutoOtherAxisStyle({
1841
+ horizontal,
1842
+ needsOtherAxisSize: ctx.state.needsOtherAxisSize,
1843
+ otherAxisSize
1844
+ });
1649
1845
  const ScrollComponent = React3.useMemo(() => {
1650
1846
  if (!renderScrollComponent) {
1651
1847
  return ListComponentScrollView;
@@ -1684,10 +1880,10 @@ var ListComponent = typedMemo(function ListComponent2({
1684
1880
  ...rest,
1685
1881
  ...ScrollComponent === ListComponentScrollView ? { useWindowScroll } : {},
1686
1882
  contentContainerStyle: [
1687
- contentContainerStyle,
1688
1883
  horizontal ? {
1689
1884
  height: "100%"
1690
- } : {}
1885
+ } : {},
1886
+ contentContainerStyle
1691
1887
  ],
1692
1888
  contentOffset: initialContentOffset !== void 0 ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
1693
1889
  horizontal,
@@ -1696,7 +1892,7 @@ var ListComponent = typedMemo(function ListComponent2({
1696
1892
  onScroll: onScroll2,
1697
1893
  ref: refScrollView,
1698
1894
  ScrollComponent: snapToIndices ? ScrollComponent : void 0,
1699
- style
1895
+ style: autoOtherAxisStyle ? [autoOtherAxisStyle, style] : style
1700
1896
  },
1701
1897
  /* @__PURE__ */ React3__namespace.createElement(ScrollAdjust, null),
1702
1898
  ListHeaderComponent && /* @__PURE__ */ React3__namespace.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
@@ -2413,7 +2609,8 @@ function doScrollTo(ctx, params) {
2413
2609
  }
2414
2610
  const isAnimated = !!animated;
2415
2611
  const isHorizontal = !!horizontal;
2416
- const left = isHorizontal ? offset : 0;
2612
+ const contentSize = isHorizontal ? getContentSize(ctx) : void 0;
2613
+ const left = isHorizontal ? toNativeHorizontalOffset(state, offset, contentSize) : 0;
2417
2614
  const top = isHorizontal ? 0 : offset;
2418
2615
  scroller.scrollTo({ animated: isAnimated, x: left, y: top });
2419
2616
  if (isAnimated) {
@@ -3474,7 +3671,14 @@ function handleInitialScrollLayoutReady(ctx) {
3474
3671
  }
3475
3672
  function initializeInitialScrollOnMount(ctx, options) {
3476
3673
  var _a3, _b;
3477
- const { dataLength, hasFooterComponent, initialContentOffset, initialScrollAtEnd, useBootstrapInitialScroll } = options;
3674
+ const {
3675
+ alwaysDispatchInitialScroll,
3676
+ dataLength,
3677
+ hasFooterComponent,
3678
+ initialContentOffset,
3679
+ initialScrollAtEnd,
3680
+ useBootstrapInitialScroll
3681
+ } = options;
3478
3682
  const state = ctx.state;
3479
3683
  const initialScroll = state.initialScroll;
3480
3684
  const resolvedInitialContentOffset = initialContentOffset != null ? initialContentOffset : 0;
@@ -3494,7 +3698,7 @@ function initializeInitialScrollOnMount(ctx, options) {
3494
3698
  return;
3495
3699
  }
3496
3700
  const hasPendingDataDependentInitialScroll = !!initialScroll && dataLength === 0 && !(resolvedInitialContentOffset === 0 && !initialScrollAtEnd);
3497
- if (!resolvedInitialContentOffset && !hasPendingDataDependentInitialScroll) {
3701
+ if (!alwaysDispatchInitialScroll && !resolvedInitialContentOffset && !hasPendingDataDependentInitialScroll) {
3498
3702
  if (initialScroll && !initialScrollAtEnd) {
3499
3703
  finishInitialScroll(ctx, {
3500
3704
  resolvedOffset: resolvedInitialContentOffset
@@ -3815,9 +4019,18 @@ function prepareMVCP(ctx, dataChanged) {
3815
4019
  }
3816
4020
  }
3817
4021
 
4022
+ // src/core/resetLayoutCachesForDataChange.ts
4023
+ function resetLayoutCachesForDataChange(state) {
4024
+ state.indexByKey.clear();
4025
+ state.idCache.length = 0;
4026
+ state.positions.length = 0;
4027
+ state.columns.length = 0;
4028
+ state.columnSpans.length = 0;
4029
+ }
4030
+
3818
4031
  // src/core/syncMountedContainer.ts
3819
4032
  function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3820
- var _a3, _b, _c, _d, _e, _f, _g, _h;
4033
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
3821
4034
  const state = ctx.state;
3822
4035
  const {
3823
4036
  columns,
@@ -3829,7 +4042,8 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3829
4042
  if (item === void 0) {
3830
4043
  return { didChangePosition: false, didRefreshData: false };
3831
4044
  }
3832
- const updateLayout = (_a3 = options == null ? void 0 : options.updateLayout) != null ? _a3 : true;
4045
+ const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
4046
+ const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
3833
4047
  let didChangePosition = false;
3834
4048
  let didRefreshData = false;
3835
4049
  if (updateLayout) {
@@ -3838,7 +4052,9 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3838
4052
  set$(ctx, `containerPosition${containerIndex}`, POSITION_OUT_OF_VIEW);
3839
4053
  return { didChangePosition: false, didRefreshData: false };
3840
4054
  }
3841
- const position = (positionValue || 0) - ((_b = options == null ? void 0 : options.scrollAdjustPending) != null ? _b : 0);
4055
+ const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
4056
+ const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
4057
+ const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
3842
4058
  const column = columns[itemIndex] || 1;
3843
4059
  const span = columnSpans[itemIndex] || 1;
3844
4060
  const prevPos = peek$(ctx, `containerPosition${containerIndex}`);
@@ -3857,15 +4073,15 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3857
4073
  }
3858
4074
  const prevData = peek$(ctx, `containerItemData${containerIndex}`);
3859
4075
  if (prevData !== item) {
3860
- const pendingDataComparison = ((_c = state.pendingDataComparison) == null ? void 0 : _c.previousData) === state.previousData && ((_d = state.pendingDataComparison) == null ? void 0 : _d.nextData) === data ? state.pendingDataComparison : void 0;
3861
- const cachedComparison = (_e = pendingDataComparison == null ? void 0 : pendingDataComparison.byIndex[itemIndex]) != null ? _e : 0;
4076
+ const pendingDataComparison = ((_e = state.pendingDataComparison) == null ? void 0 : _e.previousData) === state.previousData && ((_f = state.pendingDataComparison) == null ? void 0 : _f.nextData) === data ? state.pendingDataComparison : void 0;
4077
+ const cachedComparison = (_g = pendingDataComparison == null ? void 0 : pendingDataComparison.byIndex[itemIndex]) != null ? _g : 0;
3862
4078
  if (cachedComparison === 2) {
3863
4079
  set$(ctx, `containerItemData${containerIndex}`, item);
3864
4080
  didRefreshData = true;
3865
4081
  } else if (cachedComparison !== 1) {
3866
- const itemKey = (_g = (_f = peek$(ctx, `containerItemKey${containerIndex}`)) != null ? _f : state.idCache[itemIndex]) != null ? _g : getId(state, itemIndex);
4082
+ const nextItemKey = (_h = peek$(ctx, `containerItemKey${containerIndex}`)) != null ? _h : itemKey;
3867
4083
  const prevKey = keyExtractor == null ? void 0 : keyExtractor(prevData, itemIndex);
3868
- if (prevData === void 0 || !keyExtractor || prevKey !== itemKey) {
4084
+ if (prevData === void 0 || !keyExtractor || prevKey !== nextItemKey) {
3869
4085
  set$(ctx, `containerItemData${containerIndex}`, item);
3870
4086
  didRefreshData = true;
3871
4087
  } else if (!itemsAreEqual) {
@@ -3882,7 +4098,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3882
4098
  };
3883
4099
  }
3884
4100
  }
3885
- if ((_h = state.pendingDataComparison) == null ? void 0 : _h.byIndex) {
4101
+ if ((_i = state.pendingDataComparison) == null ? void 0 : _i.byIndex) {
3886
4102
  state.pendingDataComparison.byIndex[itemIndex] = isEqual ? 1 : 2;
3887
4103
  }
3888
4104
  if (!isEqual) {
@@ -4047,11 +4263,13 @@ function updateSnapToOffsets(ctx) {
4047
4263
  const {
4048
4264
  props: { snapToIndices }
4049
4265
  } = state;
4266
+ const contentSize = state.props.horizontal ? getContentSize(ctx) : void 0;
4050
4267
  const snapToOffsets = Array(snapToIndices.length);
4051
4268
  for (let i = 0; i < snapToIndices.length; i++) {
4052
4269
  const idx = snapToIndices[i];
4053
4270
  getId(state, idx);
4054
- snapToOffsets[i] = state.positions[idx];
4271
+ const logicalOffset = state.positions[idx];
4272
+ snapToOffsets[i] = toNativeHorizontalOffset(state, logicalOffset, contentSize);
4055
4273
  }
4056
4274
  set$(ctx, "snapToOffsets", snapToOffsets);
4057
4275
  }
@@ -4660,7 +4878,6 @@ function calculateItemsInView(ctx, params = {}) {
4660
4878
  var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
4661
4879
  const {
4662
4880
  columns,
4663
- columnSpans,
4664
4881
  containerItemKeys,
4665
4882
  enableScrollForNextCalculateItemsInView,
4666
4883
  idCache,
@@ -4710,8 +4927,10 @@ function calculateItemsInView(ctx, params = {}) {
4710
4927
  let scrollTopBuffered = 0;
4711
4928
  let scrollBottom = 0;
4712
4929
  let scrollBottomBuffered = 0;
4930
+ let nativeScrollState = scrollState;
4713
4931
  const updateScroll2 = (nextScrollState) => {
4714
4932
  var _a4;
4933
+ nativeScrollState = nextScrollState;
4715
4934
  scrollAdjustPending = (_a4 = peek$(ctx, "scrollAdjustPending")) != null ? _a4 : 0;
4716
4935
  scrollAdjustPad = scrollAdjustPending - topPad;
4717
4936
  scroll = Math.round(nextScrollState + scrollExtra + scrollAdjustPad);
@@ -4723,9 +4942,17 @@ function calculateItemsInView(ctx, params = {}) {
4723
4942
  const previousStickyIndex = peek$(ctx, "activeStickyIndex");
4724
4943
  const currentStickyIdx = stickyIndicesArr.length > 0 ? findCurrentStickyIndex(stickyIndicesArr, scroll, state) : -1;
4725
4944
  const nextActiveStickyIndex = currentStickyIdx >= 0 ? stickyIndicesArr[currentStickyIdx] : -1;
4945
+ const stickyIndexDidChange = previousStickyIndex !== nextActiveStickyIndex;
4726
4946
  if (currentStickyIdx >= 0 || previousStickyIndex >= 0) {
4727
4947
  set$(ctx, "activeStickyIndex", nextActiveStickyIndex);
4728
4948
  }
4949
+ const shouldNotifyStickyHeaderChange = !!onStickyHeaderChange && stickyIndicesArr.length > 0 && stickyIndexDidChange;
4950
+ const finishCalculateItemsInView = shouldNotifyStickyHeaderChange ? () => {
4951
+ const item = data[nextActiveStickyIndex];
4952
+ if (item !== void 0) {
4953
+ onStickyHeaderChange == null ? void 0 : onStickyHeaderChange({ index: nextActiveStickyIndex, item });
4954
+ }
4955
+ } : void 0;
4729
4956
  let scrollBufferTop = drawDistance;
4730
4957
  let scrollBufferBottom = drawDistance;
4731
4958
  if (speed > 0 || speed === 0 && scroll < Math.max(50, drawDistance)) {
@@ -4736,8 +4963,10 @@ function calculateItemsInView(ctx, params = {}) {
4736
4963
  scrollBufferBottom = drawDistance * 0.5;
4737
4964
  }
4738
4965
  const updateScrollRange = () => {
4739
- scrollTopBuffered = scroll - scrollBufferTop;
4740
- scrollBottom = scroll + scrollLength + (scroll < 0 ? -scroll : 0);
4966
+ const scrollStart = Math.max(0, scroll);
4967
+ const overscrollBeforeContent = Math.max(0, -nativeScrollState);
4968
+ scrollTopBuffered = scrollStart - scrollBufferTop;
4969
+ scrollBottom = Math.max(scrollStart, scroll + scrollLength + overscrollBeforeContent);
4741
4970
  scrollBottomBuffered = scrollBottom + scrollBufferBottom;
4742
4971
  };
4743
4972
  updateScrollRange();
@@ -4747,17 +4976,14 @@ function calculateItemsInView(ctx, params = {}) {
4747
4976
  state.scrollForNextCalculateItemsInView = void 0;
4748
4977
  } else if ((top === null || scrollTopBuffered > top) && (bottom === null || scrollBottomBuffered < bottom)) {
4749
4978
  if (!isInMVCPActiveMode(state)) {
4979
+ finishCalculateItemsInView == null ? void 0 : finishCalculateItemsInView();
4750
4980
  return;
4751
4981
  }
4752
4982
  }
4753
4983
  }
4754
4984
  const checkMVCP = doMVCP && !suppressInitialScrollSideEffects ? prepareMVCP(ctx, dataChanged) : void 0;
4755
4985
  if (dataChanged) {
4756
- indexByKey.clear();
4757
- idCache.length = 0;
4758
- positions.length = 0;
4759
- columns.length = 0;
4760
- columnSpans.length = 0;
4986
+ resetLayoutCachesForDataChange(state);
4761
4987
  }
4762
4988
  const startIndex = forceFullItemPositions || dataChanged ? 0 : (_c = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _c : 0;
4763
4989
  const optimizeForVisibleWindow = !forceFullItemPositions && !dataChanged && numColumns > 1 && minIndexSizeChanged !== void 0;
@@ -5071,12 +5297,7 @@ function calculateItemsInView(ctx, params = {}) {
5071
5297
  );
5072
5298
  }
5073
5299
  }
5074
- if (onStickyHeaderChange && stickyIndicesArr.length > 0 && nextActiveStickyIndex !== void 0 && nextActiveStickyIndex !== previousStickyIndex) {
5075
- const item = data[nextActiveStickyIndex];
5076
- if (item !== void 0) {
5077
- onStickyHeaderChange({ index: nextActiveStickyIndex, item });
5078
- }
5079
- }
5300
+ finishCalculateItemsInView == null ? void 0 : finishCalculateItemsInView();
5080
5301
  });
5081
5302
  }
5082
5303
 
@@ -5104,11 +5325,22 @@ function doMaintainScrollAtEnd(ctx) {
5104
5325
  if (!state.maintainingScrollAtEnd) {
5105
5326
  state.maintainingScrollAtEnd = true;
5106
5327
  requestAnimationFrame(() => {
5107
- var _a3;
5108
5328
  if (peek$(ctx, "isWithinMaintainScrollAtEndThreshold")) {
5109
- (_a3 = refScroller.current) == null ? void 0 : _a3.scrollToEnd({
5110
- animated: maintainScrollAtEnd.animated
5111
- });
5329
+ const scroller = refScroller.current;
5330
+ if (state.props.horizontal && isHorizontalRTL(state)) {
5331
+ const currentContentSize = getContentSize(ctx);
5332
+ const logicalEndOffset = getLogicalHorizontalMaxOffset(state, currentContentSize);
5333
+ const nativeOffset = toNativeHorizontalOffset(state, logicalEndOffset, currentContentSize);
5334
+ scroller == null ? void 0 : scroller.scrollTo({
5335
+ animated: maintainScrollAtEnd.animated,
5336
+ x: nativeOffset,
5337
+ y: 0
5338
+ });
5339
+ } else {
5340
+ scroller == null ? void 0 : scroller.scrollToEnd({
5341
+ animated: maintainScrollAtEnd.animated
5342
+ });
5343
+ }
5112
5344
  setTimeout(
5113
5345
  () => {
5114
5346
  state.maintainingScrollAtEnd = false;
@@ -5308,7 +5540,8 @@ function handleLayout(ctx, layoutParam, setCanRender) {
5308
5540
  }
5309
5541
  checkThresholds(ctx);
5310
5542
  if (state) {
5311
- state.needsOtherAxisSize = otherAxisSize - (state.props.stylePaddingTop || 0) < 10;
5543
+ const crossAxisPadding = state.props.horizontal ? (state.props.stylePaddingTop || 0) + (state.props.stylePaddingBottom || 0) : (state.props.stylePaddingLeft || 0) + (state.props.stylePaddingRight || 0);
5544
+ state.needsOtherAxisSize = otherAxisSize - crossAxisPadding < 10;
5312
5545
  }
5313
5546
  if (IS_DEV && measuredLength === 0) {
5314
5547
  warnDevOnce(
@@ -5422,7 +5655,7 @@ function cloneScrollEvent(event) {
5422
5655
  };
5423
5656
  }
5424
5657
  function onScroll(ctx, event) {
5425
- var _a3, _b, _c, _d;
5658
+ var _a3, _b, _c, _d, _e;
5426
5659
  const state = ctx.state;
5427
5660
  const { scrollProcessingEnabled } = state;
5428
5661
  if (scrollProcessingEnabled === false) {
@@ -5441,6 +5674,9 @@ function onScroll(ctx, event) {
5441
5674
  }
5442
5675
  }
5443
5676
  let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
5677
+ if (state.props.horizontal) {
5678
+ newScroll = toLogicalHorizontalOffset(state, newScroll, (_e = event.nativeEvent.contentSize) == null ? void 0 : _e.width);
5679
+ }
5444
5680
  if (state.scrollingTo && state.scrollingTo.offset >= newScroll) {
5445
5681
  const maxOffset = clampScrollOffset(ctx, newScroll, state.scrollingTo);
5446
5682
  if (newScroll !== maxOffset && Math.abs(newScroll - maxOffset) > 1) {
@@ -5612,6 +5848,16 @@ function runOrScheduleMVCPRecalculate(ctx) {
5612
5848
  });
5613
5849
  }
5614
5850
  }
5851
+ function updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal) {
5852
+ const state = ctx.state;
5853
+ if (state.needsOtherAxisSize) {
5854
+ const otherAxisSize = horizontal ? sizeObj.height : sizeObj.width;
5855
+ const currentOtherAxisSize = peek$(ctx, "otherAxisSize");
5856
+ if (!currentOtherAxisSize || otherAxisSize > currentOtherAxisSize) {
5857
+ set$(ctx, "otherAxisSize", otherAxisSize);
5858
+ }
5859
+ }
5860
+ }
5615
5861
  function updateItemSize(ctx, itemKey, sizeObj) {
5616
5862
  var _a3;
5617
5863
  const state = ctx.state;
@@ -5635,13 +5881,13 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5635
5881
  const type = getItemType ? (_a3 = getItemType(itemData, index)) != null ? _a3 : "" : "";
5636
5882
  const size2 = getFixedItemSize(itemData, index, type);
5637
5883
  if (size2 !== void 0 && size2 === sizesKnown.get(itemKey)) {
5884
+ updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal);
5638
5885
  return;
5639
5886
  }
5640
5887
  }
5641
5888
  let needsRecalculate = !didContainersLayout;
5642
5889
  let shouldMaintainScrollAtEnd = false;
5643
5890
  let minIndexSizeChanged;
5644
- let maxOtherAxisSize = peek$(ctx, "otherAxisSize") || 0;
5645
5891
  const prevSizeKnown = state.sizesKnown.get(itemKey);
5646
5892
  const diff = updateOneItemSize(ctx, itemKey, sizeObj);
5647
5893
  const size = roundSize(horizontal ? sizeObj.width : sizeObj.height);
@@ -5652,10 +5898,6 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5652
5898
  if (!needsRecalculate && state.containerItemKeys.has(itemKey)) {
5653
5899
  needsRecalculate = true;
5654
5900
  }
5655
- if (state.needsOtherAxisSize) {
5656
- const otherAxisSize = horizontal ? sizeObj.height : sizeObj.width;
5657
- maxOtherAxisSize = Math.max(maxOtherAxisSize, otherAxisSize);
5658
- }
5659
5901
  if (prevSizeKnown !== void 0 && Math.abs(prevSizeKnown - size) > 5) {
5660
5902
  shouldMaintainScrollAtEnd = true;
5661
5903
  }
@@ -5671,10 +5913,7 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5671
5913
  if (minIndexSizeChanged !== void 0) {
5672
5914
  state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, minIndexSizeChanged) : minIndexSizeChanged;
5673
5915
  }
5674
- const cur = peek$(ctx, "otherAxisSize");
5675
- if (!cur || maxOtherAxisSize > cur) {
5676
- set$(ctx, "otherAxisSize", maxOtherAxisSize);
5677
- }
5916
+ updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal);
5678
5917
  if (didContainersLayout || checkAllSizesKnown(state, getMountedBufferedIndices(state))) {
5679
5918
  if (needsRecalculate) {
5680
5919
  state.scrollForNextCalculateItemsInView = void 0;
@@ -6249,7 +6488,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6249
6488
  getFixedItemSize,
6250
6489
  getItemType,
6251
6490
  horizontal,
6491
+ rtl,
6252
6492
  initialContainerPoolRatio = 3,
6493
+ estimatedHeaderSize,
6253
6494
  initialScrollAtEnd = false,
6254
6495
  initialScrollIndex: initialScrollIndexProp,
6255
6496
  initialScrollOffset: initialScrollOffsetProp,
@@ -6317,13 +6558,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6317
6558
  const style = { ...StyleSheet.flatten(styleProp) };
6318
6559
  const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
6319
6560
  const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
6561
+ const stylePaddingLeftState = extractPadding(style, contentContainerStyle, "Left");
6562
+ const stylePaddingRightState = extractPadding(style, contentContainerStyle, "Right");
6320
6563
  const maintainScrollAtEndConfig = normalizeMaintainScrollAtEnd(maintainScrollAtEnd);
6321
6564
  const maintainVisibleContentPositionConfig = normalizeMaintainVisibleContentPosition(
6322
6565
  maintainVisibleContentPositionProp
6323
6566
  );
6324
6567
  const hasInitialScrollIndex = initialScrollIndexProp !== void 0 && initialScrollIndexProp !== null;
6325
6568
  const hasInitialScrollOffset = initialScrollOffsetProp !== void 0 && initialScrollOffsetProp !== null;
6326
- const initialScrollUsesOffsetOnly = !initialScrollAtEnd && !hasInitialScrollIndex && hasInitialScrollOffset;
6569
+ const shouldInitializeHorizontalRTL = !initialScrollAtEnd && !hasInitialScrollIndex && !hasInitialScrollOffset && isHorizontalRTLProps({ horizontal, rtl });
6570
+ const initialScrollUsesOffsetOnly = !initialScrollAtEnd && !hasInitialScrollIndex && (hasInitialScrollOffset || shouldInitializeHorizontalRTL);
6327
6571
  const usesBootstrapInitialScroll = initialScrollAtEnd || hasInitialScrollIndex;
6328
6572
  const initialScrollProp = initialScrollAtEnd ? {
6329
6573
  index: Math.max(0, dataProp.length - 1),
@@ -6439,6 +6683,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6439
6683
  internalState.reprocessCurrentScroll = () => updateScroll(ctx, internalState.scroll, true);
6440
6684
  set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPositionConfig);
6441
6685
  set$(ctx, "extraData", extraData);
6686
+ if (estimatedHeaderSize !== void 0) {
6687
+ set$(ctx, "headerSize", estimatedHeaderSize);
6688
+ }
6442
6689
  }
6443
6690
  refState.current = ctx.state;
6444
6691
  }
@@ -6498,11 +6745,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6498
6745
  positionComponentInternal,
6499
6746
  recycleItems: !!recycleItems,
6500
6747
  renderItem,
6748
+ rtl,
6501
6749
  snapToIndices,
6502
6750
  stickyIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],
6503
6751
  stickyIndicesSet: React3.useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),
6504
6752
  stickyPositionComponentInternal,
6505
6753
  stylePaddingBottom: stylePaddingBottomState,
6754
+ stylePaddingLeft: stylePaddingLeftState,
6755
+ stylePaddingRight: stylePaddingRightState,
6506
6756
  stylePaddingTop: stylePaddingTopState,
6507
6757
  useWindowScroll: useWindowScrollResolved
6508
6758
  };
@@ -6525,6 +6775,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6525
6775
  };
6526
6776
  if (isFirstLocal) {
6527
6777
  initializeStateVars(false);
6778
+ resetLayoutCachesForDataChange(state);
6528
6779
  updateItemPositions(
6529
6780
  ctx,
6530
6781
  /*dataChanged*/
@@ -6542,6 +6793,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6542
6793
  }, [usesBootstrapInitialScroll]);
6543
6794
  React3.useLayoutEffect(() => {
6544
6795
  initializeInitialScrollOnMount(ctx, {
6796
+ alwaysDispatchInitialScroll: shouldInitializeHorizontalRTL,
6545
6797
  dataLength: dataProp.length,
6546
6798
  hasFooterComponent: !!ListFooterComponent,
6547
6799
  initialContentOffset,