@legendapp/list 2.0.11 → 2.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 2.0.13
2
+ - Feat: Allow returning undefined in getFixedItemSize to fall back to estimated size
3
+ - Fix: scrollToIndex viewOffset was being subtracted twice, causing incorrect scroll positioning
4
+ - Fix: Initial container allocation was not applying maintainVisibleContentPosition calculations
5
+ - Fix: updateItemSize was providing full data array to getEstimatedItemSize and getFixedItemSize instead of individual item
6
+
7
+ ## 2.0.12
8
+ - Fix: Scroll velocity calculation was sometimes incorrect when item sizes were very different from estimate
9
+ - Fix: onScroll while scrolling was updating positions without maintainVisibleContentPosition calculations, which was breaking scroll position maintenance
10
+
1
11
  ## 2.0.11
2
12
  - Fix: Missing React import in a file
3
13
 
package/animated.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import * as React$1 from 'react';
2
1
  import * as _legendapp_list from '@legendapp/list';
2
+ import * as React from 'react';
3
3
  import { Animated } from 'react-native';
4
4
 
5
- declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: _legendapp_list.LegendListProps<T> & React$1.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode) & {
5
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: _legendapp_list.LegendListProps<T> & React.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode) & {
6
6
  displayName?: string;
7
7
  }>;
8
8
 
package/animated.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import * as React$1 from 'react';
2
1
  import * as _legendapp_list from '@legendapp/list';
2
+ import * as React from 'react';
3
3
  import { Animated } from 'react-native';
4
4
 
5
- declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: _legendapp_list.LegendListProps<T> & React$1.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode) & {
5
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: _legendapp_list.LegendListProps<T> & React.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode) & {
6
6
  displayName?: string;
7
7
  }>;
8
8
 
package/index.d.mts CHANGED
@@ -275,7 +275,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
275
275
  */
276
276
  stickyIndices?: number[];
277
277
  getItemType?: (item: ItemT, index: number) => TItemType;
278
- getFixedItemSize?: (index: number, item: ItemT, type: TItemType) => number;
278
+ getFixedItemSize?: (index: number, item: ItemT, type: TItemType) => number | undefined;
279
279
  itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
280
280
  }
281
281
  type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView> | ComponentProps<typeof Animated$1.ScrollView>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollView> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
@@ -329,6 +329,7 @@ interface InternalState {
329
329
  scroll: number;
330
330
  time: number;
331
331
  }>;
332
+ lastScrollAdjustForHistory?: number;
332
333
  startReachedBlockedByTimer: boolean;
333
334
  endReachedBlockedByTimer: boolean;
334
335
  scrollForNextCalculateItemsInView: {
package/index.d.ts CHANGED
@@ -275,7 +275,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
275
275
  */
276
276
  stickyIndices?: number[];
277
277
  getItemType?: (item: ItemT, index: number) => TItemType;
278
- getFixedItemSize?: (index: number, item: ItemT, type: TItemType) => number;
278
+ getFixedItemSize?: (index: number, item: ItemT, type: TItemType) => number | undefined;
279
279
  itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
280
280
  }
281
281
  type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView> | ComponentProps<typeof Animated$1.ScrollView>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollView> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
@@ -329,6 +329,7 @@ interface InternalState {
329
329
  scroll: number;
330
330
  time: number;
331
331
  }>;
332
+ lastScrollAdjustForHistory?: number;
332
333
  startReachedBlockedByTimer: boolean;
333
334
  endReachedBlockedByTimer: boolean;
