@legendapp/list 3.0.0-beta.11 → 3.0.0-beta.13

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/section-list.js CHANGED
@@ -1071,7 +1071,6 @@ var ListComponent = typedMemo(function ListComponent2({
1071
1071
  getRenderedItem: getRenderedItem2,
1072
1072
  updateItemSize: updateItemSize2,
1073
1073
  refScrollView,
1074
- maintainVisibleContentPosition,
1075
1074
  renderScrollComponent,
1076
1075
  scrollAdjustHandler,
1077
1076
  onLayoutHeader,
@@ -1080,6 +1079,7 @@ var ListComponent = typedMemo(function ListComponent2({
1080
1079
  ...rest
1081
1080
  }) {
1082
1081
  const ctx = useStateContext();
1082
+ const maintainVisibleContentPosition = ctx.state.props.maintainVisibleContentPosition;
1083
1083
  const ScrollComponent = renderScrollComponent ? React3.useMemo(
1084
1084
  () => React3__namespace.forwardRef((props, ref) => renderScrollComponent({ ...props, ref })),
1085
1085
  [renderScrollComponent]
@@ -1097,7 +1097,7 @@ var ListComponent = typedMemo(function ListComponent2({
1097
1097
  ],
1098
1098
  contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
1099
1099
  horizontal,
1100
- maintainVisibleContentPosition: maintainVisibleContentPosition ? { minIndexForVisible: 0 } : void 0,
1100
+ maintainVisibleContentPosition: maintainVisibleContentPosition.scroll || maintainVisibleContentPosition.dataChanged ? { minIndexForVisible: 0 } : void 0,
1101
1101
  onLayout,
1102
1102
  onScroll: onScroll2,
1103
1103
  ref: refScrollView,
@@ -1641,14 +1641,16 @@ function requestAdjust(ctx, positionDiff, dataChanged) {
1641
1641
  function prepareMVCP(ctx, dataChanged) {
1642
1642
  const state = ctx.state;
1643
1643
  const { idsInView, positions, props } = state;
1644
- const { maintainVisibleContentPosition } = props;
1644
+ const {
1645
+ maintainVisibleContentPosition: { dataChanged: mvcpdataChanged, scroll: mvcpScroll }
1646
+ } = props;
1645
1647
  const scrollingTo = state.scrollingTo;
1646
1648
  let prevPosition;
1647
1649
  let targetId;
1648
1650
  const idsInViewWithPositions = [];
1649
1651
  const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
1650
1652
  const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
1651
- const shouldMVCP = !dataChanged || maintainVisibleContentPosition;
1653
+ const shouldMVCP = dataChanged ? mvcpdataChanged : mvcpScroll;
1652
1654
  const indexByKey = state.indexByKey;
1653
1655
  if (shouldMVCP) {
1654
1656
  if (scrollTarget !== void 0) {
@@ -1671,7 +1673,7 @@ function prepareMVCP(ctx, dataChanged) {
1671
1673
  }
1672
1674
  return () => {
1673
1675
  let positionDiff = 0;
1674
- if (dataChanged && targetId === void 0 && maintainVisibleContentPosition) {
1676
+ if (dataChanged && targetId === void 0 && mvcpdataChanged) {
1675
1677
  for (let i = 0; i < idsInViewWithPositions.length; i++) {
1676
1678
  const { id, position } = idsInViewWithPositions[i];
1677
1679
  const newPosition = positions.get(id);
@@ -1805,39 +1807,40 @@ function updateTotalSize(ctx) {
1805
1807
  // src/utils/getScrollVelocity.ts
1806
1808
  var getScrollVelocity = (state) => {
1807
1809
  const { scrollHistory } = state;
1808
- let velocity = 0;
1809
- if (scrollHistory.length >= 1) {
1810
- const newest = scrollHistory[scrollHistory.length - 1];
1811
- let oldest;
1812
- let start = 0;
1813
- const now = Date.now();
1814
- for (let i = 0; i < scrollHistory.length - 1; i++) {
1815
- const entry = scrollHistory[i];
1816
- const nextEntry = scrollHistory[i + 1];
1817
- if (i > 0) {
1818
- const prevEntry = scrollHistory[i - 1];
1819
- const prevDirection = entry.scroll - prevEntry.scroll;
1820
- const currentDirection = nextEntry.scroll - entry.scroll;
1821
- if (prevDirection > 0 && currentDirection < 0 || prevDirection < 0 && currentDirection > 0) {
1822
- start = i;
1823
- break;
1824
- }
1825
- }
1810
+ const newestIndex = scrollHistory.length - 1;
1811
+ if (newestIndex < 1) {
1812
+ return 0;
1813
+ }
1814
+ const newest = scrollHistory[newestIndex];
1815
+ const now = Date.now();
1816
+ let direction = 0;
1817
+ for (let i = newestIndex; i > 0; i--) {
1818
+ const delta = scrollHistory[i].scroll - scrollHistory[i - 1].scroll;
1819
+ if (delta !== 0) {
1820
+ direction = Math.sign(delta);
1821
+ break;
1826
1822
  }
1827
- for (let i = start; i < scrollHistory.length - 1; i++) {
1828
- const entry = scrollHistory[i];
1829
- if (now - entry.time <= 1e3) {
1830
- oldest = entry;
1831
- break;
1832
- }
1823
+ }
1824
+ if (direction === 0) {
1825
+ return 0;
1826
+ }
1827
+ let oldest = newest;
1828
+ for (let i = newestIndex - 1; i >= 0; i--) {
1829
+ const current = scrollHistory[i];
1830
+ const next = scrollHistory[i + 1];
1831
+ const delta = next.scroll - current.scroll;
1832
+ const deltaSign = Math.sign(delta);
1833
+ if (deltaSign !== 0 && deltaSign !== direction) {
1834
+ break;
1833
1835
  }
1834
- if (oldest && oldest !== newest) {
1835
- const scrollDiff = newest.scroll - oldest.scroll;
1836
- const timeDiff = newest.time - oldest.time;
1837
- velocity = timeDiff > 0 ? scrollDiff / timeDiff : 0;
1836
+ if (now - current.time > 1e3) {
1837
+ break;
1838
1838
  }
1839
+ oldest = current;
1839
1840
  }
1840
- return velocity;
1841
+ const scrollDiff = newest.scroll - oldest.scroll;
1842
+ const timeDiff = newest.time - oldest.time;
1843
+ return timeDiff > 0 ? scrollDiff / timeDiff : 0;
1841
1844
  };
1842
1845
 
1843
1846
  // src/utils/updateSnapToOffsets.ts
@@ -2767,7 +2770,7 @@ function checkFinishedScrollFrame(ctx) {
2767
2770
  if (scrollingTo) {
2768
2771
  const { state } = ctx;
2769
2772
  state.animFrameCheckFinishedScroll = void 0;
2770
- const scroll = state.scroll;
2773
+ const scroll = state.scrollPending;
2771
2774
  const adjust = state.scrollAdjustHandler.getAdjust();
2772
2775
  const clampedTargetOffset = clampScrollOffset(ctx, scrollingTo.offset - (scrollingTo.viewOffset || 0));
2773
2776
  const maxOffset = clampScrollOffset(ctx, scroll);
@@ -3022,7 +3025,6 @@ function onScroll(ctx, event) {
3022
3025
  return;
3023
3026
  }
3024
3027
  let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
3025
- state.scrollPending = newScroll;
3026
3028
  if (state.scrollingTo) {
3027
3029
  const maxOffset = clampScrollOffset(ctx, newScroll);
3028
3030
  if (newScroll !== maxOffset && Math.abs(newScroll - maxOffset) > 1) {
@@ -3036,8 +3038,11 @@ function onScroll(ctx, event) {
3036
3038
  return;
3037
3039
  }
3038
3040
  }
3041
+ state.scrollPending = newScroll;
3039
3042
  updateScroll(ctx, newScroll);
3040
- checkFinishedScroll(ctx);
3043
+ if (state.scrollingTo) {
3044
+ checkFinishedScroll(ctx);
3045
+ }
3041
3046
  onScrollProp == null ? void 0 : onScrollProp(event);
3042
3047
  }
3043
3048
 
@@ -3372,6 +3377,24 @@ function getRenderedItem(ctx, key) {
3372
3377
  }
3373
3378
  return { index, item: data[index], renderedItem };
3374
3379
  }
3380
+
3381
+ // src/utils/normalizeMaintainVisibleContentPosition.ts
3382
+ function normalizeMaintainVisibleContentPosition(value) {
3383
+ var _a3, _b;
3384
+ if (value === true) {
3385
+ return { dataChanged: true, scroll: true };
3386
+ }
3387
+ if (value && typeof value === "object") {
3388
+ return {
3389
+ dataChanged: (_a3 = value.dataChanged) != null ? _a3 : false,
3390
+ scroll: (_b = value.scroll) != null ? _b : true
3391
+ };
3392
+ }
3393
+ if (value === false) {
3394
+ return { dataChanged: false, scroll: false };
3395
+ }
3396
+ return { dataChanged: false, scroll: true };
3397
+ }
3375
3398
  function useThrottleDebounce(mode) {
3376
3399
  const timeoutRef = React3.useRef(null);
3377
3400
  const lastCallTimeRef = React3.useRef(0);
@@ -3466,7 +3489,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3466
3489
  ListHeaderComponent,
3467
3490
  maintainScrollAtEnd = false,
3468
3491
  maintainScrollAtEndThreshold = 0.1,
3469
- maintainVisibleContentPosition = false,
3492
+ maintainVisibleContentPosition: maintainVisibleContentPositionProp,
3470
3493
  numColumns: numColumnsProp = 1,
3471
3494
  onEndReached,
3472
3495
  onEndReachedThreshold = 0.5,
@@ -3504,6 +3527,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3504
3527
  const style = { ...StyleSheet.flatten(styleProp) };
3505
3528
  const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
3506
3529
  const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
3530
+ const maintainVisibleContentPositionConfig = normalizeMaintainVisibleContentPosition(
3531
+ maintainVisibleContentPositionProp
3532
+ );
3507
3533
  const [renderNum, setRenderNum] = React3.useState(0);
3508
3534
  const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? { index: initialScrollIndexProp.index || 0, viewOffset: initialScrollIndexProp.viewOffset || 0 } : { index: initialScrollIndexProp || 0, viewOffset: initialScrollOffsetProp || 0 } : void 0;
3509
3535
  const [canRender, setCanRender] = React3__namespace.useState(!IsNewArchitecture);
@@ -3588,7 +3614,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3588
3614
  };
3589
3615
  const internalState = ctx.state;
3590
3616
  internalState.triggerCalculateItemsInView = (params) => calculateItemsInView(ctx, params);
3591
- set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPosition);
3617
+ set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPositionConfig);
3592
3618
  set$(ctx, "extraData", extraData);
3593
3619
  }
3594
3620
  refState.current = ctx.state;
@@ -3619,7 +3645,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3619
3645
  keyExtractor,
3620
3646
  maintainScrollAtEnd,
3621
3647
  maintainScrollAtEndThreshold,
3622
- maintainVisibleContentPosition,
3648
+ maintainVisibleContentPosition: maintainVisibleContentPositionConfig,
3623
3649
  numColumns: numColumnsProp,
3624
3650
  onEndReached,
3625
3651
  onEndReachedThreshold,
@@ -3654,7 +3680,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3654
3680
  setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
3655
3681
  refState.current.props.stylePaddingBottom = stylePaddingBottomState;
3656
3682
  let paddingDiff = stylePaddingTopState - prevPaddingTop;
3657
- if (paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3683
+ if (maintainVisibleContentPositionConfig.scroll && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3658
3684
  if (state.scroll < 0) {
3659
3685
  paddingDiff += state.scroll;
3660
3686
  }
@@ -3689,7 +3715,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3689
3715
  value = 0;
3690
3716
  }
3691
3717
  if (!value) {
3692
- state.didFinishInitialScroll = true;
3718
+ setInitialRenderState(ctx, { didInitialScroll: true });
3693
3719
  }
3694
3720
  return value;
3695
3721
  }, [renderNum]);
@@ -3811,7 +3837,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3811
3837
  initialContentOffset,
3812
3838
  ListEmptyComponent: dataProp.length === 0 ? ListEmptyComponent : void 0,
3813
3839
  ListHeaderComponent,
3814
- maintainVisibleContentPosition,
3815
3840
  onLayout,
3816
3841
  onLayoutHeader,
3817
3842
  onMomentumScrollEnd: fns.onMomentumScrollEnd,
package/section-list.mjs CHANGED
@@ -1050,7 +1050,6 @@ var ListComponent = typedMemo(function ListComponent2({
1050
1050
  getRenderedItem: getRenderedItem2,
1051
1051
  updateItemSize: updateItemSize2,
1052
1052
  refScrollView,
1053
- maintainVisibleContentPosition,
1054
1053
  renderScrollComponent,
1055
1054
  scrollAdjustHandler,
1056
1055
  onLayoutHeader,
@@ -1059,6 +1058,7 @@ var ListComponent = typedMemo(function ListComponent2({
1059
1058
  ...rest
1060
1059
  }) {
1061
1060
  const ctx = useStateContext();
1061
+ const maintainVisibleContentPosition = ctx.state.props.maintainVisibleContentPosition;
1062
1062
  const ScrollComponent = renderScrollComponent ? useMemo(
1063
1063
  () => React3.forwardRef((props, ref) => renderScrollComponent({ ...props, ref })),
1064
1064
  [renderScrollComponent]
@@ -1076,7 +1076,7 @@ var ListComponent = typedMemo(function ListComponent2({
1076
1076
  ],
1077
1077
  contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
1078
1078
  horizontal,
1079
- maintainVisibleContentPosition: maintainVisibleContentPosition ? { minIndexForVisible: 0 } : void 0,
1079
+ maintainVisibleContentPosition: maintainVisibleContentPosition.scroll || maintainVisibleContentPosition.dataChanged ? { minIndexForVisible: 0 } : void 0,
1080
1080
  onLayout,
1081
1081
  onScroll: onScroll2,
1082
1082
  ref: refScrollView,
@@ -1620,14 +1620,16 @@ function requestAdjust(ctx, positionDiff, dataChanged) {
1620
1620
  function prepareMVCP(ctx, dataChanged) {
1621
1621
  const state = ctx.state;
1622
1622
  const { idsInView, positions, props } = state;
1623
- const { maintainVisibleContentPosition } = props;
1623
+ const {
1624
+ maintainVisibleContentPosition: { dataChanged: mvcpdataChanged, scroll: mvcpScroll }
1625
+ } = props;
1624
1626
  const scrollingTo = state.scrollingTo;
1625
1627
  let prevPosition;
1626
1628
  let targetId;
1627
1629
  const idsInViewWithPositions = [];
1628
1630
  const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
1629
1631
  const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
1630
- const shouldMVCP = !dataChanged || maintainVisibleContentPosition;
1632
+ const shouldMVCP = dataChanged ? mvcpdataChanged : mvcpScroll;
1631
1633
  const indexByKey = state.indexByKey;
1632
1634
  if (shouldMVCP) {
1633
1635
  if (scrollTarget !== void 0) {
@@ -1650,7 +1652,7 @@ function prepareMVCP(ctx, dataChanged) {
1650
1652
  }
1651
1653
  return () => {
1652
1654
  let positionDiff = 0;
1653
- if (dataChanged && targetId === void 0 && maintainVisibleContentPosition) {
1655
+ if (dataChanged && targetId === void 0 && mvcpdataChanged) {
1654
1656
  for (let i = 0; i < idsInViewWithPositions.length; i++) {
1655
1657
  const { id, position } = idsInViewWithPositions[i];
1656
1658
  const newPosition = positions.get(id);
@@ -1784,39 +1786,40 @@ function updateTotalSize(ctx) {
1784
1786
  // src/utils/getScrollVelocity.ts
1785
1787
  var getScrollVelocity = (state) => {
1786
1788
  const { scrollHistory } = state;
1787
- let velocity = 0;
1788
- if (scrollHistory.length >= 1) {
1789
- const newest = scrollHistory[scrollHistory.length - 1];
1790
- let oldest;
1791
- let start = 0;
1792
- const now = Date.now();
1793
- for (let i = 0; i < scrollHistory.length - 1; i++) {
1794
- const entry = scrollHistory[i];
1795
- const nextEntry = scrollHistory[i + 1];
1796
- if (i > 0) {
1797
- const prevEntry = scrollHistory[i - 1];
1798
- const prevDirection = entry.scroll - prevEntry.scroll;
1799
- const currentDirection = nextEntry.scroll - entry.scroll;
1800
- if (prevDirection > 0 && currentDirection < 0 || prevDirection < 0 && currentDirection > 0) {
1801
- start = i;
1802
- break;
1803
- }
1804
- }
1789
+ const newestIndex = scrollHistory.length - 1;
1790
+ if (newestIndex < 1) {
1791
+ return 0;
1792
+ }
1793
+ const newest = scrollHistory[newestIndex];
1794
+ const now = Date.now();
1795
+ let direction = 0;
1796
+ for (let i = newestIndex; i > 0; i--) {
1797
+ const delta = scrollHistory[i].scroll - scrollHistory[i - 1].scroll;
1798
+ if (delta !== 0) {
1799
+ direction = Math.sign(delta);
1800
+ break;
1805
1801
  }
1806
- for (let i = start; i < scrollHistory.length - 1; i++) {
1807
- const entry = scrollHistory[i];
1808
- if (now - entry.time <= 1e3) {
1809
- oldest = entry;
1810
- break;
1811
- }
1802
+ }
1803
+ if (direction === 0) {
1804
+ return 0;
1805
+ }
1806
+ let oldest = newest;
1807
+ for (let i = newestIndex - 1; i >= 0; i--) {
1808
+ const current = scrollHistory[i];
1809
+ const next = scrollHistory[i + 1];
1810
+ const delta = next.scroll - current.scroll;
1811
+ const deltaSign = Math.sign(delta);
1812
+ if (deltaSign !== 0 && deltaSign !== direction) {
1813
+ break;
1812
1814
  }
1813
- if (oldest && oldest !== newest) {
1814
- const scrollDiff = newest.scroll - oldest.scroll;
1815
- const timeDiff = newest.time - oldest.time;
1816
- velocity = timeDiff > 0 ? scrollDiff / timeDiff : 0;
1815
+ if (now - current.time > 1e3) {
1816
+ break;
1817
1817
  }
1818
+ oldest = current;
1818
1819
  }
1819
- return velocity;
1820
+ const scrollDiff = newest.scroll - oldest.scroll;
1821
+ const timeDiff = newest.time - oldest.time;
1822
+ return timeDiff > 0 ? scrollDiff / timeDiff : 0;
1820
1823
  };
1821
1824
 
1822
1825
  // src/utils/updateSnapToOffsets.ts
@@ -2746,7 +2749,7 @@ function checkFinishedScrollFrame(ctx) {
2746
2749
  if (scrollingTo) {
2747
2750
  const { state } = ctx;
2748
2751
  state.animFrameCheckFinishedScroll = void 0;
2749
- const scroll = state.scroll;
2752
+ const scroll = state.scrollPending;
2750
2753
  const adjust = state.scrollAdjustHandler.getAdjust();
2751
2754
  const clampedTargetOffset = clampScrollOffset(ctx, scrollingTo.offset - (scrollingTo.viewOffset || 0));
2752
2755
  const maxOffset = clampScrollOffset(ctx, scroll);
@@ -3001,7 +3004,6 @@ function onScroll(ctx, event) {
3001
3004
  return;
3002
3005
  }
3003
3006
  let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
3004
- state.scrollPending = newScroll;
3005
3007
  if (state.scrollingTo) {
3006
3008
  const maxOffset = clampScrollOffset(ctx, newScroll);
3007
3009
  if (newScroll !== maxOffset && Math.abs(newScroll - maxOffset) > 1) {
@@ -3015,8 +3017,11 @@ function onScroll(ctx, event) {
3015
3017
  return;
3016
3018
  }
3017
3019
  }
3020
+ state.scrollPending = newScroll;
3018
3021
  updateScroll(ctx, newScroll);
3019
- checkFinishedScroll(ctx);
3022
+ if (state.scrollingTo) {
3023
+ checkFinishedScroll(ctx);
3024
+ }
3020
3025
  onScrollProp == null ? void 0 : onScrollProp(event);
3021
3026
  }
3022
3027
 
@@ -3351,6 +3356,24 @@ function getRenderedItem(ctx, key) {
3351
3356
  }
3352
3357
  return { index, item: data[index], renderedItem };
3353
3358
  }
3359
+
3360
+ // src/utils/normalizeMaintainVisibleContentPosition.ts
3361
+ function normalizeMaintainVisibleContentPosition(value) {
3362
+ var _a3, _b;
3363
+ if (value === true) {
3364
+ return { dataChanged: true, scroll: true };
3365
+ }
3366
+ if (value && typeof value === "object") {
3367
+ return {
3368
+ dataChanged: (_a3 = value.dataChanged) != null ? _a3 : false,
3369
+ scroll: (_b = value.scroll) != null ? _b : true
3370
+ };
3371
+ }
3372
+ if (value === false) {
3373
+ return { dataChanged: false, scroll: false };
3374
+ }
3375
+ return { dataChanged: false, scroll: true };
3376
+ }
3354
3377
  function useThrottleDebounce(mode) {
3355
3378
  const timeoutRef = useRef(null);
3356
3379
  const lastCallTimeRef = useRef(0);
@@ -3445,7 +3468,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3445
3468
  ListHeaderComponent,
3446
3469
  maintainScrollAtEnd = false,
3447
3470
  maintainScrollAtEndThreshold = 0.1,
3448
- maintainVisibleContentPosition = false,
3471
+ maintainVisibleContentPosition: maintainVisibleContentPositionProp,
3449
3472
  numColumns: numColumnsProp = 1,
3450
3473
  onEndReached,
3451
3474
  onEndReachedThreshold = 0.5,
@@ -3483,6 +3506,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3483
3506
  const style = { ...StyleSheet.flatten(styleProp) };
3484
3507
  const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
3485
3508
  const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
3509
+ const maintainVisibleContentPositionConfig = normalizeMaintainVisibleContentPosition(
3510
+ maintainVisibleContentPositionProp
3511
+ );
3486
3512
  const [renderNum, setRenderNum] = useState(0);
3487
3513
  const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? { index: initialScrollIndexProp.index || 0, viewOffset: initialScrollIndexProp.viewOffset || 0 } : { index: initialScrollIndexProp || 0, viewOffset: initialScrollOffsetProp || 0 } : void 0;
3488
3514
  const [canRender, setCanRender] = React3.useState(!IsNewArchitecture);
@@ -3567,7 +3593,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3567
3593
  };
3568
3594
  const internalState = ctx.state;
3569
3595
  internalState.triggerCalculateItemsInView = (params) => calculateItemsInView(ctx, params);
3570
- set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPosition);
3596
+ set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPositionConfig);
3571
3597
  set$(ctx, "extraData", extraData);
3572
3598
  }
3573
3599
  refState.current = ctx.state;
@@ -3598,7 +3624,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3598
3624
  keyExtractor,
3599
3625
  maintainScrollAtEnd,
3600
3626
  maintainScrollAtEndThreshold,
3601
- maintainVisibleContentPosition,
3627
+ maintainVisibleContentPosition: maintainVisibleContentPositionConfig,
3602
3628
  numColumns: numColumnsProp,
3603
3629
  onEndReached,
3604
3630
  onEndReachedThreshold,
@@ -3633,7 +3659,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3633
3659
  setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
3634
3660
  refState.current.props.stylePaddingBottom = stylePaddingBottomState;
3635
3661
  let paddingDiff = stylePaddingTopState - prevPaddingTop;
3636
- if (paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3662
+ if (maintainVisibleContentPositionConfig.scroll && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3637
3663
  if (state.scroll < 0) {
3638
3664
  paddingDiff += state.scroll;
3639
3665
  }
@@ -3668,7 +3694,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3668
3694
  value = 0;
3669
3695
  }
3670
3696
  if (!value) {
3671
- state.didFinishInitialScroll = true;
3697
+ setInitialRenderState(ctx, { didInitialScroll: true });
3672
3698
  }
3673
3699
  return value;
3674
3700
  }, [renderNum]);
@@ -3790,7 +3816,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3790
3816
  initialContentOffset,
3791
3817
  ListEmptyComponent: dataProp.length === 0 ? ListEmptyComponent : void 0,
3792
3818
  ListHeaderComponent,
3793
- maintainVisibleContentPosition,
3794
3819
  onLayout,
3795
3820
  onLayoutHeader,
3796
3821
  onMomentumScrollEnd: fns.onMomentumScrollEnd,
@@ -1,7 +1,7 @@
1
1
  import * as react_native from 'react-native';
2
2
  import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
3
3
  import * as React from 'react';
4
- import { a as LegendListRef, L as LegendListProps } from './types-1Hgg1rTO.mjs';
4
+ import { a as LegendListRef, L as LegendListProps } from './types-BSoW8ni4.mjs';
5
5
  import 'react-native-reanimated';
6
6
 
7
7
  type SectionListSeparatorProps<ItemT, SectionT> = {
@@ -1,7 +1,7 @@
1
1
  import * as react_native from 'react-native';
2
2
  import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
3
3
  import * as React from 'react';
4
- import { a as LegendListRef, L as LegendListProps } from './types-1Hgg1rTO.js';
4
+ import { a as LegendListRef, L as LegendListProps } from './types-BSoW8ni4.js';
5
5
  import 'react-native-reanimated';
6
6
 
7
7
  type SectionListSeparatorProps<ItemT, SectionT> = {