@legendapp/list 3.0.0-beta.10 → 3.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -346,48 +346,70 @@ function useInit(cb) {
346
346
 
347
347
  // src/state/ContextContainer.ts
348
348
  var ContextContainer = createContext(null);
349
+ function useContextContainer() {
350
+ return useContext(ContextContainer);
351
+ }
349
352
  function useViewability(callback, configId) {
350
353
  const ctx = useStateContext();
351
- const { containerId } = useContext(ContextContainer);
352
- const key = containerId + (configId != null ? configId : "");
354
+ const containerContext = useContextContainer();
353
355
  useInit(() => {
356
+ if (!containerContext) {
357
+ return;
358
+ }
359
+ const { containerId } = containerContext;
360
+ const key = containerId + (configId != null ? configId : "");
354
361
  const value = ctx.mapViewabilityValues.get(key);
355
362
  if (value) {
356
363
  callback(value);
357
364
  }
358
365
  });
359
- ctx.mapViewabilityCallbacks.set(key, callback);
360
- useEffect(
361
- () => () => {
366
+ useEffect(() => {
367
+ if (!containerContext) {
368
+ return;
369
+ }
370
+ const { containerId } = containerContext;
371
+ const key = containerId + (configId != null ? configId : "");
372
+ ctx.mapViewabilityCallbacks.set(key, callback);
373
+ return () => {
362
374
  ctx.mapViewabilityCallbacks.delete(key);
363
- },
364
- []
365
- );
375
+ };
376
+ }, [ctx, callback, configId, containerContext]);
366
377
  }
367
378
  function useViewabilityAmount(callback) {
368
379
  const ctx = useStateContext();
369
- const { containerId } = useContext(ContextContainer);
380
+ const containerContext = useContextContainer();
370
381
  useInit(() => {
382
+ if (!containerContext) {
383
+ return;
384
+ }
385
+ const { containerId } = containerContext;
371
386
  const value = ctx.mapViewabilityAmountValues.get(containerId);
372
387
  if (value) {
373
388
  callback(value);
374
389
  }
375
390
  });
376
- ctx.mapViewabilityAmountCallbacks.set(containerId, callback);
377
- useEffect(
378
- () => () => {
391
+ useEffect(() => {
392
+ if (!containerContext) {
393
+ return;
394
+ }
395
+ const { containerId } = containerContext;
396
+ ctx.mapViewabilityAmountCallbacks.set(containerId, callback);
397
+ return () => {
379
398
  ctx.mapViewabilityAmountCallbacks.delete(containerId);
380
- },
381
- []
382
- );
399
+ };
400
+ }, [ctx, callback, containerContext]);
383
401
  }
384
402
  function useRecyclingEffect(effect) {
385
- const { index, value } = useContext(ContextContainer);
403
+ const containerContext = useContextContainer();
386
404
  const prevValues = useRef({
387
405
  prevIndex: void 0,
388
406
  prevItem: void 0
389
407
  });
390
408
  useEffect(() => {
409
+ if (!containerContext) {
410
+ return;
411
+ }
412
+ const { index, value } = containerContext;
391
413
  let ret;
392
414
  if (prevValues.current.prevIndex !== void 0 && prevValues.current.prevItem !== void 0) {
393
415
  ret = effect({
@@ -402,48 +424,73 @@ function useRecyclingEffect(effect) {
402
424
  prevItem: value
403
425
  };
404
426
  return ret;
405
- }, [index, value, effect]);
427
+ }, [effect, containerContext]);
406
428
  }
407
429
  function useRecyclingState(valueOrFun) {
408
- const { index, value, itemKey, triggerLayout } = useContext(ContextContainer);
409
- const refState = useRef({
410
- itemKey: null,
411
- value: null
430
+ var _a3, _b;
431
+ const containerContext = useContextContainer();
432
+ const computeValue = (ctx) => {
433
+ if (isFunction(valueOrFun)) {
434
+ const initializer = valueOrFun;
435
+ return ctx ? initializer({
436
+ index: ctx.index,
437
+ item: ctx.value,
438
+ prevIndex: void 0,
439
+ prevItem: void 0
440
+ }) : initializer();
441
+ }
442
+ return valueOrFun;
443
+ };
444
+ const [stateValue, setStateValue] = useState(() => {
445
+ return computeValue(containerContext);
412
446
  });
413
- const [_, setRenderNum] = useState(0);
414
- const state = refState.current;
415
- if (state.itemKey !== itemKey) {
416
- state.itemKey = itemKey;
417
- state.value = isFunction(valueOrFun) ? valueOrFun({
418
- index,
419
- item: value,
420
- prevIndex: void 0,
421
- prevItem: void 0
422
- }) : valueOrFun;
447
+ const prevItemKeyRef = useRef((_a3 = containerContext == null ? void 0 : containerContext.itemKey) != null ? _a3 : null);
448
+ const currentItemKey = (_b = containerContext == null ? void 0 : containerContext.itemKey) != null ? _b : null;
449
+ if (currentItemKey !== null && prevItemKeyRef.current !== currentItemKey) {
450
+ prevItemKeyRef.current = currentItemKey;
451
+ setStateValue(computeValue(containerContext));
423
452
  }
453
+ const triggerLayout = containerContext == null ? void 0 : containerContext.triggerLayout;
424
454
  const setState = useCallback(
425
455
  (newState) => {
426
- state.value = isFunction(newState) ? newState(state.value) : newState;
427
- setRenderNum((v) => v + 1);
456
+ if (!triggerLayout) {
457
+ return;
458
+ }
459
+ setStateValue((prevValue) => {
460
+ return isFunction(newState) ? newState(prevValue) : newState;
461
+ });
428
462
  triggerLayout();
429
463
  },
430
- [triggerLayout, state]
464
+ [triggerLayout]
431
465
  );
432
- return [state.value, setState];
466
+ return [stateValue, setState];
433
467
  }
434
468
  function useIsLastItem() {
435
- const { itemKey } = useContext(ContextContainer);
436
- const isLast = useSelector$("lastItemKeys", (lastItemKeys) => (lastItemKeys == null ? void 0 : lastItemKeys.includes(itemKey)) || false);
469
+ const containerContext = useContextContainer();
470
+ const isLast = useSelector$("lastItemKeys", (lastItemKeys) => {
471
+ if (containerContext) {
472
+ const { itemKey } = containerContext;
473
+ if (!isNullOrUndefined(itemKey)) {
474
+ return (lastItemKeys == null ? void 0 : lastItemKeys.includes(itemKey)) || false;
475
+ }
476
+ }
477
+ return false;
478
+ });
437
479
  return isLast;
438
480
  }
439
481
  function useListScrollSize() {
440
482
  const [scrollSize] = useArr$(["scrollSize"]);
441
483
  return scrollSize;
442
484
  }
485
+ var noop = () => {
486
+ };
443
487
  function useSyncLayout() {
444
- {
445
- const { triggerLayout: syncLayout } = useContext(ContextContainer);
488
+ const containerContext = useContextContainer();
489
+ if (containerContext) {
490
+ const { triggerLayout: syncLayout } = containerContext;
446
491
  return syncLayout;
492
+ } else {
493
+ return noop;
447
494
  }
448
495
  }
449
496
 
@@ -1088,9 +1135,6 @@ function ScrollAdjust() {
1088
1135
  } else {
1089
1136
  scrollView.scrollBy(0, scrollDelta);
1090
1137
  }
1091
- if (IS_DEV) {
1092
- console.log("ScrollAdjust (web scrollBy)", scrollDelta, "total offset:", scrollOffset);
1093
- }
1094
1138
  }
1095
1139
  lastScrollOffsetRef.current = scrollOffset;
1096
1140
  }
@@ -1139,7 +1183,6 @@ var ListComponent = typedMemo(function ListComponent2({
1139
1183
  getRenderedItem: getRenderedItem2,
1140
1184
  updateItemSize: updateItemSize2,
1141
1185
  refScrollView,
1142
- maintainVisibleContentPosition,
1143
1186
  renderScrollComponent,
1144
1187
  scrollAdjustHandler,
1145
1188
  onLayoutHeader,
@@ -1148,6 +1191,7 @@ var ListComponent = typedMemo(function ListComponent2({
1148
1191
  ...rest
1149
1192
  }) {
1150
1193
  const ctx = useStateContext();
1194
+ const maintainVisibleContentPosition = ctx.state.props.maintainVisibleContentPosition;
1151
1195
  const ScrollComponent = renderScrollComponent ? useMemo(
1152
1196
  () => React3.forwardRef((props, ref) => renderScrollComponent({ ...props, ref })),
1153
1197
  [renderScrollComponent]
@@ -1165,7 +1209,7 @@ var ListComponent = typedMemo(function ListComponent2({
1165
1209
  ],
1166
1210
  contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
1167
1211
  horizontal,
1168
- maintainVisibleContentPosition: maintainVisibleContentPosition ? { minIndexForVisible: 0 } : void 0,
1212
+ maintainVisibleContentPosition: maintainVisibleContentPosition.scroll || maintainVisibleContentPosition.dataChanges ? { minIndexForVisible: 0 } : void 0,
1169
1213
  onLayout,
1170
1214
  onScroll: onScroll2,
1171
1215
  ref: refScrollView,
@@ -1709,14 +1753,16 @@ function requestAdjust(ctx, positionDiff, dataChanged) {
1709
1753
  function prepareMVCP(ctx, dataChanged) {
1710
1754
  const state = ctx.state;
1711
1755
  const { idsInView, positions, props } = state;
1712
- const { maintainVisibleContentPosition } = props;
1756
+ const {
1757
+ maintainVisibleContentPosition: { dataChanges: mvcpDataChanges, scroll: mvcpScroll }
1758
+ } = props;
1713
1759
  const scrollingTo = state.scrollingTo;
1714
1760
  let prevPosition;
1715
1761
  let targetId;
1716
1762
  const idsInViewWithPositions = [];
1717
1763
  const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
1718
1764
  const scrollingToViewPosition = scrollingTo == null ? void 0 : scrollingTo.viewPosition;
1719
- const shouldMVCP = !dataChanged || maintainVisibleContentPosition;
1765
+ const shouldMVCP = dataChanged ? mvcpDataChanges : mvcpScroll;
1720
1766
  const indexByKey = state.indexByKey;
1721
1767
  if (shouldMVCP) {
1722
1768
  if (scrollTarget !== void 0) {
@@ -1739,7 +1785,7 @@ function prepareMVCP(ctx, dataChanged) {
1739
1785
  }
1740
1786
  return () => {
1741
1787
  let positionDiff = 0;
1742
- if (dataChanged && targetId === void 0 && maintainVisibleContentPosition) {
1788
+ if (dataChanged && targetId === void 0 && mvcpDataChanges) {
1743
1789
  for (let i = 0; i < idsInViewWithPositions.length; i++) {
1744
1790
  const { id, position } = idsInViewWithPositions[i];
1745
1791
  const newPosition = positions.get(id);
@@ -1873,39 +1919,40 @@ function updateTotalSize(ctx) {
1873
1919
  // src/utils/getScrollVelocity.ts
1874
1920
  var getScrollVelocity = (state) => {
1875
1921
  const { scrollHistory } = state;
1876
- let velocity = 0;
1877
- if (scrollHistory.length >= 1) {
1878
- const newest = scrollHistory[scrollHistory.length - 1];
1879
- let oldest;
1880
- let start = 0;
1881
- const now = Date.now();
1882
- for (let i = 0; i < scrollHistory.length - 1; i++) {
1883
- const entry = scrollHistory[i];
1884
- const nextEntry = scrollHistory[i + 1];
1885
- if (i > 0) {
1886
- const prevEntry = scrollHistory[i - 1];
1887
- const prevDirection = entry.scroll - prevEntry.scroll;
1888
- const currentDirection = nextEntry.scroll - entry.scroll;
1889
- if (prevDirection > 0 && currentDirection < 0 || prevDirection < 0 && currentDirection > 0) {
1890
- start = i;
1891
- break;
1892
- }
1893
- }
1922
+ const newestIndex = scrollHistory.length - 1;
1923
+ if (newestIndex < 1) {
1924
+ return 0;
1925
+ }
1926
+ const newest = scrollHistory[newestIndex];
1927
+ const now = Date.now();
1928
+ let direction = 0;
1929
+ for (let i = newestIndex; i > 0; i--) {
1930
+ const delta = scrollHistory[i].scroll - scrollHistory[i - 1].scroll;
1931
+ if (delta !== 0) {
1932
+ direction = Math.sign(delta);
1933
+ break;
1894
1934
  }
1895
- for (let i = start; i < scrollHistory.length - 1; i++) {
1896
- const entry = scrollHistory[i];
1897
- if (now - entry.time <= 1e3) {
1898
- oldest = entry;
1899
- break;
1900
- }
1935
+ }
1936
+ if (direction === 0) {
1937
+ return 0;
1938
+ }
1939
+ let oldest = newest;
1940
+ for (let i = newestIndex - 1; i >= 0; i--) {
1941
+ const current = scrollHistory[i];
1942
+ const next = scrollHistory[i + 1];
1943
+ const delta = next.scroll - current.scroll;
1944
+ const deltaSign = Math.sign(delta);
1945
+ if (deltaSign !== 0 && deltaSign !== direction) {
1946
+ break;
1901
1947
  }
1902
- if (oldest && oldest !== newest) {
1903
- const scrollDiff = newest.scroll - oldest.scroll;
1904
- const timeDiff = newest.time - oldest.time;
1905
- velocity = timeDiff > 0 ? scrollDiff / timeDiff : 0;
1948
+ if (now - current.time > 1e3) {
1949
+ break;
1906
1950
  }
1951
+ oldest = current;
1907
1952
  }
1908
- return velocity;
1953
+ const scrollDiff = newest.scroll - oldest.scroll;
1954
+ const timeDiff = newest.time - oldest.time;
1955
+ return timeDiff > 0 ? scrollDiff / timeDiff : 0;
1909
1956
  };
1910
1957
 
1911
1958
  // src/utils/updateSnapToOffsets.ts
@@ -2835,7 +2882,7 @@ function checkFinishedScrollFrame(ctx) {
2835
2882
  if (scrollingTo) {
2836
2883
  const { state } = ctx;
2837
2884
  state.animFrameCheckFinishedScroll = void 0;
2838
- const scroll = state.scroll;
2885
+ const scroll = state.scrollPending;
2839
2886
  const adjust = state.scrollAdjustHandler.getAdjust();
2840
2887
  const clampedTargetOffset = clampScrollOffset(ctx, scrollingTo.offset - (scrollingTo.viewOffset || 0));
2841
2888
  const maxOffset = clampScrollOffset(ctx, scroll);
@@ -3090,7 +3137,6 @@ function onScroll(ctx, event) {
3090
3137
  return;
3091
3138
  }
3092
3139
  let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
3093
- state.scrollPending = newScroll;
3094
3140
  if (state.scrollingTo) {
3095
3141
  const maxOffset = clampScrollOffset(ctx, newScroll);
3096
3142
  if (newScroll !== maxOffset && Math.abs(newScroll - maxOffset) > 1) {
@@ -3104,8 +3150,11 @@ function onScroll(ctx, event) {
3104
3150
  return;
3105
3151
  }
3106
3152
  }
3153
+ state.scrollPending = newScroll;
3107
3154
  updateScroll(ctx, newScroll);
3108
- checkFinishedScroll(ctx);
3155
+ if (state.scrollingTo) {
3156
+ checkFinishedScroll(ctx);
3157
+ }
3109
3158
  onScrollProp == null ? void 0 : onScrollProp(event);
3110
3159
  }
3111
3160
 
@@ -3440,6 +3489,24 @@ function getRenderedItem(ctx, key) {
3440
3489
  }
3441
3490
  return { index, item: data[index], renderedItem };
3442
3491
  }
3492
+
3493
+ // src/utils/normalizeMaintainVisibleContentPosition.ts
3494
+ function normalizeMaintainVisibleContentPosition(value) {
3495
+ var _a3, _b;
3496
+ if (value === true) {
3497
+ return { dataChanges: true, scroll: true };
3498
+ }
3499
+ if (value && typeof value === "object") {
3500
+ return {
3501
+ dataChanges: (_a3 = value.dataChanges) != null ? _a3 : false,
3502
+ scroll: (_b = value.scroll) != null ? _b : true
3503
+ };
3504
+ }
3505
+ if (value === false) {
3506
+ return { dataChanges: false, scroll: false };
3507
+ }
3508
+ return { dataChanges: false, scroll: true };
3509
+ }
3443
3510
  function useThrottleDebounce(mode) {
3444
3511
  const timeoutRef = useRef(null);
3445
3512
  const lastCallTimeRef = useRef(0);
@@ -3534,7 +3601,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3534
3601
  ListHeaderComponent,
3535
3602
  maintainScrollAtEnd = false,
3536
3603
  maintainScrollAtEndThreshold = 0.1,
3537
- maintainVisibleContentPosition = false,
3604
+ maintainVisibleContentPosition: maintainVisibleContentPositionProp,
3538
3605
  numColumns: numColumnsProp = 1,
3539
3606
  onEndReached,
3540
3607
  onEndReachedThreshold = 0.5,
@@ -3572,6 +3639,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3572
3639
  const style = { ...StyleSheet.flatten(styleProp) };
3573
3640
  const stylePaddingTopState = extractPadding(style, contentContainerStyle, "Top");
3574
3641
  const stylePaddingBottomState = extractPadding(style, contentContainerStyle, "Bottom");
3642
+ const maintainVisibleContentPositionConfig = normalizeMaintainVisibleContentPosition(
3643
+ maintainVisibleContentPositionProp
3644
+ );
3575
3645
  const [renderNum, setRenderNum] = useState(0);
3576
3646
  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;
3577
3647
  const [canRender, setCanRender] = React3.useState(!IsNewArchitecture);
@@ -3656,7 +3726,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3656
3726
  };
3657
3727
  const internalState = ctx.state;
3658
3728
  internalState.triggerCalculateItemsInView = (params) => calculateItemsInView(ctx, params);
3659
- set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPosition);
3729
+ set$(ctx, "maintainVisibleContentPosition", maintainVisibleContentPositionConfig);
3660
3730
  set$(ctx, "extraData", extraData);
3661
3731
  }
3662
3732
  refState.current = ctx.state;
@@ -3687,7 +3757,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3687
3757
  keyExtractor,
3688
3758
  maintainScrollAtEnd,
3689
3759
  maintainScrollAtEndThreshold,
3690
- maintainVisibleContentPosition,
3760
+ maintainVisibleContentPosition: maintainVisibleContentPositionConfig,
3691
3761
  numColumns: numColumnsProp,
3692
3762
  onEndReached,
3693
3763
  onEndReachedThreshold,
@@ -3722,7 +3792,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3722
3792
  setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
3723
3793
  refState.current.props.stylePaddingBottom = stylePaddingBottomState;
3724
3794
  let paddingDiff = stylePaddingTopState - prevPaddingTop;
3725
- if (paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3795
+ if (maintainVisibleContentPositionConfig.scroll && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3726
3796
  if (state.scroll < 0) {
3727
3797
  paddingDiff += state.scroll;
3728
3798
  }
@@ -3757,7 +3827,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3757
3827
  value = 0;
3758
3828
  }
3759
3829
  if (!value) {
3760
- state.didFinishInitialScroll = true;
3830
+ setInitialRenderState(ctx, { didInitialScroll: true });
3761
3831
  }
3762
3832
  return value;
3763
3833
  }, [renderNum]);
@@ -3879,7 +3949,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3879
3949
  initialContentOffset,
3880
3950
  ListEmptyComponent: dataProp.length === 0 ? ListEmptyComponent : void 0,
3881
3951
  ListHeaderComponent,
3882
- maintainVisibleContentPosition,
3883
3952
  onLayout,
3884
3953
  onLayoutHeader,
3885
3954
  onMomentumScrollEnd: fns.onMomentumScrollEnd,
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { Dispatch, SetStateAction } from 'react';
3
- import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-1Hgg1rTO.mjs';
4
- export { C as ColumnWrapperStyle, u as GetRenderedItem, G as GetRenderedItemResult, s as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, f as LegendListRenderItemProps, g as LegendListState, M as MaintainScrollAtEndOptions, O as OnViewableItemsChanged, p as ScrollIndexWithOffset, r as ScrollIndexWithOffsetAndContentOffset, q as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, m as TypedForwardRef, n as TypedMemo, i as ViewAmountToken, h as ViewToken, l as ViewabilityConfig, j as ViewabilityConfigCallbackPair, k as ViewabilityConfigCallbackPairs, e as ViewableRange, t as typedForwardRef, o as typedMemo } from './types-1Hgg1rTO.mjs';
3
+ import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-C83aU7VI.mjs';
4
+ export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-C83aU7VI.mjs';
5
5
  import 'react-native';
6
6
  import 'react-native-reanimated';
7
7
 
@@ -12,7 +12,7 @@ declare const LegendList: (<T>(props: LegendListProps<T> & React.RefAttributes<L
12
12
  declare function useViewability<ItemT = any>(callback: ViewabilityCallback<ItemT>, configId?: string): void;
13
13
  declare function useViewabilityAmount<ItemT = any>(callback: ViewabilityAmountCallback<ItemT>): void;
14
14
  declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
15
- declare function useRecyclingState<ItemT>(valueOrFun: ((info: LegendListRecyclingState<ItemT>) => ItemT) | ItemT): readonly [ItemT | null, Dispatch<SetStateAction<ItemT>>];
15
+ declare function useRecyclingState<ItemT>(valueOrFun: ((info: LegendListRecyclingState<ItemT>) => ItemT) | ItemT): readonly [ItemT, Dispatch<SetStateAction<ItemT>>];
16
16
  declare function useIsLastItem(): boolean;
17
17
  declare function useListScrollSize(): {
18
18
  width: number;
package/index.native.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { Dispatch, SetStateAction } from 'react';
3
- import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-1Hgg1rTO.js';
4
- export { C as ColumnWrapperStyle, u as GetRenderedItem, G as GetRenderedItemResult, s as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, f as LegendListRenderItemProps, g as LegendListState, M as MaintainScrollAtEndOptions, O as OnViewableItemsChanged, p as ScrollIndexWithOffset, r as ScrollIndexWithOffsetAndContentOffset, q as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, m as TypedForwardRef, n as TypedMemo, i as ViewAmountToken, h as ViewToken, l as ViewabilityConfig, j as ViewabilityConfigCallbackPair, k as ViewabilityConfigCallbackPairs, e as ViewableRange, t as typedForwardRef, o as typedMemo } from './types-1Hgg1rTO.js';
3
+ import { L as LegendListProps, a as LegendListRef, V as ViewabilityCallback, b as ViewabilityAmountCallback, c as LegendListRecyclingState } from './types-C83aU7VI.js';
4
+ export { C as ColumnWrapperStyle, w as GetRenderedItem, G as GetRenderedItemResult, v as InitialScrollAnchor, I as InternalState, d as LegendListPropsBase, h as LegendListRenderItemProps, i as LegendListState, f as MaintainScrollAtEndOptions, M as MaintainVisibleContentPositionConfig, e as MaintainVisibleContentPositionNormalized, O as OnViewableItemsChanged, r as ScrollIndexWithOffset, u as ScrollIndexWithOffsetAndContentOffset, s as ScrollIndexWithOffsetPosition, S as ScrollTarget, T as ThresholdSnapshot, o as TypedForwardRef, p as TypedMemo, k as ViewAmountToken, j as ViewToken, n as ViewabilityConfig, l as ViewabilityConfigCallbackPair, m as ViewabilityConfigCallbackPairs, g as ViewableRange, t as typedForwardRef, q as typedMemo } from './types-C83aU7VI.js';
5
5
  import 'react-native';
6
6
  import 'react-native-reanimated';
7
7
 
@@ -12,7 +12,7 @@ declare const LegendList: (<T>(props: LegendListProps<T> & React.RefAttributes<L
12
12
  declare function useViewability<ItemT = any>(callback: ViewabilityCallback<ItemT>, configId?: string): void;
13
13
  declare function useViewabilityAmount<ItemT = any>(callback: ViewabilityAmountCallback<ItemT>): void;
14
14
  declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
15
- declare function useRecyclingState<ItemT>(valueOrFun: ((info: LegendListRecyclingState<ItemT>) => ItemT) | ItemT): readonly [ItemT | null, Dispatch<SetStateAction<ItemT>>];
15
+ declare function useRecyclingState<ItemT>(valueOrFun: ((info: LegendListRecyclingState<ItemT>) => ItemT) | ItemT): readonly [ItemT, Dispatch<SetStateAction<ItemT>>];
16
16
  declare function useIsLastItem(): boolean;
17
17
  declare function useListScrollSize(): {
18
18
  width: number;