334
335
  scrollForNextCalculateItemsInView: {
package/index.js CHANGED
@@ -695,7 +695,7 @@ function ScrollAdjust() {
695
695
  }
696
696
  function SnapWrapper({ ScrollComponent, ...props }) {
697
697
  const [snapToOffsets] = useArr$(["snapToOffsets"]);
698
- return /* @__PURE__ */ React2__namespace.default.createElement(ScrollComponent, { ...props, snapToOffsets });
698
+ return /* @__PURE__ */ React2__namespace.createElement(ScrollComponent, { ...props, snapToOffsets });
699
699
  }
700
700
 
701
701
  // src/components/ListComponent.tsx
@@ -1050,7 +1050,7 @@ function prepareMVCP(ctx, state, dataChanged) {
1050
1050
  if (newPosition !== void 0) {
1051
1051
  const totalSize = peek$(ctx, "totalSize");
1052
1052
  let diff = newPosition - prevPosition;
1053
- if (state.scroll + state.scrollLength > totalSize) {
1053
+ if (diff !== 0 && state.scroll + state.scrollLength > totalSize) {
1054
1054
  if (diff > 0) {
1055
1055
  diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
1056
1056
  } else {
@@ -1696,12 +1696,11 @@ function scrollToIndex(ctx, state, { index, viewOffset = 0, animated = true, vie
1696
1696
  if (isLast && viewPosition === void 0) {
1697
1697
  viewPosition = 1;
1698
1698
  }
1699
- const firstIndexScrollPostion = firstIndexOffset - viewOffset;
1700
1699
  state.scrollForNextCalculateItemsInView = void 0;
1701
1700
  scrollTo(state, {
1702
1701
  animated,
1703
1702
  index,
1704
- offset: firstIndexScrollPostion,
1703
+ offset: firstIndexOffset,
1705
1704
  viewOffset,
1706
1705
  viewPosition: viewPosition != null ? viewPosition : 0
1707
1706
  });
@@ -1889,7 +1888,6 @@ function calculateItemsInView(ctx, state, params = {}) {
1889
1888
  const totalSize = peek$(ctx, "totalSize");
1890
1889
  const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
1891
1890
  const numColumns = peek$(ctx, "numColumns");
1892
- const previousScrollAdjust = 0;
1893
1891
  const { dataChanged, doMVCP } = params;
1894
1892
  const speed = getScrollVelocity(state);
1895
1893
  const scrollExtra = 0;
@@ -1903,7 +1901,7 @@ function calculateItemsInView(ctx, state, params = {}) {
1903
1901
  );
1904
1902
  scrollState = updatedOffset;
1905
1903
  }
1906
- const scrollAdjustPad = -previousScrollAdjust - topPad;
1904
+ const scrollAdjustPad = -topPad;
1907
1905
  let scroll = scrollState + scrollExtra + scrollAdjustPad;
1908
1906
  if (scroll + scrollLength > totalSize) {
1909
1907
  scroll = Math.max(0, totalSize - scrollLength);
@@ -2308,7 +2306,7 @@ function checkResetContainers(ctx, state, isFirst, dataProp) {
2308
2306
 
2309
2307
  // src/core/doInitialAllocateContainers.ts
2310
2308
  function doInitialAllocateContainers(ctx, state) {
2311
- var _a;
2309
+ var _a, _b, _c;
2312
2310
  const {
2313
2311
  scrollLength,
2314
2312
  props: {
@@ -2324,14 +2322,13 @@ function doInitialAllocateContainers(ctx, state) {
2324
2322
  const hasContainers = peek$(ctx, "numContainers");
2325
2323
  if (scrollLength > 0 && data.length > 0 && !hasContainers) {
2326
2324
  let averageItemSize;
2327
- const fn = getFixedItemSize || getEstimatedItemSize;
2328
- if (fn) {
2325
+ if (getFixedItemSize || getEstimatedItemSize) {
2329
2326
  let totalSize = 0;
2330
2327
  const num = Math.min(20, data.length);
2331
2328
  for (let i = 0; i < num; i++) {
2332
2329
  const item = data[i];
2333
2330
  const itemType = getItemType ? (_a = getItemType(item, i)) != null ? _a : "" : "";
2334
- totalSize += fn(i, item, itemType);
2331
+ totalSize += (_c = (_b = getFixedItemSize == null ? void 0 : getFixedItemSize(i, item, itemType)) != null ? _b : getEstimatedItemSize == null ? void 0 : getEstimatedItemSize(i, item, itemType)) != null ? _c : estimatedItemSize;
2335
2332
  }
2336
2333
  averageItemSize = totalSize / num;
2337
2334
  } else {
@@ -2347,10 +2344,10 @@ function doInitialAllocateContainers(ctx, state) {
2347
2344
  if (!IsNewArchitecture || state.lastLayout) {
2348
2345
  if (state.props.initialScroll) {
2349
2346
  requestAnimationFrame(() => {
2350
- calculateItemsInView(ctx, state, { dataChanged: true });
2347
+ calculateItemsInView(ctx, state, { dataChanged: true, doMVCP: true });
2351
2348
  });
2352
2349
  } else {
2353
- calculateItemsInView(ctx, state, { dataChanged: true });
2350
+ calculateItemsInView(ctx, state, { dataChanged: true, doMVCP: true });
2354
2351
  }
2355
2352
  }
2356
2353
  return true;
@@ -2415,13 +2412,6 @@ function onScroll(ctx, state, event) {
2415
2412
  return;
2416
2413
  }
2417
2414
  const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
2418
- const ignoreScrollFromMVCP = state.ignoreScrollFromMVCP;
2419
- if (ignoreScrollFromMVCP && !state.scrollingTo) {
2420
- const { lt, gt } = ignoreScrollFromMVCP;
2421
- if (lt && newScroll < lt || gt && newScroll > gt) {
2422
- return;
2423
- }
2424
- }
2425
2415
  state.scrollPending = newScroll;
2426
2416
  updateScroll(ctx, state, newScroll);
2427
2417
  onScrollProp == null ? void 0 : onScrollProp(event);
@@ -2431,9 +2421,17 @@ function updateScroll(ctx, state, newScroll) {
2431
2421
  state.hasScrolled = true;
2432
2422
  state.lastBatchingAction = Date.now();
2433
2423
  const currentTime = Date.now();
2424
+ const adjust = state.scrollAdjustHandler.getAdjust();
2425
+ const lastHistoryAdjust = state.lastScrollAdjustForHistory;
2426
+ const adjustChanged = lastHistoryAdjust !== void 0 && Math.abs(adjust - lastHistoryAdjust) > 0.1;
2427
+ if (adjustChanged) {
2428
+ state.scrollHistory.length = 0;
2429
+ }
2430
+ state.lastScrollAdjustForHistory = adjust;
2434
2431
  if (scrollingTo === void 0 && !(state.scrollHistory.length === 0 && newScroll === state.scroll)) {
2435
- const adjust = state.scrollAdjustHandler.getAdjust();
2436
- state.scrollHistory.push({ scroll: newScroll - adjust, time: currentTime });
2432
+ if (!adjustChanged) {
2433
+ state.scrollHistory.push({ scroll: newScroll, time: currentTime });
2434
+ }
2437
2435
  }
2438
2436
  if (state.scrollHistory.length > 5) {
2439
2437
  state.scrollHistory.shift();
@@ -2442,8 +2440,15 @@ function updateScroll(ctx, state, newScroll) {
2442
2440
  state.scrollPrevTime = state.scrollTime;
2443
2441
  state.scroll = newScroll;
2444
2442
  state.scrollTime = currentTime;
2443
+ const ignoreScrollFromMVCP = state.ignoreScrollFromMVCP;
2444
+ if (ignoreScrollFromMVCP && !state.scrollingTo) {
2445
+ const { lt, gt } = ignoreScrollFromMVCP;
2446
+ if (lt && newScroll < lt || gt && newScroll > gt) {
2447
+ return;
2448
+ }
2449
+ }
2445
2450
  if (state.dataChangeNeedsScrollUpdate || Math.abs(state.scroll - state.scrollPrev) > 2) {
2446
- calculateItemsInView(ctx, state);
2451
+ calculateItemsInView(ctx, state, { doMVCP: state.scrollingTo !== void 0 });
2447
2452
  checkAtBottom(ctx, state);
2448
2453
  checkAtTop(state);
2449
2454
  state.dataChangeNeedsScrollUpdate = false;
@@ -2484,7 +2489,6 @@ function updateItemSize(ctx, state, itemKey, sizeObj) {
2484
2489
  getFixedItemSize,
2485
2490
  getItemType,
2486
2491
  horizontal,
2487
- maintainVisibleContentPosition,
2488
2492
  suggestEstimatedItemSize,
2489
2493
  onItemSizeChanged,
2490
2494
  data,
@@ -2586,7 +2590,7 @@ function updateOneItemSize(state, itemKey, sizeObj) {
2586
2590
  } = state;
2587
2591
  if (!data) return 0;
2588
2592
  const index = indexByKey.get(itemKey);
2589
- const prevSize = getItemSize(state, itemKey, index, data);
2593
+ const prevSize = getItemSize(state, itemKey, index, data[index]);
2590
2594
  const size = Math.floor((horizontal ? sizeObj.width : sizeObj.height) * 8) / 8;
2591
2595
  sizesKnown.set(itemKey, size);
2592
2596
  if (!getEstimatedItemSize && !getFixedItemSize && size > 0) {
package/index.mjs CHANGED
@@ -674,7 +674,7 @@ function ScrollAdjust() {
674
674
  }
675
675
  function SnapWrapper({ ScrollComponent, ...props }) {
676
676
  const [snapToOffsets] = useArr$(["snapToOffsets"]);
677
- return /* @__PURE__ */ React2__default.createElement(ScrollComponent, { ...props, snapToOffsets });
677
+ return /* @__PURE__ */ React2.createElement(ScrollComponent, { ...props, snapToOffsets });
678
678
  }
679
679
 
680
680
  // src/components/ListComponent.tsx
@@ -1029,7 +1029,7 @@ function prepareMVCP(ctx, state, dataChanged) {
1029
1029
  if (newPosition !== void 0) {
1030
1030
  const totalSize = peek$(ctx, "totalSize");
1031
1031
  let diff = newPosition - prevPosition;
1032
- if (state.scroll + state.scrollLength > totalSize) {
1032
+ if (diff !== 0 && state.scroll + state.scrollLength > totalSize) {
1033
1033
  if (diff > 0) {
1034
1034
  diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
1035
1035
  } else {
@@ -1675,12 +1675,11 @@ function scrollToIndex(ctx, state, { index, viewOffset = 0, animated = true, vie
1675
1675
  if (isLast && viewPosition === void 0) {
1676
1676
  viewPosition = 1;
1677
1677
  }
1678
- const firstIndexScrollPostion = firstIndexOffset - viewOffset;
1679
1678
  state.scrollForNextCalculateItemsInView = void 0;
1680
1679
  scrollTo(state, {
1681
1680
  animated,
1682
1681
  index,
1683
- offset: firstIndexScrollPostion,
1682
+ offset: firstIndexOffset,
1684
1683
  viewOffset,
1685
1684
  viewPosition: viewPosition != null ? viewPosition : 0
1686
1685
  });
@@ -1868,7 +1867,6 @@ function calculateItemsInView(ctx, state, params = {}) {
1868
1867
  const totalSize = peek$(ctx, "totalSize");
1869
1868
  const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
1870
1869
  const numColumns = peek$(ctx, "numColumns");
1871
- const previousScrollAdjust = 0;
1872
1870
  const { dataChanged, doMVCP } = params;
1873
1871
  const speed = getScrollVelocity(state);
1874
1872
  const scrollExtra = 0;
@@ -1882,7 +1880,7 @@ function calculateItemsInView(ctx, state, params = {}) {
1882
1880
  );
1883
1881
  scrollState = updatedOffset;
1884
1882
  }
1885
- const scrollAdjustPad = -previousScrollAdjust - topPad;
1883
+ const scrollAdjustPad = -topPad;
1886
1884
  let scroll = scrollState + scrollExtra + scrollAdjustPad;
1887
1885
  if (scroll + scrollLength > totalSize) {
1888
1886
  scroll = Math.max(0, totalSize - scrollLength);
@@ -2287,7 +2285,7 @@ function checkResetContainers(ctx, state, isFirst, dataProp) {
2287
2285
 
2288
2286
  // src/core/doInitialAllocateContainers.ts
2289
2287
  function doInitialAllocateContainers(ctx, state) {
2290
- var _a;
2288
+ var _a, _b, _c;
2291
2289
  const {
2292
2290
  scrollLength,
2293
2291
  props: {
@@ -2303,14 +2301,13 @@ function doInitialAllocateContainers(ctx, state) {
2303
2301
  const hasContainers = peek$(ctx, "numContainers");
2304
2302
  if (scrollLength > 0 && data.length > 0 && !hasContainers) {
2305
2303
  let averageItemSize;
2306
- const fn = getFixedItemSize || getEstimatedItemSize;
2307
- if (fn) {
2304
+ if (getFixedItemSize || getEstimatedItemSize) {
2308
2305
  let totalSize = 0;
2309
2306
  const num = Math.min(20, data.length);
2310
2307
  for (let i = 0; i < num; i++) {
2311
2308
  const item = data[i];
2312
2309
  const itemType = getItemType ? (_a = getItemType(item, i)) != null ? _a : "" : "";
2313
- totalSize += fn(i, item, itemType);
2310
+ totalSize += (_c = (_b = getFixedItemSize == null ? void 0 : getFixedItemSize(i, item, itemType)) != null ? _b : getEstimatedItemSize == null ? void 0 : getEstimatedItemSize(i, item, itemType)) != null ? _c : estimatedItemSize;
2314
2311
  }
2315
2312
  averageItemSize = totalSize / num;
2316
2313
  } else {
@@ -2326,10 +2323,10 @@ function doInitialAllocateContainers(ctx, state) {
2326
2323
  if (!IsNewArchitecture || state.lastLayout) {
2327
2324
  if (state.props.initialScroll) {
2328
2325
  requestAnimationFrame(() => {
2329
- calculateItemsInView(ctx, state, { dataChanged: true });
2326
+ calculateItemsInView(ctx, state, { dataChanged: true, doMVCP: true });
2330
2327
  });
2331
2328
  } else {
2332
- calculateItemsInView(ctx, state, { dataChanged: true });
2329
+ calculateItemsInView(ctx, state, { dataChanged: true, doMVCP: true });
2333
2330
  }
2334
2331
  }
2335
2332
  return true;
@@ -2394,13 +2391,6 @@ function onScroll(ctx, state, event) {
2394
2391
  return;
2395
2392
  }
2396
2393
  const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
2397
- const ignoreScrollFromMVCP = state.ignoreScrollFromMVCP;
2398
- if (ignoreScrollFromMVCP && !state.scrollingTo) {
2399
- const { lt, gt } = ignoreScrollFromMVCP;
2400
- if (lt && newScroll < lt || gt && newScroll > gt) {
2401
- return;
2402
- }
2403
- }
2404
2394
  state.scrollPending = newScroll;
2405
2395
  updateScroll(ctx, state, newScroll);
2406
2396
  onScrollProp == null ? void 0 : onScrollProp(event);
@@ -2410,9 +2400,17 @@ function updateScroll(ctx, state, newScroll) {
2410
2400
  state.hasScrolled = true;
2411
2401
  state.lastBatchingAction = Date.now();
2412
2402
  const currentTime = Date.now();
2403
+ const adjust = state.scrollAdjustHandler.getAdjust();
2404
+ const lastHistoryAdjust = state.lastScrollAdjustForHistory;
2405
+ const adjustChanged = lastHistoryAdjust !== void 0 && Math.abs(adjust - lastHistoryAdjust) > 0.1;
2406
+ if (adjustChanged) {
2407
+ state.scrollHistory.length = 0;
2408
+ }
2409
+ state.lastScrollAdjustForHistory = adjust;
2413
2410
  if (scrollingTo === void 0 && !(state.scrollHistory.length === 0 && newScroll === state.scroll)) {
2414
- const adjust = state.scrollAdjustHandler.getAdjust();
2415
- state.scrollHistory.push({ scroll: newScroll - adjust, time: currentTime });
2411
+ if (!adjustChanged) {
2412
+ state.scrollHistory.push({ scroll: newScroll, time: currentTime });
2413
+ }
2416
2414
  }
2417
2415
  if (state.scrollHistory.length > 5) {
2418
2416
  state.scrollHistory.shift();
@@ -2421,8 +2419,15 @@ function updateScroll(ctx, state, newScroll) {
2421
2419
  state.scrollPrevTime = state.scrollTime;
2422
2420
  state.scroll = newScroll;
2423
2421
  state.scrollTime = currentTime;
2422
+ const ignoreScrollFromMVCP = state.ignoreScrollFromMVCP;
2423
+ if (ignoreScrollFromMVCP && !state.scrollingTo) {
2424
+ const { lt, gt } = ignoreScrollFromMVCP;
2425
+ if (lt && newScroll < lt || gt && newScroll > gt) {
2426
+ return;
2427
+ }
2428
+ }
2424
2429
  if (state.dataChangeNeedsScrollUpdate || Math.abs(state.scroll - state.scrollPrev) > 2) {
2425
- calculateItemsInView(ctx, state);
2430
+ calculateItemsInView(ctx, state, { doMVCP: state.scrollingTo !== void 0 });
2426
2431
  checkAtBottom(ctx, state);
2427
2432
  checkAtTop(state);
2428
2433
  state.dataChangeNeedsScrollUpdate = false;
@@ -2463,7 +2468,6 @@ function updateItemSize(ctx, state, itemKey, sizeObj) {
2463
2468
  getFixedItemSize,
2464
2469
  getItemType,
2465
2470
  horizontal,
2466
- maintainVisibleContentPosition,
2467
2471
  suggestEstimatedItemSize,
2468
2472
  onItemSizeChanged,
2469
2473
  data,
@@ -2565,7 +2569,7 @@ function updateOneItemSize(state, itemKey, sizeObj) {
2565
2569
  } = state;
2566
2570
  if (!data) return 0;
2567
2571
  const index = indexByKey.get(itemKey);
2568
- const prevSize = getItemSize(state, itemKey, index, data);
2572
+ const prevSize = getItemSize(state, itemKey, index, data[index]);
2569
2573
  const size = Math.floor((horizontal ? sizeObj.width : sizeObj.height) * 8) / 8;
2570
2574
  sizesKnown.set(itemKey, size);
2571
2575
  if (!getEstimatedItemSize && !getFixedItemSize && size > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
5
  "sideEffects": false,
6
6
  "private": false,
package/reanimated.d.mts CHANGED
@@ -1,17 +1,18 @@
1
- import React__default, { ComponentProps } from 'react';
1
+ import * as React from 'react';
2
+ import { ComponentProps } from 'react';
2
3
  import Animated from 'react-native-reanimated';
3
4
  import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
4
5
 
5
6
  type KeysToOmit = "getEstimatedItemSize" | "getFixedItemSize" | "getItemType" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "itemsAreEqual" | "ItemSeparatorComponent";
6
7
  type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Animated.ScrollView>>;
7
8
  interface AnimatedLegendListPropsBase<ItemT> extends Omit<PropsBase<ItemT>, KeysToOmit> {
8
- refScrollView?: React__default.Ref<Animated.ScrollView>;
9
+ refScrollView?: React.Ref<Animated.ScrollView>;
9
10
  }
10
11
  type OtherAnimatedLegendListProps<ItemT> = Pick<PropsBase<ItemT>, KeysToOmit>;
11
12
  type AnimatedLegendListProps<ItemT> = Omit<AnimatedLegendListPropsBase<ItemT>, "refLegendList" | "ref"> & OtherAnimatedLegendListProps<ItemT>;
12
13
  type AnimatedLegendListDefinition = <ItemT>(props: AnimatedLegendListProps<ItemT> & {
13
- ref?: React__default.Ref<LegendListRef>;
14
- }) => React__default.ReactElement | null;
14
+ ref?: React.Ref<LegendListRef>;
15
+ }) => React.ReactElement | null;
15
16
  declare const AnimatedLegendList: AnimatedLegendListDefinition;
16
17
 
17
18
  export { AnimatedLegendList, type AnimatedLegendListProps, type AnimatedLegendListPropsBase };
package/reanimated.d.ts CHANGED
@@ -1,17 +1,18 @@
1
- import React__default, { ComponentProps } from 'react';
1
+ import * as React from 'react';
2
+ import { ComponentProps } from 'react';
2
3
  import Animated from 'react-native-reanimated';
3
4
  import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
4
5
 
5
6
  type KeysToOmit = "getEstimatedItemSize" | "getFixedItemSize" | "getItemType" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "itemsAreEqual" | "ItemSeparatorComponent";
6
7
  type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Animated.ScrollView>>;
7
8
  interface AnimatedLegendListPropsBase<ItemT> extends Omit<PropsBase<ItemT>, KeysToOmit> {
8
- refScrollView?: React__default.Ref<Animated.ScrollView>;
9
+ refScrollView?: React.Ref<Animated.ScrollView>;
9
10
  }
10
11
  type OtherAnimatedLegendListProps<ItemT> = Pick<PropsBase<ItemT>, KeysToOmit>;
11
12
  type AnimatedLegendListProps<ItemT> = Omit<AnimatedLegendListPropsBase<ItemT>, "refLegendList" | "ref"> & OtherAnimatedLegendListProps<ItemT>;
12
13
  type AnimatedLegendListDefinition = <ItemT>(props: AnimatedLegendListProps<ItemT> & {
13
- ref?: React__default.Ref<LegendListRef>;
14
- }) => React__default.ReactElement | null;
14
+ ref?: React.Ref<LegendListRef>;
15
+ }) => React.ReactElement | null;
15
16
  declare const AnimatedLegendList: AnimatedLegendListDefinition;
16
17
 
17
18
  export { AnimatedLegendList, type AnimatedLegendListProps, type AnimatedLegendListPropsBase };
package/reanimated.js CHANGED
@@ -6,7 +6,25 @@ var list = require('@legendapp/list');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
- var React__default = /*#__PURE__*/_interopDefault(React);
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
10
28
  var Animated__default = /*#__PURE__*/_interopDefault(Animated);
11
29
 
12
30
  // src/integrations/reanimated.tsx
@@ -36,7 +54,7 @@ var useCombinedRef = (...refs) => {
36
54
  // src/integrations/reanimated.tsx
37
55
  var typedMemo = React.memo;
38
56
  var LegendListForwardedRef = typedMemo(
39
- React__default.default.forwardRef(function LegendListForwardedRef2(props, ref) {
57
+ React__namespace.forwardRef(function LegendListForwardedRef2(props, ref) {
40
58
  const { refLegendList, ...rest } = props;
41
59
  const refFn = React.useCallback(
42
60
  (r) => {
@@ -44,16 +62,16 @@ var LegendListForwardedRef = typedMemo(
44
62
  },
45
63
  [refLegendList]
46
64
  );
47
- return /* @__PURE__ */ React__default.default.createElement(list.LegendList, { ref: refFn, refScrollView: ref, ...rest });
65
+ return /* @__PURE__ */ React__namespace.createElement(list.LegendList, { ref: refFn, refScrollView: ref, ...rest });
48
66
  })
49
67
  );
50
68
  var AnimatedLegendListComponent = Animated__default.default.createAnimatedComponent(LegendListForwardedRef);
51
69
  var AnimatedLegendList = typedMemo(
52
- React__default.default.forwardRef(function AnimatedLegendList2(props, ref) {
70
+ React__namespace.forwardRef(function AnimatedLegendList2(props, ref) {
53
71
  const { refScrollView, ...rest } = props;
54
- const refLegendList = React__default.default.useRef(null);
72
+ const refLegendList = React__namespace.useRef(null);
55
73
  const combinedRef = useCombinedRef(refLegendList, ref);
56
- return /* @__PURE__ */ React__default.default.createElement(AnimatedLegendListComponent, { ref: refScrollView, refLegendList: combinedRef, ...rest });
74
+ return /* @__PURE__ */ React__namespace.createElement(AnimatedLegendListComponent, { ref: refScrollView, refLegendList: combinedRef, ...rest });
57
75
  })
58
76
  );
59
77
 
package/reanimated.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import React, { useCallback, memo } from 'react';
1
+ import * as React from 'react';
2
+ import { useCallback, memo } from 'react';
2
3
  import Animated from 'react-native-reanimated';
3
4
  import { LegendList } from '@legendapp/list';
4
5