@legendapp/list 3.1.2 → 3.3.0

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/react.d.ts CHANGED
@@ -115,26 +115,32 @@ interface NativeSyntheticEvent<T> {
115
115
  type ViewStyle = Record<string, unknown>;
116
116
  type StyleProp<T> = T | T[] | null | undefined | false;
117
117
  type AdaptiveRender = "normal" | "light";
118
+ type AdaptiveRenderChangeReason = "initial" | "ready" | "scroll";
118
119
  interface AdaptiveRenderConfig {
120
+ /**
121
+ * Mode to use before the list is ready to render.
122
+ * @default "normal"
123
+ */
124
+ initialMode?: AdaptiveRender;
119
125
  /**
120
126
  * Scroll velocity in pixels per millisecond above which items should switch to light mode.
121
- * @default 4
127
+ * @default 3 native, 6 web
122
128
  */
123
129
  enterVelocity?: number;
124
130
  /**
125
131
  * Scroll velocity in pixels per millisecond below which items can return to normal mode.
126
- * @default 1
132
+ * @default 1 native, 3 web
127
133
  */
128
134
  exitVelocity?: number;
129
135
  /**
130
136
  * Time to wait without velocity above exitVelocity before returning to normal mode.
131
- * @default 1000
137
+ * @default 250
132
138
  */
133
139
  exitDelay?: number;
134
140
  /**
135
141
  * Called when the list-level adaptive render changes.
136
142
  */
137
- onChange?: (mode: AdaptiveRender) => void;
143
+ onChange?: (mode: AdaptiveRender, reason: AdaptiveRenderChangeReason) => void;
138
144
  }
139
145
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
140
146
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
@@ -176,6 +182,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
176
182
  * Style applied to each column's wrapper view.
177
183
  */
178
184
  columnWrapperStyle?: ColumnWrapperStyle;
185
+ /**
186
+ * Identity token for the dataset represented by `data`.
187
+ * Change this when replacing the current dataset with a different logical dataset.
188
+ */
189
+ dataKey?: Key;
179
190
  /**
180
191
  * Version token that forces the list to treat data as updated even when the array reference is stable.
181
192
  * Increment or change this when mutating the data array in place.
@@ -344,6 +355,15 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
344
355
  * Called when list layout metrics change.
345
356
  */
346
357
  onMetricsChange?: (metrics: LegendListMetrics) => void;
358
+ /**
359
+ * Called when the first visible item changes. This is emitted from the core range calculation and is cheaper than
360
+ * viewability tracking when you only need to follow the item at the top of the viewport.
361
+ */
362
+ onFirstVisibleItemChanged?: (info: {
363
+ index: number;
364
+ item: ItemT;
365
+ key: string;
366
+ }) => void;
347
367
  /**
348
368
  * Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
349
369
  */
@@ -812,4 +832,4 @@ declare function useSyncLayout(): () => void;
812
832
 
813
833
  declare const LegendList: LegendListComponent;
814
834
 
815
- export { type AdaptiveRender, 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 };
835
+ 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 };