@legendapp/list 3.2.0 → 3.3.1

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,18 @@
1
+ ## 3.3.1
2
+
3
+ - Perf: Animated `scrollToIndex` and `scrollToOffset` calls now mount the destination rows before native scrolling starts, so long programmatic jumps are less likely to show blank space at the target.
4
+ - Perf: Fast scrolling shifts more of the render buffer in the direction of travel and settles back after scrolling stops, so rows ahead of the user are ready sooner without keeping the buffer displaced afterward.
5
+ - Perf: Scroll velocity favors recent movement and ignores stale samples, preventing old scroll events from keeping the render buffer pointed in the wrong direction after scrolling slows or stops.
6
+ - Perf: On Fabric, row measurements wait for all expected layout-effect measurements before recalculating positions, reducing the number of computations while scrolling quickly.
7
+
8
+ ## 3.3.0
9
+
10
+ - Feat: Add `dataKey` so apps can tell the list when the current array represents a different dataset, such as switching conversations or feeds without remounting `LegendList`.
11
+ - Feat: `experimental_adaptiveRender.onChange` now receives a reason (`initial`, `ready`, or `scroll`) so item components can tell why the render mode changed.
12
+ - Fix: Large user scroll jumps render the visible rows first and fill the normal draw distance on the next frame, making long jumps less likely to land on a blank range.
13
+ - Fix: `maintainScrollAtEnd` reruns a pending keep-at-end request after the current one settles, so a footer resize and a new message arriving together keep chat-style lists pinned to the end.
14
+ - Fix: Replacing data after clearing the list, or changing `dataKey` for a non-empty replacement, resets layout readiness and uses the latest initial scroll target for the new dataset.
15
+
1
16
  ## 3.2.0
2
17
 
3
18
  - Feat: Add `onFirstVisibleItemChanged` so apps can track the item at the top of the viewport without setting up full viewability callbacks.
package/animated.d.ts CHANGED
@@ -92,6 +92,7 @@ interface NativeSyntheticEvent<T> {
92
92
  type ViewStyle = Record<string, unknown>;
93
93
  type StyleProp<T> = T | T[] | null | undefined | false;
94
94
  type AdaptiveRender = "normal" | "light";
95
+ type AdaptiveRenderChangeReason = "initial" | "ready" | "scroll";
95
96
  interface AdaptiveRenderConfig {
96
97
  /**
97
98
  * Mode to use before the list is ready to render.
@@ -116,7 +117,7 @@ interface AdaptiveRenderConfig {
116
117
  /**
117
118
  * Called when the list-level adaptive render changes.
118
119
  */
119
- onChange?: (mode: AdaptiveRender) => void;
120
+ onChange?: (mode: AdaptiveRender, reason: AdaptiveRenderChangeReason) => void;
120
121
  }
121
122
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
122
123
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
@@ -158,6 +159,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
158
159
  * Style applied to each column's wrapper view.
159
160
  */
160
161
  columnWrapperStyle?: ColumnWrapperStyle;
162
+ /**
163
+ * Identity token for the dataset represented by `data`.
164
+ * Change this when replacing the current dataset with a different logical dataset.
165
+ */
166
+ dataKey?: Key;
161
167
  /**
162
168
  * Version token that forces the list to treat data as updated even when the array reference is stable.
163
169
  * Increment or change this when mutating the data array in place.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
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
@@ -92,6 +92,7 @@ interface NativeSyntheticEvent<T> {
92
92
  type ViewStyle = Record<string, unknown>;
93
93
  type StyleProp<T> = T | T[] | null | undefined | false;
94
94
  type AdaptiveRender = "normal" | "light";
95
+ type AdaptiveRenderChangeReason = "initial" | "ready" | "scroll";
95
96
  interface AdaptiveRenderConfig {
96
97
  /**
97
98
  * Mode to use before the list is ready to render.
@@ -116,7 +117,7 @@ interface AdaptiveRenderConfig {
116
117
  /**
117
118
  * Called when the list-level adaptive render changes.
118
119
  */
119
- onChange?: (mode: AdaptiveRender) => void;
120
+ onChange?: (mode: AdaptiveRender, reason: AdaptiveRenderChangeReason) => void;
120
121
  }
121
122
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
122
123
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
@@ -158,6 +159,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
158
159
  * Style applied to each column's wrapper view.
159
160
  */
160
161
  columnWrapperStyle?: ColumnWrapperStyle;
162
+ /**
163
+ * Identity token for the dataset represented by `data`.
164
+ * Change this when replacing the current dataset with a different logical dataset.
165
+ */
166
+ dataKey?: Key;
161
167
  /**
162
168
  * Version token that forces the list to treat data as updated even when the array reference is stable.
163
169
  * Increment or change this when mutating the data array in place.
@@ -764,4 +770,4 @@ declare function useSyncLayout(): () => void;
764
770
 
765
771
  declare const LegendList: LegendListComponent;
766
772
 
767
- export { type AdaptiveRender, 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 };
773
+ 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 };