@legendapp/list 3.3.2 → 3.3.3

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,14 @@
1
+ ## 3.3.3
2
+
3
+ - Fix: Row measurements are applied together in a batch, so item positions don't sometimes move after rendering.
4
+ - Fix: `onStartReached` and `onEndReached` no longer bounce between opposite edges during the same scroll gesture after data changes, MVCP adjustments, or residual scroll events.
5
+ - Fix: Prepending items with `maintainVisibleContentPosition` was sometimes flashing the wrong items for one frame
6
+ - Fix: SectionList sticky headers follow their current positions after section data changes. #445
7
+ - Fix: `LegendList` can now be wrapped with `Animated.createAnimatedComponent`.
8
+ - Fix: Horizontal web lists keep their calculated content width, so item containers do not shrink when the content is wider than the viewport.
9
+ - Perf: Lists reuse inactive containers across item types before creating more, preventing the container pool from growing for every previously seen item type.
10
+ - Perf: Reanimated lists skip scroll-offset tracking when neither shared scroll values nor sticky headers need it.
11
+
1
12
  ## 3.3.2
2
13
 
3
14
  - Perf: Recycled rows update their current item without changing the container context, so recycling hooks avoid extra rerenders during scroll.
package/animated.d.ts CHANGED
@@ -8,12 +8,13 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
8
8
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
9
9
  }
10
10
 
11
- type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemInfo${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
11
+ type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
12
12
  type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
13
13
  type ListenerTypeValueMap = {
14
14
  activeStickyIndex: number;
15
15
  alignItemsAtEndPadding: number;
16
16
  anchoredEndSpaceSize: number;
17
+ containerLayoutEpoch: number;
17
18
  animatedScrollY: any;
18
19
  debugComputedScroll: number;
19
20
  debugRawScroll: number;
@@ -49,7 +50,7 @@ type ListenerTypeValueMap = {
49
50
  } & {
50
51
  [K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
51
52
  } & {
52
- [K in ListenerType as K extends `containerItemInfo${number}` ? K : never]: ContainerItemInfo;
53
+ [K in ListenerType as K extends `containerItemIndex${number}` ? K : never]: number;
53
54
  } & {
54
55
  [K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
55
56
  } & {
@@ -59,11 +60,6 @@ type ListenerTypeValueMap = {
59
60
  } & {
60
61
  [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
61
62
  };
62
- interface ContainerItemInfo {
63
- index: number;
64
- itemKey: string;
65
- value: any;
66
- }
67
63
 
68
64
  interface Insets {
69
65
  top: number;
@@ -567,6 +563,10 @@ type LegendListRef$1 = {
567
563
  * Returns the native ScrollView component reference.
568
564
  */
569
565
  getNativeScrollRef(): any;
566
+ /**
567
+ * Returns the underlying animatable scroll component reference.
568
+ */
569
+ getAnimatableRef(): any;
570
570
  /**
571
571
  * Returns the scroll responder instance for handling scroll events.
572
572
  */
@@ -726,7 +726,8 @@ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omi
726
726
  ListFooterComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
727
727
  };
728
728
  type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
729
- type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
729
+ type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
730
+ getAnimatableRef(): React.ElementRef<typeof ScrollViewComponent>;
730
731
  getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
731
732
  getScrollResponder(): ScrollResponderMixin;
732
733
  reportContentInset(inset?: Partial<Insets$1> | null): void;
@@ -9,12 +9,13 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
9
9
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
10
10
  }
11
11
 
12
- type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemInfo${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
12
+ type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
13
13
  type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
14
14
  type ListenerTypeValueMap = {
15
15
  activeStickyIndex: number;
16
16
  alignItemsAtEndPadding: number;
17
17
  anchoredEndSpaceSize: number;
18
+ containerLayoutEpoch: number;
18
19
  animatedScrollY: any;
19
20
  debugComputedScroll: number;
20
21
  debugRawScroll: number;
@@ -50,7 +51,7 @@ type ListenerTypeValueMap = {
50
51
  } & {
51
52
  [K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
52
53
  } & {
53
- [K in ListenerType as K extends `containerItemInfo${number}` ? K : never]: ContainerItemInfo;
54
+ [K in ListenerType as K extends `containerItemIndex${number}` ? K : never]: number;
54
55
  } & {
55
56
  [K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
56
57
  } & {
@@ -60,11 +61,6 @@ type ListenerTypeValueMap = {
60
61
  } & {
61
62
  [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
62
63
  };
63
- interface ContainerItemInfo {
64
- index: number;
65
- itemKey: string;
66
- value: any;
67
- }
68
64
 
69
65
  interface Insets {
70
66
  top: number;
@@ -130,6 +126,10 @@ type LegendListRef$1 = {
130
126
  * Returns the native ScrollView component reference.
131
127
  */
132
128
  getNativeScrollRef(): any;
129
+ /**
130
+ * Returns the underlying animatable scroll component reference.
131
+ */
132
+ getAnimatableRef(): any;
133
133
  /**
134
134
  * Returns the scroll responder instance for handling scroll events.
135
135
  */
@@ -231,7 +231,8 @@ type LegendListRef$1 = {
231
231
  setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
232
232
  };
233
233
 
234
- type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
234
+ type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
235
+ getAnimatableRef(): React.ElementRef<typeof ScrollViewComponent>;
235
236
  getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
236
237
  getScrollResponder(): ScrollResponderMixin;
237
238
  reportContentInset(inset?: Partial<Insets$1> | null): void;
package/keyboard.d.ts CHANGED
@@ -10,12 +10,13 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
10
10
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
11
11
  }
12
12
 
13
- type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemInfo${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
13
+ type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
14
14
  type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
15
15
  type ListenerTypeValueMap = {
16
16
  activeStickyIndex: number;
17
17
  alignItemsAtEndPadding: number;
18
18
  anchoredEndSpaceSize: number;
19
+ containerLayoutEpoch: number;
19
20
  animatedScrollY: any;
20
21
  debugComputedScroll: number;
21
22
  debugRawScroll: number;
@@ -51,7 +52,7 @@ type ListenerTypeValueMap = {
51
52
  } & {
52
53
  [K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
53
54
  } & {
54
- [K in ListenerType as K extends `containerItemInfo${number}` ? K : never]: ContainerItemInfo;
55
+ [K in ListenerType as K extends `containerItemIndex${number}` ? K : never]: number;
55
56
  } & {
56
57
  [K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
57
58
  } & {
@@ -61,11 +62,6 @@ type ListenerTypeValueMap = {
61
62
  } & {
62
63
  [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
63
64
  };
64
- interface ContainerItemInfo {
65
- index: number;
66
- itemKey: string;
67
- value: any;
68
- }
69
65
 
70
66
  interface Insets {
71
67
  top: number;
@@ -144,6 +140,10 @@ type LegendListRef$1 = {
144
140
  * Returns the native ScrollView component reference.
145
141
  */
146
142
  getNativeScrollRef(): any;
143
+ /**
144
+ * Returns the underlying animatable scroll component reference.
145
+ */
146
+ getAnimatableRef(): any;
147
147
  /**
148
148
  * Returns the scroll responder instance for handling scroll events.
149
149
  */
@@ -248,7 +248,8 @@ type LegendListRef$1 = {
248
248
  interface AnchoredEndSpaceConfig extends Omit<AnchoredEndSpaceConfig$1, "includeInEndInset"> {
249
249
  }
250
250
 
251
- type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
251
+ type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
252
+ getAnimatableRef(): React.ElementRef<typeof ScrollViewComponent>;
252
253
  getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
253
254
  getScrollResponder(): ScrollResponderMixin;
254
255
  reportContentInset(inset?: Partial<Insets$1> | null): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.3.2",
3
+ "version": "3.3.3",
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
@@ -8,12 +8,13 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
8
8
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
9
9
  }
10
10
 
11
- type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemInfo${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
11
+ type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
12
12
  type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
13
13
  type ListenerTypeValueMap = {
14
14
  activeStickyIndex: number;
15
15
  alignItemsAtEndPadding: number;
16
16
  anchoredEndSpaceSize: number;
17
+ containerLayoutEpoch: number;
17
18
  animatedScrollY: any;
18
19
  debugComputedScroll: number;
19
20
  debugRawScroll: number;
@@ -49,7 +50,7 @@ type ListenerTypeValueMap = {
49
50
  } & {
50
51
  [K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
51
52
  } & {
52
- [K in ListenerType as K extends `containerItemInfo${number}` ? K : never]: ContainerItemInfo;
53
+ [K in ListenerType as K extends `containerItemIndex${number}` ? K : never]: number;
53
54
  } & {
54
55
  [K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
55
56
  } & {
@@ -59,11 +60,6 @@ type ListenerTypeValueMap = {
59
60
  } & {
60
61
  [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
61
62
  };
62
- interface ContainerItemInfo {
63
- index: number;
64
- itemKey: string;
65
- value: any;
66
- }
67
63
 
68
64
  interface Insets {
69
65
  top: number;
@@ -567,6 +563,10 @@ type LegendListRef$1 = {
567
563
  * Returns the native ScrollView component reference.
568
564
  */
569
565
  getNativeScrollRef(): any;
566
+ /**
567
+ * Returns the underlying animatable scroll component reference.
568
+ */
569
+ getAnimatableRef(): any;
570
570
  /**
571
571
  * Returns the scroll responder instance for handling scroll events.
572
572
  */
@@ -752,7 +752,8 @@ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omi
752
752
  ListFooterComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
753
753
  };
754
754
  type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
755
- type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
755
+ type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
756
+ getAnimatableRef(): React.ElementRef<typeof ScrollViewComponent>;
756
757
  getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
757
758
  getScrollResponder(): ScrollResponderMixin;
758
759
  reportContentInset(inset?: Partial<Insets$1> | null): void;