@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.
@@ -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
  });
@@ -667,12 +802,6 @@ function toLayout(rect) {
667
802
  };
668
803
  }
669
804
 
670
- // src/platform/Platform.ts
671
- var Platform = {
672
- // Widen the type to avoid unreachable-branch lints in cross-platform code that compares against other OSes
673
- OS: "web"
674
- };
675
-
676
805
  // src/utils/hasActiveMVCPAnchorLock.ts
677
806
  function hasActiveMVCPAnchorLock(state) {
678
807
  const lock = state.mvcpAnchorLock;
@@ -696,6 +825,7 @@ function getContainerPositionStyle({
696
825
  columnWrapperStyle,
697
826
  horizontal,
698
827
  hasItemSeparator,
828
+ isHorizontalRTLList,
699
829
  numColumns,
700
830
  otherAxisPos,
701
831
  otherAxisSize
@@ -719,6 +849,7 @@ function getContainerPositionStyle({
719
849
  }
720
850
  return horizontal ? {
721
851
  boxSizing: paddingStyles ? "border-box" : void 0,
852
+ direction: isHorizontalRTLList && Platform.OS === "web" ? "ltr" : void 0,
722
853
  flexDirection: hasItemSeparator ? "row" : void 0,
723
854
  height: otherAxisSize,
724
855
  left: 0,
@@ -747,6 +878,7 @@ var Container = typedMemo(function Container2({
747
878
  }) {
748
879
  const ctx = useStateContext();
749
880
  const { columnWrapperStyle, animatedScrollY } = ctx;
881
+ const isHorizontalRTLList = isHorizontalRTL(ctx.state);
750
882
  const positionComponentInternal = ctx.state.props.positionComponentInternal;
751
883
  const stickyPositionComponentInternal = ctx.state.props.stickyPositionComponentInternal;
752
884
  const [column = 0, span = 1, data, numColumns = 1, extraData, isSticky] = useArr$([
@@ -778,11 +910,20 @@ var Container = typedMemo(function Container2({
778
910
  columnWrapperStyle,
779
911
  hasItemSeparator: !!ItemSeparatorComponent,
780
912
  horizontal,
913
+ isHorizontalRTLList,
781
914
  numColumns,
782
915
  otherAxisPos,
783
916
  otherAxisSize
784
917
  }),
785
- [horizontal, otherAxisPos, otherAxisSize, columnWrapperStyle, numColumns, ItemSeparatorComponent]
918
+ [
919
+ horizontal,
920
+ isHorizontalRTLList,
921
+ otherAxisPos,
922
+ otherAxisSize,
923
+ columnWrapperStyle,
924
+ numColumns,
925
+ ItemSeparatorComponent
926
+ ]
786
927
  );
787
928
  const renderedItemInfo = React3.useMemo(
788
929
  () => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
@@ -1022,9 +1163,16 @@ var ContainersInner = typedMemo(function ContainersInner2({ horizontal, numColum
1022
1163
  const ref = React3.useRef(null);
1023
1164
  const ctx = useStateContext();
1024
1165
  const columnWrapperStyle = ctx.columnWrapperStyle;
1166
+ const isHorizontalRTLList = isHorizontalRTL(ctx.state);
1025
1167
  const [otherAxisSize, readyToRender, totalSize] = useArr$(["otherAxisSize", "readyToRender", "totalSize"]);
1026
1168
  useDOMOrder(ref);
1027
- const style = horizontal ? { minHeight: otherAxisSize, opacity: readyToRender ? 1 : 0, position: "relative", width: totalSize } : { height: totalSize, minWidth: otherAxisSize, opacity: readyToRender ? 1 : 0, position: "relative" };
1169
+ const style = horizontal ? {
1170
+ direction: isHorizontalRTLList ? "ltr" : void 0,
1171
+ minHeight: otherAxisSize,
1172
+ opacity: readyToRender ? 1 : 0,
1173
+ position: "relative",
1174
+ width: totalSize
1175
+ } : { height: totalSize, minWidth: otherAxisSize, opacity: readyToRender ? 1 : 0, position: "relative" };
1028
1176
  if (!readyToRender) {
1029
1177
  style.pointerEvents = "none";
1030
1178
  }
@@ -1235,6 +1383,31 @@ function getContentInsetEndAdjustmentEnd2(ctx) {
1235
1383
  const adjustment = (_b = (_a3 = ctx.state) == null ? void 0 : _a3.props) == null ? void 0 : _b.contentInsetEndAdjustment;
1236
1384
  return Math.max(0, adjustment != null ? adjustment : 0);
1237
1385
  }
1386
+ function getFiniteSnapOffsets(snapToOffsets) {
1387
+ if (!(snapToOffsets == null ? void 0 : snapToOffsets.length)) {
1388
+ return [];
1389
+ }
1390
+ const snapOffsets = [];
1391
+ const seen = /* @__PURE__ */ new Set();
1392
+ for (const offset of snapToOffsets) {
1393
+ if (Number.isFinite(offset) && !seen.has(offset)) {
1394
+ seen.add(offset);
1395
+ snapOffsets.push(offset);
1396
+ }
1397
+ }
1398
+ return snapOffsets;
1399
+ }
1400
+ function getSnapAnchorStyle(offset, horizontal) {
1401
+ return {
1402
+ height: horizontal ? "100%" : 1,
1403
+ left: horizontal ? offset : 0,
1404
+ pointerEvents: "none",
1405
+ position: "absolute",
1406
+ scrollSnapAlign: "start",
1407
+ top: horizontal ? 0 : offset,
1408
+ width: horizontal ? 1 : "100%"
1409
+ };
1410
+ }
1238
1411
  var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView2({
1239
1412
  children,
1240
1413
  style,
@@ -1252,7 +1425,7 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
1252
1425
  onLayout,
1253
1426
  ...props
1254
1427
  }, ref) {
1255
- var _a3, _b, _c;
1428
+ var _a3, _b, _c, _d;
1256
1429
  const ctx = useStateContext();
1257
1430
  const [anchoredEndSpaceSize] = useArr$(["anchoredEndSpaceSize"]);
1258
1431
  const scrollRef = React3.useRef(null);
@@ -1467,10 +1640,16 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
1467
1640
  contentInset: _contentInset,
1468
1641
  scrollEventThrottle: _scrollEventThrottle,
1469
1642
  ScrollComponent: _ScrollComponent,
1643
+ snapToOffsets,
1470
1644
  useWindowScroll: _useWindowScroll,
1471
1645
  className: scrollViewClassNameProp,
1472
1646
  ...webProps
1473
1647
  } = props;
1648
+ const snapOffsets = !isWindowScroll ? getFiniteSnapOffsets(snapToOffsets) : [];
1649
+ if (snapOffsets.length > 0) {
1650
+ scrollViewStyle.scrollSnapType = horizontal ? "x mandatory" : "y mandatory";
1651
+ contentStyle.position = (_d = contentStyle.position) != null ? _d : "relative";
1652
+ }
1474
1653
  const scrollViewClassName = hiddenScrollIndicatorClassName ? scrollViewClassNameProp ? `${scrollViewClassNameProp} ${hiddenScrollIndicatorClassName}` : hiddenScrollIndicatorClassName : scrollViewClassNameProp;
1475
1654
  if (IS_DEV) {
1476
1655
  if (/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(
@@ -1491,9 +1670,29 @@ var ListComponentScrollView = React3.forwardRef(function ListComponentScrollView
1491
1670
  style: scrollViewStyle
1492
1671
  },
1493
1672
  refreshControl,
1494
- /* @__PURE__ */ React3__namespace.createElement("div", { className, ref: contentRef, style: contentStyle }, children, contentInsetEndAdjustmentSpacerStyle ? /* @__PURE__ */ React3__namespace.createElement("div", { "aria-hidden": true, style: contentInsetEndAdjustmentSpacerStyle }) : null)
1673
+ /* @__PURE__ */ React3__namespace.createElement("div", { className, ref: contentRef, style: contentStyle }, snapOffsets.map((offset) => /* @__PURE__ */ React3__namespace.createElement(
1674
+ "div",
1675
+ {
1676
+ "aria-hidden": true,
1677
+ "data-legend-list-snap-anchor": offset,
1678
+ key: `snap-${offset}`,
1679
+ style: getSnapAnchorStyle(offset, horizontal)
1680
+ }
1681
+ )), children, contentInsetEndAdjustmentSpacerStyle ? /* @__PURE__ */ React3__namespace.createElement("div", { "aria-hidden": true, style: contentInsetEndAdjustmentSpacerStyle }) : null)
1495
1682
  );
1496
1683
  });
1684
+
1685
+ // src/components/listComponentStyles.ts
1686
+ function getAutoOtherAxisStyle({
1687
+ horizontal,
1688
+ needsOtherAxisSize,
1689
+ otherAxisSize
1690
+ }) {
1691
+ if (!needsOtherAxisSize || !otherAxisSize || otherAxisSize <= 0) {
1692
+ return void 0;
1693
+ }
1694
+ return horizontal ? { height: otherAxisSize } : { width: otherAxisSize };
1695
+ }
1497
1696
  function useValueListener$(key, callback) {
1498
1697
  const ctx = useStateContext();
1499
1698
  React3.useLayoutEffect(() => {
@@ -1588,10 +1787,10 @@ function ScrollAdjust() {
1588
1787
  useValueListener$("scrollAdjustUserOffset", callback);
1589
1788
  return null;
1590
1789
  }
1591
- function SnapWrapper({ ScrollComponent, ...props }) {
1790
+ var SnapWrapper = React3__namespace.forwardRef(function SnapWrapperInner({ ScrollComponent, ...props }, ref) {
1592
1791
  const [snapToOffsets] = useArr$(["snapToOffsets"]);
1593
- return /* @__PURE__ */ React3__namespace.createElement(ScrollComponent, { ...props, snapToOffsets });
1594
- }
1792
+ return /* @__PURE__ */ React3__namespace.createElement(ScrollComponent, { ...props, ref, snapToOffsets });
1793
+ });
1595
1794
  function WebAnchoredEndSpace({ horizontal }) {
1596
1795
  const ctx = useStateContext();
1597
1796
  const [anchoredEndSpaceSize] = useArr$(["anchoredEndSpaceSize"]);
@@ -1608,15 +1807,6 @@ var LayoutView = ({ onLayoutChange, refView, children, ...rest }) => {
1608
1807
  useOnLayoutSync({ onLayoutChange, ref });
1609
1808
  return /* @__PURE__ */ React3__namespace.createElement("div", { ...rest, ref }, children);
1610
1809
  };
1611
- var getComponent = (Component) => {
1612
- if (React3__namespace.isValidElement(Component)) {
1613
- return Component;
1614
- }
1615
- if (Component) {
1616
- return /* @__PURE__ */ React3__namespace.createElement(Component, null);
1617
- }
1618
- return null;
1619
- };
1620
1810
 
1621
1811
  // src/components/ListComponent.tsx
1622
1812
  var ListComponent = typedMemo(function ListComponent2({
@@ -1649,6 +1839,12 @@ var ListComponent = typedMemo(function ListComponent2({
1649
1839
  }) {
1650
1840
  const ctx = useStateContext();
1651
1841
  const maintainVisibleContentPosition = ctx.state.props.maintainVisibleContentPosition;
1842
+ const [otherAxisSize = 0] = useArr$(["otherAxisSize"]);
1843
+ const autoOtherAxisStyle = getAutoOtherAxisStyle({
1844
+ horizontal,
1845
+ needsOtherAxisSize: ctx.state.needsOtherAxisSize,
1846
+ otherAxisSize
1847
+ });
1652
1848
  const ScrollComponent = React3.useMemo(() => {
1653
1849
  if (!renderScrollComponent) {
1654
1850
  return ListComponentScrollView;
@@ -1687,10 +1883,10 @@ var ListComponent = typedMemo(function ListComponent2({
1687
1883
  ...rest,
1688
1884
  ...ScrollComponent === ListComponentScrollView ? { useWindowScroll } : {},
1689
1885
  contentContainerStyle: [
1690
- contentContainerStyle,
1691
1886
  horizontal ? {
1692
1887
  height: "100%"
1693
- } : {}
1888
+ } : {},
1889
+ contentContainerStyle
1694
1890
  ],
1695
1891
  contentOffset: initialContentOffset !== void 0 ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
1696
1892
  horizontal,
@@ -1699,7 +1895,7 @@ var ListComponent = typedMemo(function ListComponent2({
1699
1895
  onScroll: onScroll2,
1700
1896
  ref: refScrollView,
1701
1897
  ScrollComponent: snapToIndices ? ScrollComponent : void 0,
1702
- style
1898
+ style: autoOtherAxisStyle ? [autoOtherAxisStyle, style] : style
1703
1899
  },
1704
1900
  /* @__PURE__ */ React3__namespace.createElement(ScrollAdjust, null),
1705
1901
  ListHeaderComponent && /* @__PURE__ */ React3__namespace.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
@@ -2416,7 +2612,8 @@ function doScrollTo(ctx, params) {
2416
2612
  }
2417
2613
  const isAnimated = !!animated;
2418
2614
  const isHorizontal = !!horizontal;
2419
- const left = isHorizontal ? offset : 0;
2615
+ const contentSize = isHorizontal ? getContentSize(ctx) : void 0;
2616
+ const left = isHorizontal ? toNativeHorizontalOffset(state, offset, contentSize) : 0;
2420
2617
  const top = isHorizontal ? 0 : offset;
2421
2618
  scroller.scrollTo({ animated: isAnimated, x: left, y: top });
2422
2619
  if (isAnimated) {
@@ -3477,7 +3674,14 @@ function handleInitialScrollLayoutReady(ctx) {
3477
3674
  }
3478
3675
  function initializeInitialScrollOnMount(ctx, options) {
3479
3676
  var _a3, _b;
3480
- const { dataLength, hasFooterComponent, initialContentOffset, initialScrollAtEnd, useBootstrapInitialScroll } = options;
3677
+ const {
3678
+ alwaysDispatchInitialScroll,
3679
+ dataLength,
3680
+ hasFooterComponent,
3681
+ initialContentOffset,
3682
+ initialScrollAtEnd,
3683
+ useBootstrapInitialScroll
3684
+ } = options;
3481
3685
  const state = ctx.state;
3482
3686
  const initialScroll = state.initialScroll;
3483
3687
  const resolvedInitialContentOffset = initialContentOffset != null ? initialContentOffset : 0;
@@ -3497,7 +3701,7 @@ function initializeInitialScrollOnMount(ctx, options) {
3497
3701
  return;
3498
3702
  }
3499
3703
  const hasPendingDataDependentInitialScroll = !!initialScroll && dataLength === 0 && !(resolvedInitialContentOffset === 0 && !initialScrollAtEnd);
3500
- if (!resolvedInitialContentOffset && !hasPendingDataDependentInitialScroll) {
3704
+ if (!alwaysDispatchInitialScroll && !resolvedInitialContentOffset && !hasPendingDataDependentInitialScroll) {
3501
3705
  if (initialScroll && !initialScrollAtEnd) {
3502
3706
  finishInitialScroll(ctx, {
3503
3707
  resolvedOffset: resolvedInitialContentOffset
@@ -3818,9 +4022,18 @@ function prepareMVCP(ctx, dataChanged) {
3818
4022
  }
3819
4023
  }
3820
4024
 
4025
+ // src/core/resetLayoutCachesForDataChange.ts
4026
+ function resetLayoutCachesForDataChange(state) {
4027
+ state.indexByKey.clear();
4028
+ state.idCache.length = 0;
4029
+ state.positions.length = 0;
4030
+ state.columns.length = 0;
4031
+ state.columnSpans.length = 0;
4032
+ }
4033
+
3821
4034
  // src/core/syncMountedContainer.ts
3822
4035
  function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3823
- var _a3, _b, _c, _d, _e, _f, _g, _h;
4036
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
3824
4037
  const state = ctx.state;
3825
4038
  const {
3826
4039
  columns,
@@ -3832,7 +4045,8 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3832
4045
  if (item === void 0) {
3833
4046
  return { didChangePosition: false, didRefreshData: false };
3834
4047
  }
3835
- const updateLayout = (_a3 = options == null ? void 0 : options.updateLayout) != null ? _a3 : true;
4048
+ const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
4049
+ const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
3836
4050
  let didChangePosition = false;
3837
4051
  let didRefreshData = false;
3838
4052
  if (updateLayout) {
@@ -3841,7 +4055,9 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3841
4055
  set$(ctx, `containerPosition${containerIndex}`, POSITION_OUT_OF_VIEW);
3842
4056
  return { didChangePosition: false, didRefreshData: false };
3843
4057
  }
3844
- const position = (positionValue || 0) - ((_b = options == null ? void 0 : options.scrollAdjustPending) != null ? _b : 0);
4058
+ const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
4059
+ const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
4060
+ const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
3845
4061
  const column = columns[itemIndex] || 1;
3846
4062
  const span = columnSpans[itemIndex] || 1;
3847
4063
  const prevPos = peek$(ctx, `containerPosition${containerIndex}`);
@@ -3860,15 +4076,15 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3860
4076
  }
3861
4077
  const prevData = peek$(ctx, `containerItemData${containerIndex}`);
3862
4078
  if (prevData !== item) {
3863
- 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;
3864
- const cachedComparison = (_e = pendingDataComparison == null ? void 0 : pendingDataComparison.byIndex[itemIndex]) != null ? _e : 0;
4079
+ 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;
4080
+ const cachedComparison = (_g = pendingDataComparison == null ? void 0 : pendingDataComparison.byIndex[itemIndex]) != null ? _g : 0;
3865
4081
  if (cachedComparison === 2) {
3866
4082
  set$(ctx, `containerItemData${containerIndex}`, item);
3867
4083
  didRefreshData = true;
3868
4084
  } else if (cachedComparison !== 1) {
3869
- const itemKey = (_g = (_f = peek$(ctx, `containerItemKey${containerIndex}`)) != null ? _f : state.idCache[itemIndex]) != null ? _g : getId(state, itemIndex);
4085
+ const nextItemKey = (_h = peek$(ctx, `containerItemKey${containerIndex}`)) != null ? _h : itemKey;
3870
4086
  const prevKey = keyExtractor == null ? void 0 : keyExtractor(prevData, itemIndex);
3871
- if (prevData === void 0 || !keyExtractor || prevKey !== itemKey) {
4087
+ if (prevData === void 0 || !keyExtractor || prevKey !== nextItemKey) {
3872
4088
  set$(ctx, `containerItemData${containerIndex}`, item);
3873
4089
  didRefreshData = true;
3874
4090
  } else if (!itemsAreEqual) {
@@ -3885,7 +4101,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
3885
4101
  };
3886
4102
  }
3887
4103
  }
3888
- if ((_h = state.pendingDataComparison) == null ? void 0 : _h.byIndex) {
4104
+ if ((_i = state.pendingDataComparison) == null ? void 0 : _i.byIndex) {
3889
4105
  state.pendingDataComparison.byIndex[itemIndex] = isEqual ? 1 : 2;
3890
4106
  }
3891
4107
  if (!isEqual) {
@@ -4050,11 +4266,13 @@ function updateSnapToOffsets(ctx) {
4050
4266
  const {
4051
4267
  props: { snapToIndices }
4052
4268
  } = state;
4269
+ const contentSize = state.props.horizontal ? getContentSize(ctx) : void 0;
4053
4270
  const snapToOffsets = Array(snapToIndices.length);
4054
4271
  for (let i = 0; i < snapToIndices.length; i++) {
4055
4272
  const idx = snapToIndices[i];
4056
4273
  getId(state, idx);
4057
- snapToOffsets[i] = state.positions[idx];
4274
+ const logicalOffset = state.positions[idx];
4275
+ snapToOffsets[i] = toNativeHorizontalOffset(state, logicalOffset, contentSize);
4058
4276
  }
4059
4277
  set$(ctx, "snapToOffsets", snapToOffsets);
4060
4278
  }
@@ -4663,7 +4881,6 @@ function calculateItemsInView(ctx, params = {}) {
4663
4881
  var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
4664
4882
  const {
4665
4883
  columns,
4666
- columnSpans,
4667
4884
  containerItemKeys,
4668
4885
  enableScrollForNextCalculateItemsInView,
4669
4886
  idCache,
@@ -4713,8 +4930,10 @@ function calculateItemsInView(ctx, params = {}) {
4713
4930
  let scrollTopBuffered = 0;
4714
4931
  let scrollBottom = 0;
4715
4932
  let scrollBottomBuffered = 0;
4933
+ let nativeScrollState = scrollState;
4716
4934
  const updateScroll2 = (nextScrollState) => {
4717
4935
  var _a4;
4936
+ nativeScrollState = nextScrollState;
4718
4937
  scrollAdjustPending = (_a4 = peek$(ctx, "scrollAdjustPending")) != null ? _a4 : 0;
4719
4938
  scrollAdjustPad = scrollAdjustPending - topPad;
4720
4939
  scroll = Math.round(nextScrollState + scrollExtra + scrollAdjustPad);
@@ -4726,9 +4945,17 @@ function calculateItemsInView(ctx, params = {}) {
4726
4945
  const previousStickyIndex = peek$(ctx, "activeStickyIndex");
4727
4946
  const currentStickyIdx = stickyIndicesArr.length > 0 ? findCurrentStickyIndex(stickyIndicesArr, scroll, state) : -1;
4728
4947
  const nextActiveStickyIndex = currentStickyIdx >= 0 ? stickyIndicesArr[currentStickyIdx] : -1;
4948
+ const stickyIndexDidChange = previousStickyIndex !== nextActiveStickyIndex;
4729
4949
  if (currentStickyIdx >= 0 || previousStickyIndex >= 0) {
4730
4950
  set$(ctx, "activeStickyIndex", nextActiveStickyIndex);
4731
4951
  }
4952
+ const shouldNotifyStickyHeaderChange = !!onStickyHeaderChange && stickyIndicesArr.length > 0 && stickyIndexDidChange;
4953
+ const finishCalculateItemsInView = shouldNotifyStickyHeaderChange ? () => {
4954
+ const item = data[nextActiveStickyIndex];
4955
+ if (item !== void 0) {
4956
+ onStickyHeaderChange == null ? void 0 : onStickyHeaderChange({ index: nextActiveStickyIndex, item });
4957
+ }
4958
+ } : void 0;
4732
4959
  let scrollBufferTop = drawDistance;
4733
4960
  let scrollBufferBottom = drawDistance;
4734
4961
  if (speed > 0 || speed === 0 && scroll < Math.max(50, drawDistance)) {
@@ -4739,8 +4966,10 @@ function calculateItemsInView(ctx, params = {}) {
4739
4966
  scrollBufferBottom = drawDistance * 0.5;
4740
4967
  }
4741
4968
  const updateScrollRange = () => {
4742
- scrollTopBuffered = scroll - scrollBufferTop;
4743
- scrollBottom = scroll + scrollLength + (scroll < 0 ? -scroll : 0);
4969
+ const scrollStart = Math.max(0, scroll);
4970
+ const overscrollBeforeContent = Math.max(0, -nativeScrollState);
4971
+ scrollTopBuffered = scrollStart - scrollBufferTop;
4972
+ scrollBottom = Math.max(scrollStart, scroll + scrollLength + overscrollBeforeContent);
4744
4973
  scrollBottomBuffered = scrollBottom + scrollBufferBottom;
4745
4974
  };
4746
4975
  updateScrollRange();
@@ -4750,17 +4979,14 @@ function calculateItemsInView(ctx, params = {}) {
4750
4979
  state.scrollForNextCalculateItemsInView = void 0;
4751
4980
  } else if ((top === null || scrollTopBuffered > top) && (bottom === null || scrollBottomBuffered < bottom)) {
4752
4981
  if (!isInMVCPActiveMode(state)) {
4982
+ finishCalculateItemsInView == null ? void 0 : finishCalculateItemsInView();
4753
4983
  return;
4754
4984
  }
4755
4985
  }
4756
4986
  }
4757
4987
  const checkMVCP = doMVCP && !suppressInitialScrollSideEffects ? prepareMVCP(ctx, dataChanged) : void 0;
4758
4988
  if (dataChanged) {
4759
- indexByKey.clear();
4760
- idCache.length = 0;
4761
- positions.length = 0;
4762
- columns.length = 0;
4763
- columnSpans.length = 0;
4989
+ resetLayoutCachesForDataChange(state);
4764
4990
  }
4765
4991
  const startIndex = forceFullItemPositions || dataChanged ? 0 : (_c = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _c : 0;
4766
4992
  const optimizeForVisibleWindow = !forceFullItemPositions && !dataChanged && numColumns > 1 && minIndexSizeChanged !== void 0;
@@ -5074,12 +5300,7 @@ function calculateItemsInView(ctx, params = {}) {
5074
5300
  );
5075
5301
  }
5076
5302
  }
5077
- if (onStickyHeaderChange && stickyIndicesArr.length > 0 && nextActiveStickyIndex !== void 0 && nextActiveStickyIndex !== previousStickyIndex) {
5078
- const item = data[nextActiveStickyIndex];
5079
- if (item !== void 0) {
5080
- onStickyHeaderChange({ index: nextActiveStickyIndex, item });
5081
- }
5082
- }
5303
+ finishCalculateItemsInView == null ? void 0 : finishCalculateItemsInView();
5083
5304
  });
5084
5305
  }
5085
5306
 
@@ -5107,11 +5328,22 @@ function doMaintainScrollAtEnd(ctx) {
5107
5328
  if (!state.maintainingScrollAtEnd) {
5108
5329
  state.maintainingScrollAtEnd = true;
5109
5330
  requestAnimationFrame(() => {
5110
- var _a3;
5111
5331
  if (peek$(ctx, "isWithinMaintainScrollAtEndThreshold")) {
5112
- (_a3 = refScroller.current) == null ? void 0 : _a3.scrollToEnd({
5113
- animated: maintainScrollAtEnd.animated
5114
- });
5332
+ const scroller = refScroller.current;
5333
+ if (state.props.horizontal && isHorizontalRTL(state)) {
5334
+ const currentContentSize = getContentSize(ctx);
5335
+ const logicalEndOffset = getLogicalHorizontalMaxOffset(state, currentContentSize);
5336
+ const nativeOffset = toNativeHorizontalOffset(state, logicalEndOffset, currentContentSize);
5337
+ scroller == null ? void 0 : scroller.scrollTo({
5338
+ animated: maintainScrollAtEnd.animated,
5339
+ x: nativeOffset,
5340
+ y: 0
5341
+ });
5342
+ } else {
5343
+ scroller == null ? void 0 : scroller.scrollToEnd({
5344
+ animated: maintainScrollAtEnd.animated
5345
+ });
5346
+ }
5115
5347
  setTimeout(
5116
5348
  () => {
5117
5349
  state.maintainingScrollAtEnd = false;
@@ -5311,7 +5543,8 @@ function handleLayout(ctx, layoutParam, setCanRender) {
5311
5543
  }
5312
5544
  checkThresholds(ctx);
5313
5545
  if (state) {
5314
- state.needsOtherAxisSize = otherAxisSize - (state.props.stylePaddingTop || 0) < 10;
5546
+ const crossAxisPadding = state.props.horizontal ? (state.props.stylePaddingTop || 0) + (state.props.stylePaddingBottom || 0) : (state.props.stylePaddingLeft || 0) + (state.props.stylePaddingRight || 0);
5547
+ state.needsOtherAxisSize = otherAxisSize - crossAxisPadding < 10;
5315
5548
  }
5316
5549
  if (IS_DEV && measuredLength === 0) {
5317
5550
  warnDevOnce(
@@ -5425,7 +5658,7 @@ function cloneScrollEvent(event) {
5425
5658
  };
5426
5659
  }
5427
5660
  function onScroll(ctx, event) {
5428
- var _a3, _b, _c, _d;
5661
+ var _a3, _b, _c, _d, _e;
5429
5662
  const state = ctx.state;
5430
5663
  const { scrollProcessingEnabled } = state;
5431
5664
  if (scrollProcessingEnabled === false) {
@@ -5444,6 +5677,9 @@ function onScroll(ctx, event) {
5444
5677
  }
5445
5678
  }
5446
5679
  let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
5680
+ if (state.props.horizontal) {
5681
+ newScroll = toLogicalHorizontalOffset(state, newScroll, (_e = event.nativeEvent.contentSize) == null ? void 0 : _e.width);
5682
+ }
5447
5683
  if (state.scrollingTo && state.scrollingTo.offset >= newScroll) {
5448
5684
  const maxOffset = clampScrollOffset(ctx, newScroll, state.scrollingTo);
5449
5685
  if (newScroll !== maxOffset && Math.abs(newScroll - maxOffset) > 1) {
@@ -5615,6 +5851,16 @@ function runOrScheduleMVCPRecalculate(ctx) {
5615
5851
  });
5616
5852
  }
5617
5853
  }
5854
+ function updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal) {
5855
+ const state = ctx.state;
5856
+ if (state.needsOtherAxisSize) {
5857
+ const otherAxisSize = horizontal ? sizeObj.height : sizeObj.width;
5858
+ const currentOtherAxisSize = peek$(ctx, "otherAxisSize");
5859
+ if (!currentOtherAxisSize || otherAxisSize > currentOtherAxisSize) {
5860
+ set$(ctx, "otherAxisSize", otherAxisSize);
5861
+ }
5862
+ }
5863
+ }
5618
5864
  function updateItemSize(ctx, itemKey, sizeObj) {
5619
5865
  var _a3;
5620
5866
  const state = ctx.state;
@@ -5638,13 +5884,13 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5638
5884
  const type = getItemType ? (_a3 = getItemType(itemData, index)) != null ? _a3 : "" : "";
5639
5885
  const size2 = getFixedItemSize(itemData, index, type);
5640
5886
  if (size2 !== void 0 && size2 === sizesKnown.get(itemKey)) {
5887
+ updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal);
5641
5888
  return;
5642
5889
  }
5643
5890
  }
5644
5891
  let needsRecalculate = !didContainersLayout;
5645
5892
  let shouldMaintainScrollAtEnd = false;
5646
5893
  let minIndexSizeChanged;
5647
- let maxOtherAxisSize = peek$(ctx, "otherAxisSize") || 0;
5648
5894
  const prevSizeKnown = state.sizesKnown.get(itemKey);
5649
5895
  const diff = updateOneItemSize(ctx, itemKey, sizeObj);
5650
5896
  const size = roundSize(horizontal ? sizeObj.width : sizeObj.height);
@@ -5655,10 +5901,6 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5655
5901
  if (!needsRecalculate && state.containerItemKeys.has(itemKey)) {
5656
5902
  needsRecalculate = true;
5657
5903
  }
5658
- if (state.needsOtherAxisSize) {
5659
- const otherAxisSize = horizontal ? sizeObj.height : sizeObj.width;
5660
- maxOtherAxisSize = Math.max(maxOtherAxisSize, otherAxisSize);
5661
- }
5662
5904
  if (prevSizeKnown !== void 0 && Math.abs(prevSizeKnown - size) > 5) {
5663
5905
  shouldMaintainScrollAtEnd = true;
5664
5906
  }
@@ -5674,10 +5916,7 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5674
5916
  if (minIndexSizeChanged !== void 0) {
5675
5917
  state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, minIndexSizeChanged) : minIndexSizeChanged;
5676
5918
  }
5677
- const cur = peek$(ctx, "otherAxisSize");
5678
- if (!cur || maxOtherAxisSize > cur) {
5679
- set$(ctx, "otherAxisSize", maxOtherAxisSize);
5680
- }
5919
+ updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal);
5681
5920
  if (didContainersLayout || checkAllSizesKnown(state, getMountedBufferedIndices(state))) {
5682
5921
  if (needsRecalculate) {
5683
5922
  state.scrollForNextCalculateItemsInView = void 0;
@@ -6252,7 +6491,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6252
6491
  getFixedItemSize,
6253
6492
  getItemType,
6254
6493
  horizontal,
6494
+ rtl,
6255
6495
  initialContainerPoolRatio = 3,
6496
+ estimatedHeaderSize,
6256
6497
  initialScrollAtEnd = false,
6257
6498
  initialScrollIndex: initialScrollIndexProp,
6258
6499
  initialScrollOffset: initialScrollOffsetProp,
@@ -6320,13 +6561,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6320
6561
  const style = { ...StyleSheet.flatten(styleProp) };
6321
6562
  const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
6322
6563
  const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
6564
+ const stylePaddingLeftState = extractPadding(style, contentContainerStyle, "Left");
6565
+ const stylePaddingRightState = extractPadding(style, contentContainerStyle, "Right");
6323
6566
  const maintainScrollAtEndConfig = normalizeMaintainScrollAtEnd(maintainScrollAtEnd);
6324
6567
  const maintainVisibleContentPositionConfig = normalizeMaintainVisibleContentPosition(
6325
6568
  maintainVisibleContentPositionProp
6326
6569
  );
6327
6570
  const hasInitialScrollIndex = initialScrollIndexProp !== void 0 && initialScrollIndexProp !== null;
6328
6571
  const hasInitialScrollOffset = initialScrollOffsetProp !== void 0 && initialScrollOffsetProp !== null;
6329
- const initialScrollUsesOffsetOnly = !initialScrollAtEnd && !hasInitialScrollIndex && hasInitialScrollOffset;
6572
+ const shouldInitializeHorizontalRTL = !initialScrollAtEnd && !hasInitialScrollIndex && !hasInitialScrollOffset && isHorizontalRTLProps({ horizontal, rtl });
6573
+ const initialScrollUsesOffsetOnly = !initialScrollAtEnd && !hasInitialScrollIndex && (hasInitialScrollOffset || shouldInitializeHorizontalRTL);
6330
6574
  const usesBootstrapInitialScroll = initialScrollAtEnd || hasInitialScrollIndex;
6331
6575
  const initialScrollProp = initialScrollAtEnd ? {
6332
6576
  index: Math.max(0, dataProp.length - 1),
@@ -6442,6 +6686,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6442
6686
  internalState.reprocessCurrentScroll = () => updateScroll(ctx, internalState.scroll, true);
6443
6687
  set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPositionConfig);
6444
6688
  set$(ctx, "extraData", extraData);
6689
+ if (estimatedHeaderSize !== void 0) {
6690
+ set$(ctx, "headerSize", estimatedHeaderSize);
6691
+ }
6445
6692
  }
6446
6693
  refState.current = ctx.state;
6447
6694
  }
@@ -6501,11 +6748,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6501
6748
  positionComponentInternal,
6502
6749
  recycleItems: !!recycleItems,
6503
6750
  renderItem,
6751
+ rtl,
6504
6752
  snapToIndices,
6505
6753
  stickyIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],
6506
6754
  stickyIndicesSet: React3.useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),
6507
6755
  stickyPositionComponentInternal,
6508
6756
  stylePaddingBottom: stylePaddingBottomState,
6757
+ stylePaddingLeft: stylePaddingLeftState,
6758
+ stylePaddingRight: stylePaddingRightState,
6509
6759
  stylePaddingTop: stylePaddingTopState,
6510
6760
  useWindowScroll: useWindowScrollResolved
6511
6761
  };
@@ -6528,6 +6778,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6528
6778
  };
6529
6779
  if (isFirstLocal) {
6530
6780
  initializeStateVars(false);
6781
+ resetLayoutCachesForDataChange(state);
6531
6782
  updateItemPositions(
6532
6783
  ctx,
6533
6784
  /*dataChanged*/
@@ -6545,6 +6796,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6545
6796
  }, [usesBootstrapInitialScroll]);
6546
6797
  React3.useLayoutEffect(() => {
6547
6798
  initializeInitialScrollOnMount(ctx, {
6799
+ alwaysDispatchInitialScroll: shouldInitializeHorizontalRTL,
6548
6800
  dataLength: dataProp.length,
6549
6801
  hasFooterComponent: !!ListFooterComponent,
6550
6802
  initialContentOffset,