@legendapp/list 3.0.0-beta.40 → 3.0.0-beta.42

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/README.md CHANGED
@@ -26,7 +26,7 @@ Beyond standard `FlatList` capabilities:
26
26
  * `recycleItems`: (boolean) Toggles item component recycling.
27
27
  * `true`: Reuses item components for optimal performance. Be cautious if your item components contain local state, as it might be reused unexpectedly.
28
28
  * `false` (default): Creates new item components every time. Less performant but safer if items have complex internal state.
29
- * `maintainScrollAtEnd`: (boolean) If `true` and the user is scrolled near the bottom (within `maintainScrollAtEndThreshold * screen height`), the list automatically scrolls to the end when items are added or heights change. Useful for chat interfaces.
29
+ * `maintainScrollAtEnd`: Keeps the list pinned to the tail when the user is already near the end (within `maintainScrollAtEndThreshold * screen height`). Pass `true` for all triggers, or `{ animated?: boolean, on?: { dataChange?: boolean, layout?: boolean, itemLayout?: boolean } }`; if `on` is omitted, the object form also enables all triggers.
30
30
  * `maintainVisibleContentPosition`: Keeps visible content steady during size/layout changes while scrolling up or when items resize above the viewport (default). Pass `true` or `{ data: true }` to also anchor during data updates; pass `false` to disable; pass `{ size: false }` to opt out of scroll-time stabilization.
31
31
  * `alignItemsAtEnd`: (boolean) Useful for chat UIs, content smaller than the View will be aligned to the bottom of the list.
32
32
 
package/animated.d.ts CHANGED
@@ -210,6 +210,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
210
210
  ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
211
211
  /**
212
212
  * If true, auto-scrolls to end when new items are added.
213
+ * Use an options object to opt into specific triggers and control whether that scroll is animated.
213
214
  * @default false
214
215
  */
215
216
  maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions;
@@ -387,10 +388,22 @@ interface AlwaysRenderConfig {
387
388
  indices?: number[];
388
389
  keys?: string[];
389
390
  }
391
+ interface MaintainScrollAtEndOnOptions {
392
+ dataChange?: boolean;
393
+ itemLayout?: boolean;
394
+ layout?: boolean;
395
+ }
390
396
  interface MaintainScrollAtEndOptions {
391
- onLayout?: boolean;
392
- onItemLayout?: boolean;
393
- onDataChange?: boolean;
397
+ /**
398
+ * Whether maintainScrollAtEnd should animate when it scrolls to the end.
399
+ */
400
+ animated?: boolean;
401
+ /**
402
+ * Which events should keep the list pinned to the end.
403
+ * - If omitted, object values default to all triggers.
404
+ * - If provided, only the keys set to `true` are enabled.
405
+ */
406
+ on?: MaintainScrollAtEndOnOptions;
394
407
  }
