@legendapp/list 2.0.4 → 2.0.5

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.
Files changed (4) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/index.js +290 -280
  3. package/index.mjs +234 -224
  4. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import * as React3 from 'react';
2
- import React3__default, { useReducer, useEffect, createContext, useRef, useState, useMemo, useLayoutEffect, useCallback, useImperativeHandle, forwardRef, memo, useContext } from 'react';
1
+ import * as React2 from 'react';
2
+ import React2__default, { useReducer, useEffect, createContext, useRef, useState, useMemo, useLayoutEffect, useCallback, useImperativeHandle, forwardRef, memo, useContext } from 'react';
3
3
  import { View, Text, Platform, Animated, StyleSheet, Dimensions, RefreshControl, unstable_batchedUpdates } from 'react-native';
4
4
  import { useSyncExternalStore } from 'use-sync-external-store/shim';
5
5
 
6
6
  // src/components/LegendList.tsx
7
- var ContextState = React3.createContext(null);
7
+ var ContextState = React2.createContext(null);
8
8
  function StateProvider({ children }) {
9
- const [value] = React3.useState(() => ({
9
+ const [value] = React2.useState(() => ({
10
10
  animatedScrollY: new Animated.Value(0),
11
11
  columnWrapperStyle: void 0,
12
12
  listeners: /* @__PURE__ */ new Map(),
@@ -24,10 +24,10 @@ function StateProvider({ children }) {
24
24
  ]),
25
25
  viewRefs: /* @__PURE__ */ new Map()
26
26
  }));
27
- return /* @__PURE__ */ React3.createElement(ContextState.Provider, { value }, children);
27
+ return /* @__PURE__ */ React2.createElement(ContextState.Provider, { value }, children);
28
28
  }
29
29
  function useStateContext() {
30
- return React3.useContext(ContextState);
30
+ return React2.useContext(ContextState);
31
31
  }
32
32
  function createSelectorFunctionsArr(ctx, signalNames) {
33
33
  let lastValues = [];
@@ -97,23 +97,23 @@ function getContentSize(ctx) {
97
97
  return headerSize + footerSize + totalSize + stylePaddingTop;
98
98
  }
99
99
  function useArr$(signalNames) {
100
- const ctx = React3.useContext(ContextState);
101
- const { subscribe, get } = React3.useMemo(() => createSelectorFunctionsArr(ctx, signalNames), [ctx, signalNames]);
100
+ const ctx = React2.useContext(ContextState);
101
+ const { subscribe, get } = React2.useMemo(() => createSelectorFunctionsArr(ctx, signalNames), [ctx, signalNames]);
102
102
  const value = useSyncExternalStore(subscribe, get);
103
103
  return value;
104
104
  }
105
105
  function useSelector$(signalName, selector) {
106
- const ctx = React3.useContext(ContextState);
107
- const { subscribe, get } = React3.useMemo(() => createSelectorFunctionsArr(ctx, [signalName]), [ctx, signalName]);
106
+ const ctx = React2.useContext(ContextState);
107
+ const { subscribe, get } = React2.useMemo(() => createSelectorFunctionsArr(ctx, [signalName]), [ctx, signalName]);
108
108
  const value = useSyncExternalStore(subscribe, () => selector(get()[0]));
109
109
  return value;
110
110
  }
111
111
 
112
112
  // src/components/DebugView.tsx
113
113
  var DebugRow = ({ children }) => {
114
- return /* @__PURE__ */ React3.createElement(View, { style: { alignItems: "center", flexDirection: "row", justifyContent: "space-between" } }, children);
114
+ return /* @__PURE__ */ React2.createElement(View, { style: { alignItems: "center", flexDirection: "row", justifyContent: "space-between" } }, children);
115
115
  };
116
- var DebugView = React3.memo(function DebugView2({ state }) {
116
+ var DebugView = React2.memo(function DebugView2({ state }) {
117
117
  const ctx = useStateContext();
118
118
  const [totalSize = 0, scrollAdjust = 0, rawScroll = 0, scroll = 0, _numContainers = 0, _numContainersPooled = 0] = useArr$([
119
119
  "totalSize",
@@ -128,7 +128,7 @@ var DebugView = React3.memo(function DebugView2({ state }) {
128
128
  useInterval(() => {
129
129
  forceUpdate();
130
130
  }, 100);
131
- return /* @__PURE__ */ React3.createElement(
131
+ return /* @__PURE__ */ React2.createElement(
132
132
  View,
133
133
  {
134
134
  pointerEvents: "none",
@@ -144,14 +144,14 @@ var DebugView = React3.memo(function DebugView2({ state }) {
144
144
  top: 0
145
145
  }
146
146
  },
147
- /* @__PURE__ */ React3.createElement(DebugRow, null, /* @__PURE__ */ React3.createElement(Text, null, "TotalSize:"), /* @__PURE__ */ React3.createElement(Text, null, totalSize.toFixed(2))),
148
- /* @__PURE__ */ React3.createElement(DebugRow, null, /* @__PURE__ */ React3.createElement(Text, null, "ContentSize:"), /* @__PURE__ */ React3.createElement(Text, null, contentSize.toFixed(2))),
149
- /* @__PURE__ */ React3.createElement(DebugRow, null, /* @__PURE__ */ React3.createElement(Text, null, "At end:"), /* @__PURE__ */ React3.createElement(Text, null, String(state.isAtEnd))),
150
- /* @__PURE__ */ React3.createElement(Text, null),
151
- /* @__PURE__ */ React3.createElement(DebugRow, null, /* @__PURE__ */ React3.createElement(Text, null, "ScrollAdjust:"), /* @__PURE__ */ React3.createElement(Text, null, scrollAdjust.toFixed(2))),
152
- /* @__PURE__ */ React3.createElement(Text, null),
153
- /* @__PURE__ */ React3.createElement(DebugRow, null, /* @__PURE__ */ React3.createElement(Text, null, "RawScroll: "), /* @__PURE__ */ React3.createElement(Text, null, rawScroll.toFixed(2))),
154
- /* @__PURE__ */ React3.createElement(DebugRow, null, /* @__PURE__ */ React3.createElement(Text, null, "ComputedScroll: "), /* @__PURE__ */ React3.createElement(Text, null, scroll.toFixed(2)))
147
+ /* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "TotalSize:"), /* @__PURE__ */ React2.createElement(Text, null, totalSize.toFixed(2))),
148
+ /* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "ContentSize:"), /* @__PURE__ */ React2.createElement(Text, null, contentSize.toFixed(2))),
149
+ /* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "At end:"), /* @__PURE__ */ React2.createElement(Text, null, String(state.isAtEnd))),
150
+ /* @__PURE__ */ React2.createElement(Text, null),
151
+ /* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "ScrollAdjust:"), /* @__PURE__ */ React2.createElement(Text, null, scrollAdjust.toFixed(2))),
152
+ /* @__PURE__ */ React2.createElement(Text, null),
153
+ /* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "RawScroll: "), /* @__PURE__ */ React2.createElement(Text, null, rawScroll.toFixed(2))),
154
+ /* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "ComputedScroll: "), /* @__PURE__ */ React2.createElement(Text, null, scroll.toFixed(2)))
155
155
  );
156
156
  });
157
157
  function useInterval(callback, delay) {
@@ -160,8 +160,8 @@ function useInterval(callback, delay) {
160
160
  return () => clearInterval(interval);
161
161
  }, [delay]);
162
162
  }
163
- var LeanViewComponent = React3.forwardRef((props, ref) => {
164
- return React3.createElement("RCTView", { ...props, ref });
163
+ var LeanViewComponent = React2.forwardRef((props, ref) => {
164
+ return React2.createElement("RCTView", { ...props, ref });
165
165
  });
166
166
  LeanViewComponent.displayName = "RCTView";
167
167
  var LeanView = Platform.OS === "android" || Platform.OS === "ios" ? LeanViewComponent : View;
@@ -223,7 +223,7 @@ var PositionViewState = typedMemo(function PositionView({
223
223
  ...rest
224
224
  }) {
225
225
  const [position = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);
226
- return /* @__PURE__ */ React3.createElement(
226
+ return /* @__PURE__ */ React2.createElement(
227
227
  LeanView,
228
228
  {
229
229
  ref: refView,
@@ -245,7 +245,7 @@ var PositionViewAnimated = typedMemo(function PositionView2({
245
245
  const position$ = useValue$(`containerPosition${id}`, {
246
246
  getValue: (v) => v != null ? v : POSITION_OUT_OF_VIEW
247
247
  });
248
- return /* @__PURE__ */ React3.createElement(
248
+ return /* @__PURE__ */ React2.createElement(
249
249
  Animated.View,
250
250
  {
251
251
  ref: refView,
@@ -268,7 +268,7 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
268
268
  ...rest
269
269
  }) {
270
270
  const [position = POSITION_OUT_OF_VIEW, headerSize] = useArr$([`containerPosition${id}`, "headerSize"]);
271
- const transform = React3.useMemo(() => {
271
+ const transform = React2.useMemo(() => {
272
272
  if (animatedScrollY && stickyOffset) {
273
273
  const stickyPosition = animatedScrollY.interpolate({
274
274
  extrapolate: "clamp",
@@ -278,15 +278,10 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
278
278
  return horizontal ? [{ translateX: stickyPosition }] : [{ translateY: stickyPosition }];
279
279
  }
280
280
  }, [animatedScrollY, headerSize, horizontal, stickyOffset, position]);
281
- const viewStyle = React3.useMemo(() => [style, { zIndex: index + 1e3 }, { transform }], [style, transform]);
282
- return /* @__PURE__ */ React3.createElement(Animated.View, { ref: refView, style: viewStyle, ...rest });
281
+ const viewStyle = React2.useMemo(() => [style, { zIndex: index + 1e3 }, { transform }], [style, transform]);
282
+ return /* @__PURE__ */ React2.createElement(Animated.View, { ref: refView, style: viewStyle, ...rest });
283
283
  });
284
284
  var PositionView3 = IsNewArchitecture ? PositionViewState : PositionViewAnimated;
285
- function Separator({ ItemSeparatorComponent, itemKey, leadingItem }) {
286
- const [lastItemKeys] = useArr$(["lastItemKeys"]);
287
- const isALastItem = lastItemKeys.includes(itemKey);
288
- return isALastItem ? null : /* @__PURE__ */ React3.createElement(ItemSeparatorComponent, { leadingItem });
289
- }
290
285
  var symbolFirst = Symbol();
291
286
  function useInit(cb) {
292
287
  const refValue = useRef(symbolFirst);
@@ -434,6 +429,12 @@ function useSyncLayout() {
434
429
  }
435
430
  }
436
431
 
432
+ // src/components/Separator.tsx
433
+ function Separator({ ItemSeparatorComponent, leadingItem }) {
434
+ const isLastItem = useIsLastItem();
435
+ return isLastItem ? null : /* @__PURE__ */ React2.createElement(ItemSeparatorComponent, { leadingItem });
436
+ }
437
+
437
438
  // src/components/Container.tsx
438
439
  var Container = typedMemo(function Container2({
439
440
  id,
@@ -557,7 +558,7 @@ var Container = typedMemo(function Container2({
557
558
  }, [itemKey]);
558
559
  }
559
560
  const PositionComponent = isSticky ? PositionViewSticky : PositionView3;
560
- return /* @__PURE__ */ React3.createElement(
561
+ return /* @__PURE__ */ React2.createElement(
561
562
  PositionComponent,
562
563
  {
563
564
  animatedScrollY: isSticky ? animatedScrollY : void 0,
@@ -570,14 +571,7 @@ var Container = typedMemo(function Container2({
570
571
  stickyOffset: isSticky ? stickyOffset : void 0,
571
572
  style
572
573
  },
573
- /* @__PURE__ */ React3.createElement(ContextContainer.Provider, { value: contextValue }, renderedItem, renderedItemInfo && ItemSeparatorComponent && /* @__PURE__ */ React3.createElement(
574
- Separator,
575
- {
576
- ItemSeparatorComponent,
577
- itemKey,
578
- leadingItem: renderedItemInfo.item
579
- }
580
- ))
574
+ /* @__PURE__ */ React2.createElement(ContextContainer.Provider, { value: contextValue }, renderedItem, renderedItemInfo && ItemSeparatorComponent && /* @__PURE__ */ React2.createElement(Separator, { ItemSeparatorComponent, leadingItem: renderedItemInfo.item }))
581
575
  );
582
576
  });
583
577
 
@@ -602,7 +596,7 @@ var Containers = typedMemo(function Containers2({
602
596
  const containers = [];
603
597
  for (let i = 0; i < numContainers; i++) {
604
598
  containers.push(
605
- /* @__PURE__ */ React3.createElement(
599
+ /* @__PURE__ */ React2.createElement(
606
600
  Container,
607
601
  {
608
602
  getRenderedItem: getRenderedItem2,
@@ -637,13 +631,13 @@ var Containers = typedMemo(function Containers2({
637
631
  }
638
632
  }
639
633
  }
640
- return /* @__PURE__ */ React3.createElement(Animated.View, { style }, containers);
634
+ return /* @__PURE__ */ React2.createElement(Animated.View, { style }, containers);
641
635
  });
642
636
  function ScrollAdjust() {
643
637
  const bias = 1e7;
644
638
  const [scrollAdjust, scrollAdjustUserOffset] = useArr$(["scrollAdjust", "scrollAdjustUserOffset"]);
645
639
  const scrollOffset = (scrollAdjust || 0) + (scrollAdjustUserOffset || 0) + bias;
646
- return /* @__PURE__ */ React3.createElement(
640
+ return /* @__PURE__ */ React2.createElement(
647
641
  View,
648
642
  {
649
643
  style: {
@@ -656,11 +650,9 @@ function ScrollAdjust() {
656
650
  }
657
651
  );
658
652
  }
659
-
660
- // src/components/SnapWrapper.tsx
661
653
  function SnapWrapper({ ScrollComponent, ...props }) {
662
654
  const [snapToOffsets] = useArr$(["snapToOffsets"]);
663
- return /* @__PURE__ */ React.createElement(ScrollComponent, { ...props, snapToOffsets });
655
+ return /* @__PURE__ */ React2__default.createElement(ScrollComponent, { ...props, snapToOffsets });
664
656
  }
665
657
  function useThrottleDebounce(mode) {
666
658
  const timeoutRef = useRef(null);
@@ -727,21 +719,21 @@ function useSyncLayout2({
727
719
 
728
720
  // src/components/ListComponent.tsx
729
721
  var getComponent = (Component) => {
730
- if (React3.isValidElement(Component)) {
722
+ if (React2.isValidElement(Component)) {
731
723
  return Component;
732
724
  }
733
725
  if (Component) {
734
- return /* @__PURE__ */ React3.createElement(Component, null);
726
+ return /* @__PURE__ */ React2.createElement(Component, null);
735
727
  }
736
728
  return null;
737
729
  };
738
730
  var Padding = () => {
739
731
  const animPaddingTop = useValue$("alignItemsPaddingTop", { delay: 0 });
740
- return /* @__PURE__ */ React3.createElement(Animated.View, { style: { paddingTop: animPaddingTop } });
732
+ return /* @__PURE__ */ React2.createElement(Animated.View, { style: { paddingTop: animPaddingTop } });
741
733
  };
742
734
  var PaddingDevMode = () => {
743
735
  const animPaddingTop = useValue$("alignItemsPaddingTop", { delay: 0 });
744
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(Animated.View, { style: { paddingTop: animPaddingTop } }), /* @__PURE__ */ React3.createElement(
736
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Animated.View, { style: { paddingTop: animPaddingTop } }), /* @__PURE__ */ React2.createElement(
745
737
  Animated.View,
746
738
  {
747
739
  style: {
@@ -788,10 +780,10 @@ var ListComponent = typedMemo(function ListComponent2({
788
780
  onChange: onLayoutHeader
789
781
  });
790
782
  const ScrollComponent = renderScrollComponent ? useMemo(
791
- () => React3.forwardRef((props, ref) => renderScrollComponent({ ...props, ref })),
783
+ () => React2.forwardRef((props, ref) => renderScrollComponent({ ...props, ref })),
792
784
  [renderScrollComponent]
793
785
  ) : Animated.ScrollView;
794
- React3.useEffect(() => {
786
+ React2.useEffect(() => {
795
787
  if (canRender) {
796
788
  setTimeout(() => {
797
789
  scrollAdjustHandler.setMounted();
@@ -799,7 +791,7 @@ var ListComponent = typedMemo(function ListComponent2({
799
791
  }
800
792
  }, [canRender]);
801
793
  const SnapOrScroll = snapToIndices ? SnapWrapper : ScrollComponent;
802
- return /* @__PURE__ */ React3.createElement(
794
+ return /* @__PURE__ */ React2.createElement(
803
795
  SnapOrScroll,
804
796
  {
805
797
  ...rest,
@@ -818,11 +810,11 @@ var ListComponent = typedMemo(function ListComponent2({
818
810
  ScrollComponent: snapToIndices ? ScrollComponent : void 0,
819
811
  style
820
812
  },
821
- maintainVisibleContentPosition && /* @__PURE__ */ React3.createElement(ScrollAdjust, null),
822
- ENABLE_DEVMODE ? /* @__PURE__ */ React3.createElement(PaddingDevMode, null) : /* @__PURE__ */ React3.createElement(Padding, null),
823
- ListHeaderComponent && /* @__PURE__ */ React3.createElement(View, { onLayout: onLayoutHeaderSync, ref: refHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
813
+ maintainVisibleContentPosition && /* @__PURE__ */ React2.createElement(ScrollAdjust, null),
814
+ ENABLE_DEVMODE ? /* @__PURE__ */ React2.createElement(PaddingDevMode, null) : /* @__PURE__ */ React2.createElement(Padding, null),
815
+ ListHeaderComponent && /* @__PURE__ */ React2.createElement(View, { onLayout: onLayoutHeaderSync, ref: refHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
824
816
  ListEmptyComponent && getComponent(ListEmptyComponent),
825
- canRender && /* @__PURE__ */ React3.createElement(
817
+ canRender && /* @__PURE__ */ React2.createElement(
826
818
  Containers,
827
819
  {
828
820
  getRenderedItem: getRenderedItem2,
@@ -833,7 +825,7 @@ var ListComponent = typedMemo(function ListComponent2({
833
825
  waitForInitialLayout
834
826
  }
835
827
  ),
836
- ListFooterComponent && /* @__PURE__ */ React3.createElement(
828
+ ListFooterComponent && /* @__PURE__ */ React2.createElement(
837
829
  View,
838
830
  {
839
831
  onLayout: (event) => {
@@ -844,11 +836,11 @@ var ListComponent = typedMemo(function ListComponent2({
844
836
  },
845
837
  getComponent(ListFooterComponent)
846
838
  ),
847
- __DEV__ && ENABLE_DEVMODE && /* @__PURE__ */ React3.createElement(DevNumbers, null)
839
+ __DEV__ && ENABLE_DEVMODE && /* @__PURE__ */ React2.createElement(DevNumbers, null)
848
840
  );
849
841
  });
850
- var DevNumbers = __DEV__ && React3.memo(function DevNumbers2() {
851
- return Array.from({ length: 100 }).map((_, index) => /* @__PURE__ */ React3.createElement(
842
+ var DevNumbers = __DEV__ && React2.memo(function DevNumbers2() {
843
+ return Array.from({ length: 100 }).map((_, index) => /* @__PURE__ */ React2.createElement(
852
844
  View,
853
845
  {
854
846
  key: index,
@@ -860,7 +852,7 @@ var DevNumbers = __DEV__ && React3.memo(function DevNumbers2() {
860
852
  width: "100%"
861
853
  }
862
854
  },
863
- /* @__PURE__ */ React3.createElement(Text, { style: { color: "red" } }, index * 100)
855
+ /* @__PURE__ */ React2.createElement(Text, { style: { color: "red" } }, index * 100)
864
856
  ));
865
857
  });
866
858
 
@@ -1139,12 +1131,14 @@ function updateTotalSize(ctx, state) {
1139
1131
  }
1140
1132
  function addTotalSize(ctx, state, key, add) {
1141
1133
  const { alignItemsAtEnd } = state.props;
1142
- {
1134
+ if (key === null) {
1143
1135
  state.totalSize = add;
1144
1136
  if (state.timeoutSetPaddingTop) {
1145
1137
  clearTimeout(state.timeoutSetPaddingTop);
1146
1138
  state.timeoutSetPaddingTop = void 0;
1147
1139
  }
1140
+ } else {
1141
+ state.totalSize += add;
1148
1142
  }
1149
1143
  set$(ctx, "totalSize", state.totalSize);
1150
1144
  if (alignItemsAtEnd) {
@@ -1167,8 +1161,8 @@ function updateSnapToOffsets(ctx, state) {
1167
1161
  set$(ctx, "snapToOffsets", snapToOffsets);
1168
1162
  }
1169
1163
 
1170
- // src/core/updateAllPositions.ts
1171
- function updateAllPositions(ctx, state, dataChanged, startIndex = 0) {
1164
+ // src/core/updateItemPositions.ts
1165
+ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered } = { scrollBottomBuffered: -1, startIndex: 0 }) {
1172
1166
  var _a, _b, _c, _d, _e, _f;
1173
1167
  const {
1174
1168
  columns,
@@ -1181,6 +1175,7 @@ function updateAllPositions(ctx, state, dataChanged, startIndex = 0) {
1181
1175
  const data = state.props.data;
1182
1176
  const numColumns = peek$(ctx, "numColumns");
1183
1177
  const indexByKeyForChecking = __DEV__ ? /* @__PURE__ */ new Map() : void 0;
1178
+ const maxVisibleArea = scrollBottomBuffered + 1e3;
1184
1179
  const useAverageSize = enableAverages && !getEstimatedItemSize;
1185
1180
  let currentRowTop = 0;
1186
1181
  let column = 1;
@@ -1200,8 +1195,13 @@ function updateAllPositions(ctx, state, dataChanged, startIndex = 0) {
1200
1195
  }
1201
1196
  }
1202
1197
  const needsIndexByKey = dataChanged || indexByKey.size === 0;
1198
+ let didBreakEarly = false;
1203
1199
  const dataLength = data.length;
1204
1200
  for (let i = startIndex; i < dataLength; i++) {
1201
+ if (!dataChanged && currentRowTop > maxVisibleArea) {
1202
+ didBreakEarly = true;
1203
+ break;
1204
+ }
1205
1205
  const id = (_e = idCache.get(i)) != null ? _e : getId(state, i);
1206
1206
  const size = (_f = sizesKnown.get(id)) != null ? _f : getItemSize(state, id, i, data[i], useAverageSize);
1207
1207
  if (__DEV__ && needsIndexByKey) {
@@ -1231,7 +1231,9 @@ function updateAllPositions(ctx, state, dataChanged, startIndex = 0) {
1231
1231
  currentRowTop += size;
1232
1232
  }
1233
1233
  }
1234
- updateTotalSize(ctx, state);
1234
+ if (!didBreakEarly) {
1235
+ updateTotalSize(ctx, state);
1236
+ }
1235
1237
  if (snapToIndices) {
1236
1238
  updateSnapToOffsets(ctx, state);
1237
1239
  }
@@ -1781,7 +1783,7 @@ function handleStickyRecycling(ctx, state, stickyArray, scroll, scrollBuffer, pe
1781
1783
  }
1782
1784
  function calculateItemsInView(ctx, state, params = {}) {
1783
1785
  batchedUpdates(() => {
1784
- var _a, _b, _c, _d, _e, _f, _g, _h;
1786
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1785
1787
  const {
1786
1788
  columns,
1787
1789
  containerItemKeys,
@@ -1810,20 +1812,6 @@ function calculateItemsInView(ctx, state, params = {}) {
1810
1812
  const previousScrollAdjust = 0;
1811
1813
  const { dataChanged, doMVCP } = params;
1812
1814
  const speed = getScrollVelocity(state);
1813
- if (doMVCP || dataChanged) {
1814
- const checkMVCP = doMVCP ? prepareMVCP(ctx, state, dataChanged) : void 0;
1815
- if (dataChanged) {
1816
- indexByKey.clear();
1817
- idCache.clear();
1818
- positions.clear();
1819
- }
1820
- const startIndex = dataChanged ? 0 : minIndexSizeChanged != null ? minIndexSizeChanged : 0;
1821
- updateAllPositions(ctx, state, dataChanged, startIndex);
1822
- if (minIndexSizeChanged !== void 0) {
1823
- state.minIndexSizeChanged = void 0;
1824
- }
1825
- checkMVCP == null ? void 0 : checkMVCP();
1826
- }
1827
1815
  const scrollExtra = 0;
1828
1816
  const { queuedInitialLayout } = state;
1829
1817
  let { scroll: scrollState } = state;
@@ -1862,6 +1850,18 @@ function calculateItemsInView(ctx, state, params = {}) {
1862
1850
  return;
1863
1851
  }
1864
1852
  }
1853
+ const checkMVCP = doMVCP ? prepareMVCP(ctx, state, dataChanged) : void 0;
1854
+ if (dataChanged) {
1855
+ indexByKey.clear();
1856
+ idCache.clear();
1857
+ positions.clear();
1858
+ }
1859
+ const startIndex = dataChanged ? 0 : (_a = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _a : 0;
1860
+ updateItemPositions(ctx, state, dataChanged, { scrollBottomBuffered, startIndex });
1861
+ if (minIndexSizeChanged !== void 0) {
1862
+ state.minIndexSizeChanged = void 0;
1863
+ }
1864
+ checkMVCP == null ? void 0 : checkMVCP();
1865
1865
  let startNoBuffer = null;
1866
1866
  let startBuffered = null;
1867
1867
  let startBufferedId = null;
@@ -1869,9 +1869,9 @@ function calculateItemsInView(ctx, state, params = {}) {
1869
1869
  let endBuffered = null;
1870
1870
  let loopStart = startBufferedIdOrig ? indexByKey.get(startBufferedIdOrig) || 0 : 0;
1871
1871
  for (let i = loopStart; i >= 0; i--) {
1872
- const id = (_a = idCache.get(i)) != null ? _a : getId(state, i);
1872
+ const id = (_b = idCache.get(i)) != null ? _b : getId(state, i);
1873
1873
  const top = positions.get(id);
1874
- const size = (_b = sizes.get(id)) != null ? _b : getItemSize(state, id, i, data[i]);
1874
+ const size = (_c = sizes.get(id)) != null ? _c : getItemSize(state, id, i, data[i]);
1875
1875
  const bottom = top + size;
1876
1876
  if (bottom > scroll - scrollBuffer) {
1877
1877
  loopStart = i;
@@ -1897,8 +1897,8 @@ function calculateItemsInView(ctx, state, params = {}) {
1897
1897
  let firstFullyOnScreenIndex;
1898
1898
  const dataLength = data.length;
1899
1899
  for (let i = Math.max(0, loopStart); i < dataLength && (!foundEnd || i <= maxIndexRendered); i++) {
1900
- const id = (_c = idCache.get(i)) != null ? _c : getId(state, i);
1901
- const size = (_d = sizes.get(id)) != null ? _d : getItemSize(state, id, i, data[i]);
1900
+ const id = (_d = idCache.get(i)) != null ? _d : getId(state, i);
1901
+ const size = (_e = sizes.get(id)) != null ? _e : getItemSize(state, id, i, data[i]);
1902
1902
  const top = positions.get(id);
1903
1903
  if (!foundEnd) {
1904
1904
  if (startNoBuffer === null && top + size > scroll) {
@@ -1927,7 +1927,7 @@ function calculateItemsInView(ctx, state, params = {}) {
1927
1927
  }
1928
1928
  const idsInView = [];
1929
1929
  for (let i = firstFullyOnScreenIndex; i <= endNoBuffer; i++) {
1930
- const id = (_e = idCache.get(i)) != null ? _e : getId(state, i);
1930
+ const id = (_f = idCache.get(i)) != null ? _f : getId(state, i);
1931
1931
  idsInView.push(id);
1932
1932
  }
1933
1933
  Object.assign(state, {
@@ -1959,7 +1959,7 @@ function calculateItemsInView(ctx, state, params = {}) {
1959
1959
  let numContainers2 = prevNumContainers;
1960
1960
  const needNewContainers = [];
1961
1961
  for (let i = startBuffered; i <= endBuffered; i++) {
1962
- const id = (_f = idCache.get(i)) != null ? _f : getId(state, i);
1962
+ const id = (_g = idCache.get(i)) != null ? _g : getId(state, i);
1963
1963
  if (!containerItemKeys.has(id)) {
1964
1964
  needNewContainers.push(i);
1965
1965
  }
@@ -1996,7 +1996,7 @@ function calculateItemsInView(ctx, state, params = {}) {
1996
1996
  for (let idx = 0; idx < needNewContainers.length; idx++) {
1997
1997
  const i = needNewContainers[idx];
1998
1998
  const containerIndex = availableContainers[idx];
1999
- const id = (_g = idCache.get(i)) != null ? _g : getId(state, i);
1999
+ const id = (_h = idCache.get(i)) != null ? _h : getId(state, i);
2000
2000
  const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
2001
2001
  if (oldKey && oldKey !== id) {
2002
2002
  containerItemKeys.delete(oldKey);
@@ -2051,7 +2051,7 @@ function calculateItemsInView(ctx, state, params = {}) {
2051
2051
  const itemIndex = indexByKey.get(itemKey);
2052
2052
  const item = data[itemIndex];
2053
2053
  if (item !== void 0) {
2054
- const id = (_h = idCache.get(itemIndex)) != null ? _h : getId(state, itemIndex);
2054
+ const id = (_i = idCache.get(itemIndex)) != null ? _i : getId(state, itemIndex);
2055
2055
  const position = positions.get(id);
2056
2056
  if (position === void 0) {
2057
2057
  set$(ctx, `containerPosition${i}`, POSITION_OUT_OF_VIEW);
@@ -2067,7 +2067,7 @@ function calculateItemsInView(ctx, state, params = {}) {
2067
2067
  set$(ctx, `containerColumn${i}`, column);
2068
2068
  }
2069
2069
  if (prevData !== item && (itemsAreEqual ? !itemsAreEqual(prevData, item, itemIndex, data) : true)) {
2070
- set$(ctx, `containerItemData${i}`, data[itemIndex]);
2070
+ set$(ctx, `containerItemData${i}`, item);
2071
2071
  }
2072
2072
  }
2073
2073
  }
@@ -2084,55 +2084,6 @@ function calculateItemsInView(ctx, state, params = {}) {
2084
2084
  });
2085
2085
  }
2086
2086
 
2087
- // src/core/doInitialAllocateContainers.ts
2088
- function doInitialAllocateContainers(ctx, state) {
2089
- var _a;
2090
- const {
2091
- scrollLength,
2092
- props: {
2093
- data,
2094
- getEstimatedItemSize,
2095
- getFixedItemSize,
2096
- getItemType,
2097
- scrollBuffer,
2098
- numColumns,
2099
- estimatedItemSize
2100
- }
2101
- } = state;
2102
- const hasContainers = peek$(ctx, "numContainers");
2103
- if (scrollLength > 0 && data.length > 0 && !hasContainers) {
2104
- let averageItemSize;
2105
- const fn = getFixedItemSize || getEstimatedItemSize;
2106
- if (fn) {
2107
- let totalSize = 0;
2108
- const num = Math.min(20, data.length);
2109
- for (let i = 0; i < num; i++) {
2110
- totalSize += fn(0, data[0], getItemType ? (_a = getItemType(data[0], 0)) != null ? _a : "" : "");
2111
- }
2112
- averageItemSize = totalSize / num;
2113
- } else {
2114
- averageItemSize = estimatedItemSize;
2115
- }
2116
- const numContainers = Math.ceil((scrollLength + scrollBuffer * 2) / averageItemSize * numColumns);
2117
- for (let i = 0; i < numContainers; i++) {
2118
- set$(ctx, `containerPosition${i}`, POSITION_OUT_OF_VIEW);
2119
- set$(ctx, `containerColumn${i}`, -1);
2120
- }
2121
- set$(ctx, "numContainers", numContainers);
2122
- set$(ctx, "numContainersPooled", numContainers * state.props.initialContainerPoolRatio);
2123
- if (!IsNewArchitecture || state.lastLayout) {
2124
- if (state.props.initialScroll) {
2125
- requestAnimationFrame(() => {
2126
- calculateItemsInView(ctx, state, { dataChanged: true });
2127
- });
2128
- } else {
2129
- calculateItemsInView(ctx, state, { dataChanged: true });
2130
- }
2131
- }
2132
- return true;
2133
- }
2134
- }
2135
-
2136
2087
  // src/core/doMaintainScrollAtEnd.ts
2137
2088
  function doMaintainScrollAtEnd(ctx, state, animated) {
2138
2089
  const {
@@ -2191,6 +2142,129 @@ function checkAtTop(state) {
2191
2142
  );
2192
2143
  }
2193
2144
 
2145
+ // src/utils/updateAveragesOnDataChange.ts
2146
+ function updateAveragesOnDataChange(state, oldData, newData) {
2147
+ var _a;
2148
+ const {
2149
+ averageSizes,
2150
+ sizesKnown,
2151
+ indexByKey,
2152
+ props: { itemsAreEqual, getItemType, keyExtractor }
2153
+ } = state;
2154
+ if (!itemsAreEqual || !oldData.length || !newData.length) {
2155
+ for (const key in averageSizes) {
2156
+ delete averageSizes[key];
2157
+ }
2158
+ return;
2159
+ }
2160
+ const itemTypesToPreserve = {};
2161
+ const newDataLength = newData.length;
2162
+ const oldDataLength = oldData.length;
2163
+ for (let newIndex = 0; newIndex < newDataLength; newIndex++) {
2164
+ const newItem = newData[newIndex];
2165
+ const id = keyExtractor ? keyExtractor(newItem, newIndex) : String(newIndex);
2166
+ const oldIndex = indexByKey.get(id);
2167
+ if (oldIndex !== void 0 && oldIndex < oldDataLength) {
2168
+ const knownSize = sizesKnown.get(id);
2169
+ if (knownSize === void 0) continue;
2170
+ const oldItem = oldData[oldIndex];
2171
+ const areEqual = itemsAreEqual(oldItem, newItem, newIndex, newData);
2172
+ if (areEqual) {
2173
+ const itemType = getItemType ? (_a = getItemType(newItem, newIndex)) != null ? _a : "" : "";
2174
+ let typeData = itemTypesToPreserve[itemType];
2175
+ if (!typeData) {
2176
+ typeData = itemTypesToPreserve[itemType] = { count: 0, totalSize: 0 };
2177
+ }
2178
+ typeData.totalSize += knownSize;
2179
+ typeData.count++;
2180
+ }
2181
+ }
2182
+ }
2183
+ for (const key in averageSizes) {
2184
+ delete averageSizes[key];
2185
+ }
2186
+ for (const itemType in itemTypesToPreserve) {
2187
+ const { totalSize, count } = itemTypesToPreserve[itemType];
2188
+ if (count > 0) {
2189
+ averageSizes[itemType] = {
2190
+ avg: totalSize / count,
2191
+ num: count
2192
+ };
2193
+ }
2194
+ }
2195
+ }
2196
+
2197
+ // src/core/checkResetContainers.ts
2198
+ function checkResetContainers(ctx, state, isFirst, dataProp) {
2199
+ if (state) {
2200
+ if (!isFirst && state.props.data !== dataProp) {
2201
+ updateAveragesOnDataChange(state, state.props.data, dataProp);
2202
+ }
2203
+ const { maintainScrollAtEnd } = state.props;
2204
+ if (!isFirst) {
2205
+ calculateItemsInView(ctx, state, { dataChanged: true, doMVCP: true });
2206
+ const shouldMaintainScrollAtEnd = maintainScrollAtEnd === true || maintainScrollAtEnd.onDataChange;
2207
+ const didMaintainScrollAtEnd = shouldMaintainScrollAtEnd && doMaintainScrollAtEnd(ctx, state, false);
2208
+ if (!didMaintainScrollAtEnd && dataProp.length > state.props.data.length) {
2209
+ state.isEndReached = false;
2210
+ }
2211
+ if (!didMaintainScrollAtEnd) {
2212
+ checkAtTop(state);
2213
+ checkAtBottom(ctx, state);
2214
+ }
2215
+ }
2216
+ }
2217
+ }
2218
+
2219
+ // src/core/doInitialAllocateContainers.ts
2220
+ function doInitialAllocateContainers(ctx, state) {
2221
+ var _a;
2222
+ const {
2223
+ scrollLength,
2224
+ props: {
2225
+ data,
2226
+ getEstimatedItemSize,
2227
+ getFixedItemSize,
2228
+ getItemType,
2229
+ scrollBuffer,
2230
+ numColumns,
2231
+ estimatedItemSize
2232
+ }
2233
+ } = state;
2234
+ const hasContainers = peek$(ctx, "numContainers");
2235
+ if (scrollLength > 0 && data.length > 0 && !hasContainers) {
2236
+ let averageItemSize;
2237
+ const fn = getFixedItemSize || getEstimatedItemSize;
2238
+ if (fn) {
2239
+ let totalSize = 0;
2240
+ const num = Math.min(20, data.length);
2241
+ for (let i = 0; i < num; i++) {
2242
+ totalSize += fn(0, data[0], getItemType ? (_a = getItemType(data[0], 0)) != null ? _a : "" : "");
2243
+ }
2244
+ averageItemSize = totalSize / num;
2245
+ } else {
2246
+ averageItemSize = estimatedItemSize;
2247
+ }
2248
+ const numContainers = Math.ceil((scrollLength + scrollBuffer * 2) / averageItemSize * numColumns);
2249
+ for (let i = 0; i < numContainers; i++) {
2250
+ set$(ctx, `containerPosition${i}`, POSITION_OUT_OF_VIEW);
2251
+ set$(ctx, `containerColumn${i}`, -1);
2252
+ }
2253
+ set$(ctx, "numContainers", numContainers);
2254
+ set$(ctx, "numContainersPooled", numContainers * state.props.initialContainerPoolRatio);
2255
+ if (!IsNewArchitecture || state.lastLayout) {
2256
+ if (state.props.initialScroll) {
2257
+ requestAnimationFrame(() => {
2258
+ calculateItemsInView(ctx, state, { dataChanged: true });
2259
+ });
2260
+ } else {
2261
+ calculateItemsInView(ctx, state, { dataChanged: true });
2262
+ }
2263
+ }
2264
+ return true;
2265
+ }
2266
+ }
2267
+
2194
2268
  // src/core/handleLayout.ts
2195
2269
  function handleLayout(ctx, state, layout, setCanRender) {
2196
2270
  const { maintainScrollAtEnd } = state.props;
@@ -2368,6 +2442,7 @@ function updateItemSize(ctx, state, itemKey, sizeObj) {
2368
2442
  if (prevSizeKnown !== void 0 && Math.abs(prevSizeKnown - size) > 5) {
2369
2443
  shouldMaintainScrollAtEnd = true;
2370
2444
  }
2445
+ addTotalSize(ctx, state, itemKey, diff);
2371
2446
  onItemSizeChanged == null ? void 0 : onItemSizeChanged({
2372
2447
  index,
2373
2448
  itemData: state.props.data[index],
@@ -2488,7 +2563,7 @@ function getRenderedItem(ctx, state, key) {
2488
2563
  item: data[index],
2489
2564
  type: getItemType ? (_a = getItemType(data[index], index)) != null ? _a : "" : ""
2490
2565
  };
2491
- renderedItem = isFunction(renderItem) ? renderItem(itemProps) : React3__default.createElement(renderItem, itemProps);
2566
+ renderedItem = isFunction(renderItem) ? renderItem(itemProps) : React2__default.createElement(renderItem, itemProps);
2492
2567
  }
2493
2568
  return { index, item: data[index], renderedItem };
2494
2569
  }
@@ -2499,58 +2574,6 @@ function useThrottledOnScroll(originalHandler, scrollEventThrottle) {
2499
2574
  return (event) => throttle(originalHandler, scrollEventThrottle, { nativeEvent: event.nativeEvent });
2500
2575
  }
2501
2576
 
2502
- // src/utils/updateAveragesOnDataChange.ts
2503
- function updateAveragesOnDataChange(state, oldData, newData) {
2504
- var _a;
2505
- const {
2506
- averageSizes,
2507
- sizesKnown,
2508
- indexByKey,
2509
- props: { itemsAreEqual, getItemType, keyExtractor }
2510
- } = state;
2511
- if (!itemsAreEqual || !oldData.length || !newData.length) {
2512
- for (const key in averageSizes) {
2513
- delete averageSizes[key];
2514
- }
2515
- return;
2516
- }
2517
- const itemTypesToPreserve = {};
2518
- const newDataLength = newData.length;
2519
- const oldDataLength = oldData.length;
2520
- for (let newIndex = 0; newIndex < newDataLength; newIndex++) {
2521
- const newItem = newData[newIndex];
2522
- const id = keyExtractor ? keyExtractor(newItem, newIndex) : String(newIndex);
2523
- const oldIndex = indexByKey.get(id);
2524
- if (oldIndex !== void 0 && oldIndex < oldDataLength) {
2525
- const knownSize = sizesKnown.get(id);
2526
- if (knownSize === void 0) continue;
2527
- const oldItem = oldData[oldIndex];
2528
- const areEqual = itemsAreEqual(oldItem, newItem, newIndex, newData);
2529
- if (areEqual) {
2530
- const itemType = getItemType ? (_a = getItemType(newItem, newIndex)) != null ? _a : "" : "";
2531
- let typeData = itemTypesToPreserve[itemType];
2532
- if (!typeData) {
2533
- typeData = itemTypesToPreserve[itemType] = { count: 0, totalSize: 0 };
2534
- }
2535
- typeData.totalSize += knownSize;
2536
- typeData.count++;
2537
- }
2538
- }
2539
- }
2540
- for (const key in averageSizes) {
2541
- delete averageSizes[key];
2542
- }
2543
- for (const itemType in itemTypesToPreserve) {
2544
- const { totalSize, count } = itemTypesToPreserve[itemType];
2545
- if (count > 0) {
2546
- averageSizes[itemType] = {
2547
- avg: totalSize / count,
2548
- num: count
2549
- };
2550
- }
2551
- }
2552
- }
2553
-
2554
2577
  // src/components/LegendList.tsx
2555
2578
  var DEFAULT_DRAW_DISTANCE = 250;
2556
2579
  var DEFAULT_ITEM_SIZE = 100;
@@ -2560,14 +2583,14 @@ var LegendList = typedMemo(
2560
2583
  const isChildrenMode = children !== void 0 && dataProp === void 0;
2561
2584
  const processedProps = isChildrenMode ? {
2562
2585
  ...restProps,
2563
- data: (isArray(children) ? children : React3.Children.toArray(children)).flat(1),
2586
+ data: (isArray(children) ? children : React2.Children.toArray(children)).flat(1),
2564
2587
  renderItem: ({ item }) => item
2565
2588
  } : {
2566
2589
  ...restProps,
2567
2590
  data: dataProp || [],
2568
2591
  renderItem: renderItemProp
2569
2592
  };
2570
- return /* @__PURE__ */ React3.createElement(StateProvider, null, /* @__PURE__ */ React3.createElement(LegendListInner, { ...processedProps, ref: forwardedRef }));
2593
+ return /* @__PURE__ */ React2.createElement(StateProvider, null, /* @__PURE__ */ React2.createElement(LegendListInner, { ...processedProps, ref: forwardedRef }));
2571
2594
  })
2572
2595
  );
2573
2596
  var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
@@ -2626,7 +2649,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2626
2649
  } = props;
2627
2650
  const [renderNum, setRenderNum] = useState(0);
2628
2651
  const initialScroll = initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? { index: initialScrollIndexProp.index || 0, viewOffset: initialScrollIndexProp.viewOffset || 0 } : { index: initialScrollIndexProp || 0, viewOffset: initialScrollOffsetProp || 0 } : void 0;
2629
- const [canRender, setCanRender] = React3.useState(!IsNewArchitecture);
2652
+ const [canRender, setCanRender] = React2.useState(!IsNewArchitecture);
2630
2653
  const contentContainerStyle = { ...StyleSheet.flatten(contentContainerStyleProp) };
2631
2654
  const style = { ...StyleSheet.flatten(styleProp) };
2632
2655
  const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
@@ -2733,27 +2756,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2733
2756
  suggestEstimatedItemSize: !!suggestEstimatedItemSize
2734
2757
  };
2735
2758
  state.refScroller = refScroller;
2736
- const checkResetContainers = (isFirst2) => {
2737
- const state2 = refState.current;
2738
- if (state2) {
2739
- if (!isFirst2 && state2.props.data !== dataProp) {
2740
- updateAveragesOnDataChange(state2, state2.props.data, dataProp);
2741
- }
2742
- state2.props.data = dataProp;
2743
- if (!isFirst2) {
2744
- calculateItemsInView(ctx, state2, { dataChanged: true, doMVCP: true });
2745
- const shouldMaintainScrollAtEnd = maintainScrollAtEnd === true || maintainScrollAtEnd.onDataChange;
2746
- const didMaintainScrollAtEnd = shouldMaintainScrollAtEnd && doMaintainScrollAtEnd(ctx, state2, false);
2747
- if (!didMaintainScrollAtEnd && dataProp.length > state2.props.data.length) {
2748
- state2.isEndReached = false;
2749
- }
2750
- if (!didMaintainScrollAtEnd) {
2751
- checkAtTop(state2);
2752
- checkAtBottom(ctx, state2);
2753
- }
2754
- }
2755
- }
2756
- };
2757
2759
  const memoizedLastItemKeys = useMemo(() => {
2758
2760
  if (!dataProp.length) return [];
2759
2761
  return Array.from(
@@ -2777,7 +2779,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2777
2779
  };
2778
2780
  if (isFirst) {
2779
2781
  initializeStateVars();
2780
- updateAllPositions(ctx, state);
2782
+ updateItemPositions(
2783
+ ctx,
2784
+ state,
2785
+ /*dataChanged*/
2786
+ true
2787
+ );
2781
2788
  }
2782
2789
  const initialContentOffset = useMemo(() => {
2783
2790
  if (initialScroll) {
@@ -2829,8 +2836,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2829
2836
  const didAllocateContainers = dataProp.length > 0 && doInitialAllocateContainersCallback();
2830
2837
  if (!didAllocateContainers) {
2831
2838
  checkResetContainers(
2839
+ ctx,
2840
+ state,
2832
2841
  /*isFirst*/
2833
- isFirst
2842
+ isFirst,
2843
+ dataProp
2834
2844
  );
2835
2845
  }
2836
2846
  }, [dataProp, numColumnsProp]);
@@ -2990,7 +3000,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2990
3000
  }
2991
3001
  return onScrollFn;
2992
3002
  }, [stickyIndices == null ? void 0 : stickyIndices.length, horizontal, scrollEventThrottle]);
2993
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
3003
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
2994
3004
  ListComponent,
2995
3005
  {
2996
3006
  ...rest,
@@ -3021,9 +3031,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3021
3031
  },
3022
3032
  onScroll: onScrollHandler,
3023
3033
  recycleItems,
3024
- refreshControl: refreshControl ? stylePaddingTopState > 0 ? React3.cloneElement(refreshControl, {
3034
+ refreshControl: refreshControl ? stylePaddingTopState > 0 ? React2.cloneElement(refreshControl, {
3025
3035
  progressViewOffset: (refreshControl.props.progressViewOffset || 0) + stylePaddingTopState
3026
- }) : refreshControl : onRefresh && /* @__PURE__ */ React3.createElement(
3036
+ }) : refreshControl : onRefresh && /* @__PURE__ */ React2.createElement(
3027
3037
  RefreshControl,
3028
3038
  {
3029
3039
  onRefresh,
@@ -3040,7 +3050,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3040
3050
  updateItemSize: fns.updateItemSize,
3041
3051
  waitForInitialLayout
3042
3052
  }
3043
- ), __DEV__ && ENABLE_DEBUG_VIEW && /* @__PURE__ */ React3.createElement(DebugView, { state: refState.current }));
3053
+ ), __DEV__ && ENABLE_DEBUG_VIEW && /* @__PURE__ */ React2.createElement(DebugView, { state: refState.current }));
3044
3054
  });
3045
3055
 
3046
3056
  export { LegendList, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };