@legendapp/list 3.3.11 → 3.5.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,17 @@
1
+ ## 3.5.0
2
+
3
+ - Feat: Add `scrollElement` so web lists can share an ancestor element's scrollbar
4
+ - Fix: Stopping scrolling keeps rows prepared in the last scroll direction instead of shifting the render buffer backward.
5
+ - Perf: Single-column lists do less layout work during initial rendering and scrolling when item sizes and data are unchanged.
6
+
7
+ ## 3.4.0
8
+
9
+ - Feat: Add `onReady`, called after each initial placement and scroll cycle completes, including cycles restarted by a `dataKey` change.
10
+ - Fix: End-following and animated programmatic scrolling now stay aligned through footer, viewport, and native layout changes, while user dragging cancels queued follow requests.
11
+ - Fix: `onStartReached` and `onEndReached` callbacks now fire reliably after layout and dataset resets, including short lists and gestures that cross a threshold over multiple events.
12
+ - Fix: Numeric `initialScrollIndex` values that target the last row now include the footer when opening at the end.
13
+ - Perf: Fast scrolling now prepares rows in the direction you are moving, including upward and end-aligned scrolling, so the next content is ready sooner.
14
+
1
15
  ## 3.3.11
2
16
 
3
17
  - Fix: `scrollToEnd` and `maintainScrollAtEnd` keep reaching the end as content changes, while scrolling away or requesting another position cancels automatic following.
package/README.md CHANGED
@@ -112,6 +112,39 @@ export default LegendListExample
112
112
 
113
113
  ---
114
114
 
115
+ ### Sharing a scrollbar on the web
116
+
117
+ React DOM lists can use an ancestor element's scrollbar with `scrollElement`:
118
+
119
+ ```tsx
120
+ import { LegendList } from "@legendapp/list/react";
121
+ import { useState } from "react";
122
+
123
+ function History({ swaps, renderSwap }) {
124
+ const [scrollElement, setScrollElement] = useState<HTMLDivElement | null>(null);
125
+
126
+ return (
127
+ <div ref={setScrollElement} style={{ height: 600, overflow: "auto" }}>
128
+ <ProfileHeader />
129
+ <LegendList
130
+ data={swaps}
131
+ renderItem={renderSwap}
132
+ keyExtractor={(swap) => swap.id}
133
+ scrollElement={scrollElement}
134
+ />
135
+ </div>
136
+ );
137
+ }
138
+ ```
139
+
140
+ Use a state-backed callback ref so the list receives the element after mounting and whenever it changes. `null` waits for an external element; `undefined` keeps the default list-owned scrollbar. The element must be an ancestor of the list. Keep the list's own height unconstrained so its content contributes to the parent's scroll range.
141
+
142
+ Multiple lists can share the same element, including lists in separate columns. Each uses the owner's viewport on the scroll axis and its own width/height on the cross axis. Content above the list is accounted for automatically, including preceding content that resizes. `scrollToIndex`, `scrollToOffset`, and `scrollToEnd` remain list-relative and move the shared owner.
143
+
144
+ `maintainVisibleContentPosition` anchors changes to the list's own rows; it does not freeze the layout of surrounding content. An offscreen list does not pull the owner back into view to apply a measurement correction.
145
+
146
+ `useWindowScroll` continues to use the browser window. Both modes share the same web implementation; `scrollElement` takes precedence when provided. As with window scrolling, external mode does not configure the owner's scrollbar styling or CSS snapping. It is not supported with `renderScrollComponent`.
147
+
115
148
  ## How to Build
116
149
 
117
150
  1. `bun i`
package/animated.d.ts CHANGED
@@ -333,6 +333,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
333
333
  onLoad?: (info: {
334
334
  elapsedTimeInMs: number;
335
335
  }) => void;
336
+ /**
337
+ * Called after layout and initial scrolling complete, including after a
338
+ * dataKey reset. Unlike onLoad, this runs for each initial placement cycle.
339
+ * Ordinary data updates do not trigger it unless they restart initial placement.
340
+ */
341
+ onReady?: () => void;
336
342
  /**
337
343
  * Called when list layout metrics change.
338
344
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.3.11",
3
+ "version": "3.5.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
@@ -333,6 +333,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
333
333
  onLoad?: (info: {
334
334
  elapsedTimeInMs: number;
335
335
  }) => void;
336
+ /**
337
+ * Called after layout and initial scrolling complete, including after a
338
+ * dataKey reset. Unlike onLoad, this runs for each initial placement cycle.
339
+ * Ordinary data updates do not trigger it unless they restart initial placement.
340
+ */
341
+ onReady?: () => void;
336
342
  /**
337
343
  * Called when list layout metrics change.
338
344
  */