@legendapp/list 0.3.0 → 0.3.2

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
@@ -16,6 +16,10 @@ In addition to normal FlatList features:
16
16
 
17
17
  ## Usage
18
18
 
19
+ ## Install
20
+
21
+ `bun add @legendapp/list` or `npm install @legendapp/list` or `yarn add @legendapp/list`
22
+
19
23
  ### Props
20
24
 
21
25
  We suggest using all of the required props and additionally `keyExtractor` to improve performance when adding/removing items.
package/index.d.mts CHANGED
@@ -1,18 +1,19 @@
1
1
  import { ComponentProps, ReactNode, ForwardedRef, ReactElement } from 'react';
2
- import { ScrollView, StyleProp, ViewStyle } from 'react-native';
2
+ import { ScrollView, StyleProp, ViewStyle, ViewToken } from 'react-native';
3
3
 
4
4
  type LegendListProps<T> = Omit<ComponentProps<typeof ScrollView>, 'contentOffset'> & {
5
5
  data: ArrayLike<any> & T[];
6
6
  initialScrollOffset?: number;
7
7
  initialScrollIndex?: number;
8
8
  drawDistance?: number;
9
- initialContainers?: number;
9
+ initialNumContainers?: number;
10
10
  recycleItems?: boolean;
11
11
  onEndReachedThreshold?: number | null | undefined;
12
12
  maintainScrollAtEnd?: boolean;
13
13
  maintainScrollAtEndThreshold?: number;
14
14
  alignItemsAtEnd?: boolean;
15
- estimatedItemLength: (index: number) => number;
15
+ estimatedItemSize: number;
16
+ getEstimatedItemSize?: (index: number, item: T) => number;
16
17
  onEndReached?: ((info: {
17
18
  distanceFromEnd: number;
18
19
  }) => void) | null | undefined;
@@ -24,6 +25,10 @@ type LegendListProps<T> = Omit<ComponentProps<typeof ScrollView>, 'contentOffset
24
25
  ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
25
26
  ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
26
27
  ItemSeparatorComponent?: React.ComponentType<any>;
28
+ onViewableItemsChanged?: ((info: {
29
+ viewableItems: Array<ViewToken<T>>;
30
+ changed: Array<ViewToken<T>>;
31
+ }) => void) | null | undefined;
27
32
  };
28
33
  interface ViewableRange<T> {
29
34
  startBuffered: number;
package/index.d.ts CHANGED
@@ -1,18 +1,19 @@
1
1
  import { ComponentProps, ReactNode, ForwardedRef, ReactElement } from 'react';
2
- import { ScrollView, StyleProp, ViewStyle } from 'react-native';
2
+ import { ScrollView, StyleProp, ViewStyle, ViewToken } from 'react-native';
3
3
 
4
4
  type LegendListProps<T> = Omit<ComponentProps<typeof ScrollView>, 'contentOffset'> & {
5
5
  data: ArrayLike<any> & T[];
6
6
  initialScrollOffset?: number;
7
7
  initialScrollIndex?: number;
8
8
  drawDistance?: number;
9
- initialContainers?: number;
9
+ initialNumContainers?: number;
10
10
  recycleItems?: boolean;
11
11
  onEndReachedThreshold?: number | null | undefined;
12
12
  maintainScrollAtEnd?: boolean;
13
13
  maintainScrollAtEndThreshold?: number;
14
14
  alignItemsAtEnd?: boolean;
15
- estimatedItemLength: (index: number) => number;
15
+ estimatedItemSize: number;
16
+ getEstimatedItemSize?: (index: number, item: T) => number;
16
17
  onEndReached?: ((info: {
17
18
  distanceFromEnd: number;
18
19
  }) => void) | null | undefined;
@@ -24,6 +25,10 @@ type LegendListProps<T> = Omit<ComponentProps<typeof ScrollView>, 'contentOffset
24
25
  ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
25
26
  ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
26
27
  ItemSeparatorComponent?: React.ComponentType<any>;
28
+ onViewableItemsChanged?: ((info: {
29
+ viewableItems: Array<ViewToken<T>>;
30
+ changed: Array<ViewToken<T>>;
31
+ }) => void) | null | undefined;
27
32
  };
28
33
  interface ViewableRange<T> {
29
34
  startBuffered: number;