395
408
  interface ColumnWrapperStyle {
396
409
  rowGap?: number;
package/index.d.ts CHANGED
@@ -283,6 +283,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
283
283
  ListHeaderComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
284
284
  /**
285
285
  * If true, auto-scrolls to end when new items are added.
286
+ * Use an options object to opt into specific triggers and control whether that scroll is animated.
286
287
  * @default false
287
288
  */
288
289
  maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions$1;
@@ -461,10 +462,22 @@ interface AlwaysRenderConfig$1 {
461
462
  indices?: number[];
462
463
  keys?: string[];
463
464
  }
465
+ interface MaintainScrollAtEndOnOptions$1 {
466
+ dataChange?: boolean;
467
+ itemLayout?: boolean;
468
+ layout?: boolean;
469
+ }
464
470
  interface MaintainScrollAtEndOptions$1 {
465
- onLayout?: boolean;
466
- onItemLayout?: boolean;
467
- onDataChange?: boolean;
471
+ /**
472
+ * Whether maintainScrollAtEnd should animate when it scrolls to the end.
473
+ */
474
+ animated?: boolean;
475
+ /**
476
+ * Which events should keep the list pinned to the end.
477
+ * - If omitted, object values default to all triggers.
478
+ * - If provided, only the keys set to `true` are enabled.
479
+ */
480
+ on?: MaintainScrollAtEndOnOptions$1;
468
481
  }
469
482
  interface ColumnWrapperStyle$1 {
470
483
  rowGap?: number;
@@ -488,6 +501,7 @@ interface ScrollTarget$1 {
488
501
  itemSize?: number;
489
502
  offset: number;
490
503
  precomputedWithViewOffset?: boolean;
504
+ targetOffset?: number;
491
505
  viewOffset?: number;
492
506
  viewPosition?: number;
493
507
  }
@@ -525,7 +539,18 @@ interface InternalState$1 {
525
539
  ignoreScrollFromMVCPTimeout?: any;
526
540
  indexByKey: Map<string, number>;
527
541
  initialAnchor?: InitialScrollAnchor$1;
542
+ initialNativeScrollWatchdog?: {
543
+ startScroll: number;
544
+ targetOffset: number;
545
+ };
546
+ initialScrollLastDidFinish: boolean;
547
+ initialScrollLastTarget: ScrollIndexWithOffsetAndContentOffset$1 | undefined;
548
+ initialScrollLastTargetUsesOffset: boolean;
549
+ initialScrollPreviousDataLength: number;
550
+ initialScrollRetryLastLength: number | undefined;
551
+ initialScrollRetryWindowUntil: number;
528
552
  initialScroll: ScrollIndexWithOffsetAndContentOffset$1 | undefined;
553
+ initialScrollUsesOffset: boolean;
529
554
  isAtEnd: boolean;
530
555
  isAtStart: boolean;
531
556
  isEndReached: boolean | null;
@@ -549,6 +574,13 @@ interface InternalState$1 {
549
574
  nativeMarginTop: number;
550
575
  needsOtherAxisSize?: boolean;
551
576
  otherAxisSize?: number;
577
+ pendingNativeMVCPAdjust?: {
578
+ amount: number;
579
+ furthestProgressTowardAmount: number;
580
+ manualApplied: number;
581
+ startScroll: number;
582
+ };
583
+ pendingMaintainScrollAtEnd?: boolean;
552
584
  pendingTotalSize?: number;
553
585
  pendingScrollResolve?: (() => void) | undefined;
554
586
  positions: Array<number | undefined>;
@@ -613,7 +645,7 @@ interface InternalState$1 {
613
645
  initialContainerPoolRatio: number;
614
646
  itemsAreEqual: LegendListPropsInternal["itemsAreEqual"];
615
647
  keyExtractor: LegendListPropsInternal["keyExtractor"];
616
- maintainScrollAtEnd: boolean | MaintainScrollAtEndOptions$1;
648
+ maintainScrollAtEnd: MaintainScrollAtEndNormalized | undefined;
617
649
  maintainScrollAtEndThreshold: number | undefined;
618
650
  maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized$1;
619
651
  numColumns: number;
@@ -911,6 +943,8 @@ type StickyHeaderConfig = StickyHeaderConfig$1;
911
943
  /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
912
944
  type AlwaysRenderConfig = AlwaysRenderConfig$1;
913
945
  /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
946
+ type MaintainScrollAtEndOnOptions = MaintainScrollAtEndOnOptions$1;
947
+ /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
914
948
  type MaintainScrollAtEndOptions = MaintainScrollAtEndOptions$1;
915
949
  /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
916
950
  type ColumnWrapperStyle = ColumnWrapperStyle$1;
@@ -1201,4 +1235,4 @@ declare function useSyncLayout(): () => void;
1201
1235
  /** @deprecated Use `@legendapp/list/react-native` or `@legendapp/list/react` for strict typing */
1202
1236
  declare const LegendList: LegendListComponent;
1203
1237
 
1204
- export { type AccessibilityActionEvent, type AccessibilityRole, type AccessibilityState, type AccessibilityValue, type AlwaysRenderConfig, type BaseScrollViewProps, type ColorValue, type ColumnWrapperStyle, type GestureResponderEvent, type GetRenderedItem, type GetRenderedItemResult, type InitialScrollAnchor, type Insets, type InternalState, type LayoutChangeEvent, type LayoutRectangle, LegendList, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListScrollerRef, type LegendListState, type LooseAccessibilityActionEvent, type LooseAccessibilityRole, type LooseAccessibilityState, type LooseAccessibilityValue, type LooseColorValue, type LooseGestureResponderEvent, type LoosePointerEvent, type LooseRefreshControlProps, type LooseRole, type LooseScrollViewProps, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type MaintainVisibleContentPositionNormalized, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type PointProp, type PointerEvent, type RefreshControlProps, type Role, type ScrollEventTargetLike, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type ScrollTarget, type ScrollViewPropsLoose, type ScrollableNodeLike, type StickyHeaderConfig, type StyleProp, type ThresholdSnapshot, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
1238
+ export { type AccessibilityActionEvent, type AccessibilityRole, type AccessibilityState, type AccessibilityValue, type AlwaysRenderConfig, type BaseScrollViewProps, type ColorValue, type ColumnWrapperStyle, type GestureResponderEvent, type GetRenderedItem, type GetRenderedItemResult, type InitialScrollAnchor, type Insets, type InternalState, type LayoutChangeEvent, type LayoutRectangle, LegendList, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListScrollerRef, type LegendListState, type LooseAccessibilityActionEvent, type LooseAccessibilityRole, type LooseAccessibilityState, type LooseAccessibilityValue, type LooseColorValue, type LooseGestureResponderEvent, type LoosePointerEvent, type LooseRefreshControlProps, type LooseRole, type LooseScrollViewProps, type MaintainScrollAtEndOnOptions, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type MaintainVisibleContentPositionNormalized, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type PointProp, type PointerEvent, type RefreshControlProps, type Role, type ScrollEventTargetLike, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type ScrollTarget, type ScrollViewPropsLoose, type ScrollableNodeLike, type StickyHeaderConfig, type StyleProp, type ThresholdSnapshot, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };