@legendapp/list 3.1.2 → 3.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.2.0
2
+
3
+ - Feat: Add `onFirstVisibleItemChanged` so apps can track the item at the top of the viewport without setting up full viewability callbacks.
4
+ - Feat: Add `experimental_adaptiveRender.initialMode` for choosing whether adaptive rendering starts in `normal` or `light` mode before the list is ready.
5
+ - Perf: On Fabric, replacement container measurements are batched into the same layout pass, so scroll anchoring and item positioning recalculate once instead of once per pending row.
6
+
1
7
  ## 3.1.2
2
8
 
3
9
  - Fix: On Android, end-aligned lists could double apply scroll clamping during MVCP and be slightly underscrolled
package/animated.d.ts CHANGED
@@ -93,19 +93,24 @@ type ViewStyle = Record<string, unknown>;
93
93
  type StyleProp<T> = T | T[] | null | undefined | false;
94
94
  type AdaptiveRender = "normal" | "light";
95
95
  interface AdaptiveRenderConfig {
96
+ /**
97
+ * Mode to use before the list is ready to render.
98
+ * @default "normal"
99
+ */
100
+ initialMode?: AdaptiveRender;
96
101
  /**
97
102
  * Scroll velocity in pixels per millisecond above which items should switch to light mode.
98
- * @default 4
103
+ * @default 3 native, 6 web
99
104
  */
100
105
  enterVelocity?: number;
101
106
  /**
102
107
  * Scroll velocity in pixels per millisecond below which items can return to normal mode.
103
- * @default 1
108
+ * @default 1 native, 3 web
104
109
  */
105
110
  exitVelocity?: number;
106
111
  /**
107
112
  * Time to wait without velocity above exitVelocity before returning to normal mode.
108
- * @default 1000
113
+ * @default 250
109
114
  */
110
115
  exitDelay?: number;
111
116
  /**
@@ -321,6 +326,15 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
321
326
  * Called when list layout metrics change.
322
327
  */
323
328
  onMetricsChange?: (metrics: LegendListMetrics) => void;
329
+ /**
330
+ * Called when the first visible item changes. This is emitted from the core range calculation and is cheaper than
331
+ * viewability tracking when you only need to follow the item at the top of the viewport.
332
+ */
333
+ onFirstVisibleItemChanged?: (info: {
334
+ index: number;
335
+ item: ItemT;
336
+ key: string;
337
+ }) => void;
324
338
  /**
325
339
  * Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
326
340
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.1.2",
3
+ "version": "3.2.0",
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
@@ -93,19 +93,24 @@ type ViewStyle = Record<string, unknown>;
93
93
  type StyleProp<T> = T | T[] | null | undefined | false;
94
94
  type AdaptiveRender = "normal" | "light";
95
95
  interface AdaptiveRenderConfig {
96
+ /**
97
+ * Mode to use before the list is ready to render.
98
+ * @default "normal"
99
+ */
100
+ initialMode?: AdaptiveRender;
96
101
  /**
97
102
  * Scroll velocity in pixels per millisecond above which items should switch to light mode.
98
- * @default 4
103
+ * @default 3 native, 6 web
99
104
  */
100
105
  enterVelocity?: number;
101
106
  /**
102
107
  * Scroll velocity in pixels per millisecond below which items can return to normal mode.
103
- * @default 1
108
+ * @default 1 native, 3 web
104
109
  */
105
110
  exitVelocity?: number;
106
111
  /**
107
112
  * Time to wait without velocity above exitVelocity before returning to normal mode.
108
- * @default 1000
113
+ * @default 250
109
114
  */
110
115
  exitDelay?: number;
111
116
  /**
@@ -321,6 +326,15 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
321
326
  * Called when list layout metrics change.
322
327
  */
323
328
  onMetricsChange?: (metrics: LegendListMetrics) => void;
329
+ /**
330
+ * Called when the first visible item changes. This is emitted from the core range calculation and is cheaper than
331
+ * viewability tracking when you only need to follow the item at the top of the viewport.
332
+ */
333
+ onFirstVisibleItemChanged?: (info: {
334
+ index: number;
335
+ item: ItemT;
336
+ key: string;
337
+ }) => void;
324
338
  /**
325
339
  * Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
326
340
  */