@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/CHANGELOG.md +14 -0
- package/animated.d.ts +24 -4
- package/package.json +1 -1
- package/react-native.d.ts +25 -5
- package/react-native.js +2734 -2572
- package/react-native.mjs +2734 -2572
- package/react-native.web.d.ts +25 -5
- package/react-native.web.js +4641 -4464
- package/react-native.web.mjs +4641 -4464
- package/react.d.ts +25 -5
- package/react.js +4641 -4464
- package/react.mjs +4641 -4464
- package/reanimated.d.ts +24 -4
- package/section-list.d.ts +24 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 3.3.0
|
|
2
|
+
|
|
3
|
+
- 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`.
|
|
4
|
+
- Feat: `experimental_adaptiveRender.onChange` now receives a reason (`initial`, `ready`, or `scroll`) so item components can tell why the render mode changed.
|
|
5
|
+
- 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.
|
|
6
|
+
- 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.
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
## 3.2.0
|
|
10
|
+
|
|
11
|
+
- Feat: Add `onFirstVisibleItemChanged` so apps can track the item at the top of the viewport without setting up full viewability callbacks.
|
|
12
|
+
- Feat: Add `experimental_adaptiveRender.initialMode` for choosing whether adaptive rendering starts in `normal` or `light` mode before the list is ready.
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
1
15
|
## 3.1.2
|
|
2
16
|
|
|
3
17
|
- Fix: On Android, end-aligned lists could double apply scroll clamping during MVCP and be slightly underscrolled
|
package/animated.d.ts
CHANGED
|
@@ -92,26 +92,32 @@ 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 {
|
|
97
|
+
/**
|
|
98
|
+
* Mode to use before the list is ready to render.
|
|
99
|
+
* @default "normal"
|
|
100
|
+
*/
|
|
101
|
+
initialMode?: AdaptiveRender;
|
|
96
102
|
/**
|
|
97
103
|
* Scroll velocity in pixels per millisecond above which items should switch to light mode.
|
|
98
|
-
* @default
|
|
104
|
+
* @default 3 native, 6 web
|
|
99
105
|
*/
|
|
100
106
|
enterVelocity?: number;
|
|
101
107
|
/**
|
|
102
108
|
* Scroll velocity in pixels per millisecond below which items can return to normal mode.
|
|
103
|
-
* @default 1
|
|
109
|
+
* @default 1 native, 3 web
|
|
104
110
|
*/
|
|
105
111
|
exitVelocity?: number;
|
|
106
112
|
/**
|
|
107
113
|
* Time to wait without velocity above exitVelocity before returning to normal mode.
|
|
108
|
-
* @default
|
|
114
|
+
* @default 250
|
|
109
115
|
*/
|
|
110
116
|
exitDelay?: number;
|
|
111
117
|
/**
|
|
112
118
|
* Called when the list-level adaptive render changes.
|
|
113
119
|
*/
|
|
114
|
-
onChange?: (mode: AdaptiveRender) => void;
|
|
120
|
+
onChange?: (mode: AdaptiveRender, reason: AdaptiveRenderChangeReason) => void;
|
|
115
121
|
}
|
|
116
122
|
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
|
|
117
123
|
interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
@@ -153,6 +159,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
153
159
|
* Style applied to each column's wrapper view.
|
|
154
160
|
*/
|
|
155
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;
|
|
156
167
|
/**
|
|
157
168
|
* Version token that forces the list to treat data as updated even when the array reference is stable.
|
|
158
169
|
* Increment or change this when mutating the data array in place.
|
|
@@ -321,6 +332,15 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
321
332
|
* Called when list layout metrics change.
|
|
322
333
|
*/
|
|
323
334
|
onMetricsChange?: (metrics: LegendListMetrics) => void;
|
|
335
|
+
/**
|
|
336
|
+
* Called when the first visible item changes. This is emitted from the core range calculation and is cheaper than
|
|
337
|
+
* viewability tracking when you only need to follow the item at the top of the viewport.
|
|
338
|
+
*/
|
|
339
|
+
onFirstVisibleItemChanged?: (info: {
|
|
340
|
+
index: number;
|
|
341
|
+
item: ItemT;
|
|
342
|
+
key: string;
|
|
343
|
+
}) => void;
|
|
324
344
|
/**
|
|
325
345
|
* Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
|
|
326
346
|
*/
|
package/package.json
CHANGED
package/react-native.d.ts
CHANGED
|
@@ -92,26 +92,32 @@ 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 {
|
|
97
|
+
/**
|
|
98
|
+
* Mode to use before the list is ready to render.
|
|
99
|
+
* @default "normal"
|
|
100
|
+
*/
|
|
101
|
+
initialMode?: AdaptiveRender;
|
|
96
102
|
/**
|
|
97
103
|
* Scroll velocity in pixels per millisecond above which items should switch to light mode.
|
|
98
|
-
* @default
|
|
104
|
+
* @default 3 native, 6 web
|
|
99
105
|
*/
|
|
100
106
|
enterVelocity?: number;
|
|
101
107
|
/**
|
|
102
108
|
* Scroll velocity in pixels per millisecond below which items can return to normal mode.
|
|
103
|
-
* @default 1
|
|
109
|
+
* @default 1 native, 3 web
|
|
104
110
|
*/
|
|
105
111
|
exitVelocity?: number;
|
|
106
112
|
/**
|
|
107
113
|
* Time to wait without velocity above exitVelocity before returning to normal mode.
|
|
108
|
-
* @default
|
|
114
|
+
* @default 250
|
|
109
115
|
*/
|
|
110
116
|
exitDelay?: number;
|
|
111
117
|
/**
|
|
112
118
|
* Called when the list-level adaptive render changes.
|
|
113
119
|
*/
|
|
114
|
-
onChange?: (mode: AdaptiveRender) => void;
|
|
120
|
+
onChange?: (mode: AdaptiveRender, reason: AdaptiveRenderChangeReason) => void;
|
|
115
121
|
}
|
|
116
122
|
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
|
|
117
123
|
interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
@@ -153,6 +159,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
153
159
|
* Style applied to each column's wrapper view.
|
|
154
160
|
*/
|
|
155
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;
|
|
156
167
|
/**
|
|
157
168
|
* Version token that forces the list to treat data as updated even when the array reference is stable.
|
|
158
169
|
* Increment or change this when mutating the data array in place.
|
|
@@ -321,6 +332,15 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
321
332
|
* Called when list layout metrics change.
|
|
322
333
|
*/
|
|
323
334
|
onMetricsChange?: (metrics: LegendListMetrics) => void;
|
|
335
|
+
/**
|
|
336
|
+
* Called when the first visible item changes. This is emitted from the core range calculation and is cheaper than
|
|
337
|
+
* viewability tracking when you only need to follow the item at the top of the viewport.
|
|
338
|
+
*/
|
|
339
|
+
onFirstVisibleItemChanged?: (info: {
|
|
340
|
+
index: number;
|
|
341
|
+
item: ItemT;
|
|
342
|
+
key: string;
|
|
343
|
+
}) => void;
|
|
324
344
|
/**
|
|
325
345
|
* Configures the adaptive render signal. Items can use this to render a lighter version while scrolling quickly.
|
|
326
346
|
*/
|
|
@@ -750,4 +770,4 @@ declare function useSyncLayout(): () => void;
|
|
|
750
770
|
|
|
751
771
|
declare const LegendList: LegendListComponent;
|
|
752
772
|
|
|
753
|
-
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 };
|