@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/reanimated.d.ts CHANGED
@@ -93,26 +93,32 @@ interface NativeSyntheticEvent<T> {
93
93
  type ViewStyle = Record<string, unknown>;
94
94
  type StyleProp<T> = T | T[] | null | undefined | false;
95
95
  type AdaptiveRender = "normal" | "light";
96
+ type AdaptiveRenderChangeReason = "initial" | "ready" | "scroll";
96
97
  interface AdaptiveRenderConfig {
98
+ /**
99
+ * Mode to use before the list is ready to render.
100
+ * @default "normal"
101
+ */
102
+ initialMode?: AdaptiveRender;
97
103
  /**
98
104
  * Scroll velocity in pixels per millisecond above which items should switch to light mode.
99
- * @default 4
105
+ * @default 3 native, 6 web
100
106
  */
101
107
  enterVelocity?: number;
102
108
  /**
103
109
  * Scroll velocity in pixels per millisecond below which items can return to normal mode.
104
- * @default 1
110
+ * @default 1 native, 3 web
105
111
  */
106
112
  exitVelocity?: number;
107
113
  /**
108
114
  * Time to wait without velocity above exitVelocity before returning to normal mode.
109
- * @default 1000
115
+ * @default 250
110
116
  */
111
117
  exitDelay?: number;
112
118
  /**
113
119
  * Called when the list-level adaptive render changes.
114
120
  */
115
- onChange?: (mode: AdaptiveRender) => void;
121
+ onChange?: (mode: AdaptiveRender, reason: AdaptiveRenderChangeReason) => void;
116
122
  }
117
123
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
118
124
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
@@ -154,6 +160,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
154
160
  * Style applied to each column's wrapper view.
155
161
  */
156
162
  columnWrapperStyle?: ColumnWrapperStyle;
163
+ /**
164
+ * Identity token for the dataset represented by `data`.
165
+ * Change this when replacing the current dataset with a different logical dataset.
166
+ */
167
+ dataKey?: Key;
157
168
  /**
158
169
  * Version token that forces the list to treat data as updated even when the array reference is stable.
159
170
  * Increment or change this when mutating the data array in place.
@@ -322,6 +333,15 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
322
333
  * Called when list layout metrics change.
323
334
  */
324
335
  onMetricsChange?: (metrics: LegendListMetrics) => void;
336
+ /**
337
+ * Called when the first visible item changes. This is emitted from the core range calculation and is cheaper than
338
+ * viewability tracking when you only need to follow the item at the top of the viewport.
339
+ */
340
+ onFirstVisibleItemChanged?: (info: {
341
+ index: number;
342
+ item: ItemT;
343
+ key: string;
344
+ }) => void;
325
345
  /**
326
346
  * Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
327
347
  */
package/section-list.d.ts CHANGED
@@ -149,26 +149,32 @@ interface NativeSyntheticEvent<T> {
149
149
  type ViewStyle = Record<string, unknown>;
150
150
  type StyleProp<T> = T | T[] | null | undefined | false;
151
151
  type AdaptiveRender = "normal" | "light";
152
+ type AdaptiveRenderChangeReason = "initial" | "ready" | "scroll";
152
153
  interface AdaptiveRenderConfig {
154
+ /**
155
+ * Mode to use before the list is ready to render.
156
+ * @default "normal"
157
+ */
158
+ initialMode?: AdaptiveRender;
153
159
  /**
154
160
  * Scroll velocity in pixels per millisecond above which items should switch to light mode.
155
- * @default 4
161
+ * @default 3 native, 6 web
156
162
  */
157
163
  enterVelocity?: number;
158
164
  /**
159
165
  * Scroll velocity in pixels per millisecond below which items can return to normal mode.
160
- * @default 1
166
+ * @default 1 native, 3 web
161
167
  */
162
168
  exitVelocity?: number;
163
169
  /**
164
170
  * Time to wait without velocity above exitVelocity before returning to normal mode.
165
- * @default 1000
171
+ * @default 250
166
172
  */
167
173
  exitDelay?: number;
168
174
  /**
169
175
  * Called when the list-level adaptive render changes.
170
176
  */
171
- onChange?: (mode: AdaptiveRender) => void;
177
+ onChange?: (mode: AdaptiveRender, reason: AdaptiveRenderChangeReason) => void;
172
178
  }
173
179
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
174
180
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
@@ -210,6 +216,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
210
216
  * Style applied to each column's wrapper view.
211
217
  */
212
218
  columnWrapperStyle?: ColumnWrapperStyle;
219
+ /**
220
+ * Identity token for the dataset represented by `data`.
221
+ * Change this when replacing the current dataset with a different logical dataset.
222
+ */
223
+ dataKey?: Key;
213
224
  /**
214
225
  * Version token that forces the list to treat data as updated even when the array reference is stable.
215
226
  * Increment or change this when mutating the data array in place.
@@ -378,6 +389,15 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
378
389
  * Called when list layout metrics change.
379
390
  */
380
391
  onMetricsChange?: (metrics: LegendListMetrics) => void;
392
+ /**
393
+ * Called when the first visible item changes. This is emitted from the core range calculation and is cheaper than
394
+ * viewability tracking when you only need to follow the item at the top of the viewport.
395
+ */
396
+ onFirstVisibleItemChanged?: (info: {
397
+ index: number;
398
+ item: ItemT;
399
+ key: string;
400
+ }) => void;
381
401
  /**
382
402
  * Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
383
403
  */