@legendapp/list 0.3.1 → 0.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/README.md CHANGED
@@ -10,12 +10,16 @@ This is an early release to test and gather feedback. It's not used in productio
10
10
 
11
11
  In addition to normal FlatList features:
12
12
 
13
- - Dynamic layouts supported. Just use the `estimatedItemLength` prop to give a close estimate so that layouts aren't too far off, and positions will adjust while rendering.
13
+ - Dynamic layouts supported. Just use the `estimatedItemSize` prop to give a close estimate so that layouts aren't too far off, and positions will adjust while rendering.
14
14
  - `maintainScrollAtEnd`: If true and scroll is within `maintainScrollAtEndThreshold * screen height` then changing items or heights will scroll to the bottom. This can be useful for chat interfaces.
15
15
  - `recycleItems` prop enables toggling recycling of list items. If enabled it will reuse item components for improved performance, but it will reuse any local state in items. So if you have local state in items you likely want this disabled.
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.
@@ -26,7 +30,7 @@ We suggest using all of the required props and additionally `keyExtractor` to im
26
30
  interface PropsRequired {
27
31
  data: ArrayLike<any> & T[];
28
32
  renderItem: (props: LegendListRenderItemInfo<T>) => ReactNode;
29
- estimatedItemLength: (index: number) => number;
33
+ estimatedItemSize: number;
30
34
  }
31
35
  ```
32
36
 
package/index.d.mts CHANGED
@@ -6,13 +6,14 @@ type LegendListProps<T> = Omit<ComponentProps<typeof ScrollView>, 'contentOffset
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;
package/index.d.ts CHANGED
@@ -6,13 +6,14 @@ type LegendListProps<T> = Omit<ComponentProps<typeof ScrollView>, 'contentOffset
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;