@legendapp/list 3.3.3 → 3.3.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 3.3.5
2
+
3
+ - Fix: Changing `dataKey` no longer leaves the new dataset invisible. #519
4
+ - Fix: `maintainScrollAtEnd` stays pinned as newly inserted rows are measured, and scroll corrections preserve `anchoredEndSpace` padding. #520
5
+ - Fix: Programmatic scrolls no longer throw in browsers, get lost when they replace unfinished initial scrolling, or stop working after a previous request is canceled. #518
6
+
7
+ ## 3.3.4
8
+
9
+ - Feat: `getState().indexByKey(key)` looks up an item’s current index by key.
10
+ - Feat: `anchoredEndSpace` now works with standard React Native `LegendList`, including horizontal and RTL lists, and stays accurate after content measurements change. It supports single-column lists only.
11
+ - Fix: `maintainScrollAtEnd` continues following content growth unless the user scrolls away.
12
+ - Fix: Changing `dataKey` no longer briefly displays stale rows from the previous dataset.
13
+ - Fix: Initial scrolling and `scrollToIndex` correctly account for padding, direction, and final-item gaps.
14
+ - Fix: Web content-container sizing remains correct when callers provide padding or `content-box` styles.
15
+ - Fix: `useRecyclingEffect` and `useRecyclingState` no longer crash outside a `LegendList`. #498
16
+ - Fix: Programmatic scrolls settle reliably when superseded, already aligned on iOS, or interrupted by unmounting. #508
17
+ -
1
18
  ## 3.3.3
2
19
 
3
20
  - Fix: Row measurements are applied together in a batch, so item positions don't sometimes move after rendering.
package/animated.d.ts CHANGED
@@ -455,11 +455,15 @@ interface ScrollToEndOptions {
455
455
  viewOffset?: number;
456
456
  }
457
457
  interface AnchoredEndSpaceConfig {
458
+ /** Index of the item whose row should remain anchored when trailing space is added. */
458
459
  anchorIndex: number;
460
+ /** Desired distance from the viewport's start edge to the anchored row. */
459
461
  anchorOffset?: number;
462
+ /** Optional cap for the anchor item's contribution to its row size. */
460
463
  anchorMaxSize?: number;
461
- includeInEndInset?: boolean;
464
+ /** Called whenever the resolved trailing space changes. */
462
465
  onSizeChanged?: (size: number) => void;
466
+ /** Called once the anchor and every row after it have authoritative sizes. */
463
467
  onReady?: (info: AnchoredEndSpaceReadyInfo) => void;
464
468
  }
465
469
  interface StickyHeaderConfig {
@@ -534,6 +538,7 @@ type LegendListState = {
534
538
  isStartReached: boolean;
535
539
  isWithinMaintainScrollAtEndThreshold: boolean;
536
540
  getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
541
+ indexByKey: (key: string) => number | undefined;
537
542
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
538
543
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
539
544
  positionAtIndex: (index: number) => number;
@@ -719,6 +724,7 @@ interface ViewabilityConfig {
719
724
  }
720
725
 
721
726
  type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "anchoredEndSpace" | "contentInsetEndAdjustment" | "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
727
+ anchoredEndSpace?: AnchoredEndSpaceConfig;
722
728
  onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
723
729
  refScrollView?: React.Ref<ScrollView>;
724
730
  renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
@@ -97,6 +97,7 @@ type LegendListState = {
97
97
  isStartReached: boolean;
98
98
  isWithinMaintainScrollAtEndThreshold: boolean;
99
99
  getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
100
+ indexByKey: (key: string) => number | undefined;
100
101
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
101
102
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
102
103
  positionAtIndex: (index: number) => number;
package/keyboard.d.ts CHANGED
@@ -84,12 +84,16 @@ interface ScrollToEndOptions {
84
84
  animated?: boolean;
85
85
  viewOffset?: number;
86
86
  }
87
- interface AnchoredEndSpaceConfig$1 {
87
+ interface AnchoredEndSpaceConfig {
88
+ /** Index of the item whose row should remain anchored when trailing space is added. */
88
89
  anchorIndex: number;
90
+ /** Desired distance from the viewport's start edge to the anchored row. */
89
91
  anchorOffset?: number;
92
+ /** Optional cap for the anchor item's contribution to its row size. */
90
93
  anchorMaxSize?: number;
91
- includeInEndInset?: boolean;
94
+ /** Called whenever the resolved trailing space changes. */
92
95
  onSizeChanged?: (size: number) => void;
96
+ /** Called once the anchor and every row after it have authoritative sizes. */
93
97
  onReady?: (info: AnchoredEndSpaceReadyInfo) => void;
94
98
  }
95
99
  interface LegendListAverageItemSize {
@@ -111,6 +115,7 @@ type LegendListState = {
111
115
  isStartReached: boolean;
112
116
  isWithinMaintainScrollAtEndThreshold: boolean;
113
117
  getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
118
+ indexByKey: (key: string) => number | undefined;
114
119
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
115
120
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
116
121
  positionAtIndex: (index: number) => number;
@@ -245,9 +250,6 @@ type LegendListRef$1 = {
245
250
  setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
246
251
  };
247
252
 
248
- interface AnchoredEndSpaceConfig extends Omit<AnchoredEndSpaceConfig$1, "includeInEndInset"> {
249
- }
250
-
251
253
  type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
252
254
  getAnimatableRef(): React.ElementRef<typeof ScrollViewComponent>;
253
255
  getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
package/keyboard.js CHANGED
@@ -106,7 +106,6 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(
106
106
  }
107
107
  return {
108
108
  ...anchoredEndSpace,
109
- includeInEndInset: true,
110
109
  onSizeChanged: (size) => {
111
110
  var _a;
112
111
  blankSpace.value = size;
@@ -149,6 +148,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(
149
148
  AnimatedLegendListInternal,
150
149
  {
151
150
  anchoredEndSpace: anchoredEndSpaceWithBlankSpace,
151
+ anchoredEndSpaceOwnerInternal: "scroll",
152
152
  ref: combinedRef,
153
153
  renderScrollComponent: memoList,
154
154
  ...rest
package/keyboard.mjs CHANGED
@@ -85,7 +85,6 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(
85
85
  }
86
86
  return {
87
87
  ...anchoredEndSpace,
88
- includeInEndInset: true,
89
88
  onSizeChanged: (size) => {
90
89
  var _a;
91
90
  blankSpace.value = size;
@@ -128,6 +127,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(
128
127
  AnimatedLegendListInternal,
129
128
  {
130
129
  anchoredEndSpace: anchoredEndSpaceWithBlankSpace,
130
+ anchoredEndSpaceOwnerInternal: "scroll",
131
131
  ref: combinedRef,
132
132
  renderScrollComponent: memoList,
133
133
  ...rest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
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/react-native.d.ts CHANGED
@@ -455,11 +455,15 @@ interface ScrollToEndOptions {
455
455
  viewOffset?: number;
456
456
  }
457
457
  interface AnchoredEndSpaceConfig {
458
+ /** Index of the item whose row should remain anchored when trailing space is added. */
458
459
  anchorIndex: number;
460
+ /** Desired distance from the viewport's start edge to the anchored row. */
459
461
  anchorOffset?: number;
462
+ /** Optional cap for the anchor item's contribution to its row size. */
460
463
  anchorMaxSize?: number;
461
- includeInEndInset?: boolean;
464
+ /** Called whenever the resolved trailing space changes. */
462
465
  onSizeChanged?: (size: number) => void;
466
+ /** Called once the anchor and every row after it have authoritative sizes. */
463
467
  onReady?: (info: AnchoredEndSpaceReadyInfo) => void;
464
468
  }
465
469
  interface StickyHeaderConfig {
@@ -534,6 +538,7 @@ type LegendListState$1 = {
534
538
  isStartReached: boolean;
535
539
  isWithinMaintainScrollAtEndThreshold: boolean;
536
540
  getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
541
+ indexByKey: (key: string) => number | undefined;
537
542
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
538
543
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
539
544
  positionAtIndex: (index: number) => number;
@@ -745,6 +750,7 @@ interface ScrollIndexWithOffsetAndContentOffset extends ScrollIndexWithOffsetPos
745
750
  }
746
751
 
747
752
  type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "anchoredEndSpace" | "contentInsetEndAdjustment" | "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
753
+ anchoredEndSpace?: AnchoredEndSpaceConfig;
748
754
  onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
749
755
  refScrollView?: React.Ref<ScrollView>;
750
756
  renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
@@ -778,4 +784,4 @@ declare function useSyncLayout(): () => void;
778
784
 
779
785
  declare const LegendList: LegendListComponent;
780
786
 
781
- export { type AdaptiveRender, type AdaptiveRenderChangeReason, type AdaptiveRenderConfig, type AlwaysRenderConfig, type ColumnWrapperStyle, type Insets, type LayoutRectangle, LegendList, type LegendListAverageItemSize, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListState, type MaintainScrollAtEndOnOptions, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type OnViewableItemsChangedInfo, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type StickyHeaderConfig, type StyleProp, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, useAdaptiveRender, useAdaptiveRenderChange, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
787
+ export { type AdaptiveRender, type AdaptiveRenderChangeReason, type AdaptiveRenderConfig, type AlwaysRenderConfig, type AnchoredEndSpaceConfig, type ColumnWrapperStyle, type Insets, type LayoutRectangle, LegendList, type LegendListAverageItemSize, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListState, type MaintainScrollAtEndOnOptions, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type OnViewableItemsChangedInfo, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type StickyHeaderConfig, type StyleProp, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, useAdaptiveRender, useAdaptiveRenderChange, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };