@legendapp/list 1.0.0-beta.10 → 1.0.0-beta.12

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/animated.d.mts CHANGED
@@ -1,9 +1,51 @@
1
- import * as react from 'react';
1
+ import * as React$1 from 'react';
2
2
  import * as _legendapp_list from '@legendapp/list';
3
+ import * as react_native from 'react-native';
3
4
  import { Animated } from 'react-native';
4
5
 
5
- declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: _legendapp_list.LegendListProps<T> & {
6
- ref?: react.ForwardedRef<_legendapp_list.LegendListRef>;
7
- }) => react.ReactElement)>;
6
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
7
+ data: readonly T[];
8
+ initialScrollOffset?: number;
9
+ initialScrollIndex?: number;
10
+ drawDistance?: number;
11
+ recycleItems?: boolean;
12
+ onEndReachedThreshold?: number | null | undefined;
13
+ onStartReachedThreshold?: number | null | undefined;
14
+ maintainScrollAtEnd?: boolean;
15
+ maintainScrollAtEndThreshold?: number;
16
+ alignItemsAtEnd?: boolean;
17
+ maintainVisibleContentPosition?: boolean;
18
+ numColumns?: number;
19
+ refScrollView?: React.Ref<react_native.ScrollView>;
20
+ waitForInitialLayout?: boolean;
21
+ estimatedItemSize?: number;
22
+ getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
23
+ onStartReached?: ((info: {
24
+ distanceFromStart: number;
25
+ }) => void) | null | undefined;
26
+ onEndReached?: ((info: {
27
+ distanceFromEnd: number;
28
+ }) => void) | null | undefined;
29
+ keyExtractor?: ((item: T, index: number) => string) | undefined;
30
+ renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
31
+ ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
32
+ ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
33
+ ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
34
+ ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
35
+ ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
36
+ ItemSeparatorComponent?: React.ComponentType<any>;
37
+ viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
38
+ viewabilityConfig?: _legendapp_list.ViewabilityConfig;
39
+ onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
40
+ onItemSizeChanged?: ((info: {
41
+ size: number;
42
+ previous: number;
43
+ index: number;
44
+ itemKey: string;
45
+ itemData: T;
46
+ }) => void) | undefined;
47
+ renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
48
+ extraData?: any;
49
+ } & React$1.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode)>;
8
50
 
9
51
  export { AnimatedLegendList };
package/animated.d.ts CHANGED
@@ -1,9 +1,51 @@
1
- import * as react from 'react';
1
+ import * as React$1 from 'react';
2
2
  import * as _legendapp_list from '@legendapp/list';
3
+ import * as react_native from 'react-native';
3
4
  import { Animated } from 'react-native';
4
5
 
5
- declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: _legendapp_list.LegendListProps<T> & {
6
- ref?: react.ForwardedRef<_legendapp_list.LegendListRef>;
7
- }) => react.ReactElement)>;
6
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
7
+ data: readonly T[];
8
+ initialScrollOffset?: number;
9
+ initialScrollIndex?: number;
10
+ drawDistance?: number;
11
+ recycleItems?: boolean;
12
+ onEndReachedThreshold?: number | null | undefined;
13
+ onStartReachedThreshold?: number | null | undefined;
14
+ maintainScrollAtEnd?: boolean;
15
+ maintainScrollAtEndThreshold?: number;
16
+ alignItemsAtEnd?: boolean;
17
+ maintainVisibleContentPosition?: boolean;
18
+ numColumns?: number;
19
+ refScrollView?: React.Ref<react_native.ScrollView>;
20
+ waitForInitialLayout?: boolean;
21
+ estimatedItemSize?: number;
22
+ getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
23
+ onStartReached?: ((info: {
24
+ distanceFromStart: number;
25
+ }) => void) | null | undefined;
26
+ onEndReached?: ((info: {
27
+ distanceFromEnd: number;
28
+ }) => void) | null | undefined;
29
+ keyExtractor?: ((item: T, index: number) => string) | undefined;
30
+ renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
31
+ ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
32
+ ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
33
+ ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
34
+ ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
35
+ ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
36
+ ItemSeparatorComponent?: React.ComponentType<any>;
37
+ viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
38
+ viewabilityConfig?: _legendapp_list.ViewabilityConfig;
39
+ onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
40
+ onItemSizeChanged?: ((info: {
41
+ size: number;
42
+ previous: number;
43
+ index: number;
44
+ itemKey: string;
45
+ itemData: T;
46
+ }) => void) | undefined;
47
+ renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
48
+ extraData?: any;
49
+ } & React$1.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode)>;
8
50
 
9
51
  export { AnimatedLegendList };
package/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import * as react from 'react';
2
- import { ComponentProps, ReactNode, ForwardedRef, ReactElement } from 'react';
1
+ import * as React$1 from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ import * as react_native from 'react-native';
3
4
  import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
4
5
  import Animated from 'react-native-reanimated';
5
6
 
@@ -9,13 +10,12 @@ declare class ScrollAdjustHandler {
9
10
  private pendingAdjust;
10
11
  private busy;
11
12
  private context;
12
- private firstAdjust;
13
13
  constructor(ctx: any);
14
14
  requestAdjust(adjust: number, onAdjusted: (diff: number) => void): void;
15
15
  getAppliedAdjust(): number;
16
16
  }
17
17
 
18
- type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, 'contentOffset' | 'contentInset' | 'maintainVisibleContentPosition' | 'stickyHeaderIndices'> & {
18
+ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
19
19
  data: ReadonlyArray<ItemT>;
20
20
  initialScrollOffset?: number;
21
21
  initialScrollIndex?: number;
@@ -64,7 +64,7 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
64
64
  extraData?: any;
65
65
  };
66
66
  type AnchoredPosition = {
67
- type: 'top' | 'bottom';
67
+ type: "top" | "bottom";
68
68
  relativeCoordinate: number;
69
69
  top: number;
70
70
  };
@@ -232,14 +232,57 @@ interface LegendListRecyclingState<T> {
232
232
  index: number;
233
233
  prevIndex: number | undefined;
234
234
  }
235
+ type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
236
+ declare const typedForwardRef: TypedForwardRef;
235
237
 
236
- declare const LegendList: <T>(props: LegendListProps<T> & {
237
- ref?: ForwardedRef<LegendListRef>;
238
- }) => ReactElement;
238
+ declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
239
+ data: readonly T[];
240
+ initialScrollOffset?: number;
241
+ initialScrollIndex?: number;
242
+ drawDistance?: number;
243
+ recycleItems?: boolean;
244
+ onEndReachedThreshold?: number | null | undefined;
245
+ onStartReachedThreshold?: number | null | undefined;
246
+ maintainScrollAtEnd?: boolean;
247
+ maintainScrollAtEndThreshold?: number;
248
+ alignItemsAtEnd?: boolean;
249
+ maintainVisibleContentPosition?: boolean;
250
+ numColumns?: number;
251
+ refScrollView?: React$1.Ref<ScrollView>;
252
+ waitForInitialLayout?: boolean;
253
+ estimatedItemSize?: number;
254
+ getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
255
+ onStartReached?: ((info: {
256
+ distanceFromStart: number;
257
+ }) => void) | null | undefined;
258
+ onEndReached?: ((info: {
259
+ distanceFromEnd: number;
260
+ }) => void) | null | undefined;
261
+ keyExtractor?: ((item: T, index: number) => string) | undefined;
262
+ renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
263
+ ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
264
+ ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
265
+ ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
266
+ ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
267
+ ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
268
+ ItemSeparatorComponent?: React$1.ComponentType<any>;
269
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
270
+ viewabilityConfig?: ViewabilityConfig;
271
+ onViewableItemsChanged?: OnViewableItemsChanged | undefined;
272
+ onItemSizeChanged?: ((info: {
273
+ size: number;
274
+ previous: number;
275
+ index: number;
276
+ itemKey: string;
277
+ itemData: T;
278
+ }) => void) | undefined;
279
+ renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
280
+ extraData?: any;
281
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
239
282
 
240
283
  declare function useViewability(configId: string, callback: ViewabilityCallback): void;
241
284
  declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
242
285
  declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
243
- declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, react.Dispatch<any>];
286
+ declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, React$1.Dispatch<any>];
244
287
 
245
- export { type AnchoredPosition, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
288
+ export { type AnchoredPosition, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type TypedForwardRef, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import * as react from 'react';
2
- import { ComponentProps, ReactNode, ForwardedRef, ReactElement } from 'react';
1
+ import * as React$1 from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ import * as react_native from 'react-native';
3
4
  import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
4
5
  import Animated from 'react-native-reanimated';
5
6
 
@@ -9,13 +10,12 @@ declare class ScrollAdjustHandler {
9
10
  private pendingAdjust;
10
11
  private busy;
11
12
  private context;
12
- private firstAdjust;
13
13
  constructor(ctx: any);
14
14
  requestAdjust(adjust: number, onAdjusted: (diff: number) => void): void;
15
15
  getAppliedAdjust(): number;
16
16
  }
17
17
 
18
- type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, 'contentOffset' | 'contentInset' | 'maintainVisibleContentPosition' | 'stickyHeaderIndices'> & {
18
+ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
19
19
  data: ReadonlyArray<ItemT>;
20
20
  initialScrollOffset?: number;
21
21
  initialScrollIndex?: number;
@@ -64,7 +64,7 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
64
64
  extraData?: any;
65
65
  };
66
66
  type AnchoredPosition = {
67
- type: 'top' | 'bottom';
67
+ type: "top" | "bottom";
68
68
  relativeCoordinate: number;
69
69
  top: number;
70
70
  };
@@ -232,14 +232,57 @@ interface LegendListRecyclingState<T> {
232
232
  index: number;
233
233
  prevIndex: number | undefined;
234
234
  }
235
+ type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
236
+ declare const typedForwardRef: TypedForwardRef;
235
237
 
236
- declare const LegendList: <T>(props: LegendListProps<T> & {
237
- ref?: ForwardedRef<LegendListRef>;
238
- }) => ReactElement;
238
+ declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
239
+ data: readonly T[];
240
+ initialScrollOffset?: number;
241
+ initialScrollIndex?: number;
242
+ drawDistance?: number;
243
+ recycleItems?: boolean;
244
+ onEndReachedThreshold?: number | null | undefined;
245
+ onStartReachedThreshold?: number | null | undefined;
246
+ maintainScrollAtEnd?: boolean;
247
+ maintainScrollAtEndThreshold?: number;
248
+ alignItemsAtEnd?: boolean;
249
+ maintainVisibleContentPosition?: boolean;
250
+ numColumns?: number;
251
+ refScrollView?: React$1.Ref<ScrollView>;
252
+ waitForInitialLayout?: boolean;
253
+ estimatedItemSize?: number;
254
+ getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
255
+ onStartReached?: ((info: {
256
+ distanceFromStart: number;
257
+ }) => void) | null | undefined;
258
+ onEndReached?: ((info: {
259
+ distanceFromEnd: number;
260
+ }) => void) | null | undefined;
261
+ keyExtractor?: ((item: T, index: number) => string) | undefined;
262
+ renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
263
+ ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
264
+ ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
265
+ ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
266
+ ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
267
+ ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
268
+ ItemSeparatorComponent?: React$1.ComponentType<any>;
269
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
270
+ viewabilityConfig?: ViewabilityConfig;
271
+ onViewableItemsChanged?: OnViewableItemsChanged | undefined;
272
+ onItemSizeChanged?: ((info: {
273
+ size: number;
274
+ previous: number;
275
+ index: number;
276
+ itemKey: string;
277
+ itemData: T;
278
+ }) => void) | undefined;
279
+ renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
280
+ extraData?: any;
281
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
239
282
 
240
283
  declare function useViewability(configId: string, callback: ViewabilityCallback): void;
241
284
  declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
242
285
  declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
243
- declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, react.Dispatch<any>];
286
+ declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, React$1.Dispatch<any>];
244
287
 
245
- export { type AnchoredPosition, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
288
+ export { type AnchoredPosition, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type TypedForwardRef, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };