@legendapp/list 1.0.0-beta.1 → 1.0.0-beta.11

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,9 @@
1
- import * as React from 'react';
1
+ import * as react from 'react';
2
2
  import * as _legendapp_list from '@legendapp/list';
3
3
  import { Animated } from 'react-native';
4
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
+ ref?: react.ForwardedRef<_legendapp_list.LegendListRef>;
7
+ }) => react.ReactElement)>;
8
8
 
9
9
  export { AnimatedLegendList };
package/animated.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import * as React from 'react';
1
+ import * as react from 'react';
2
2
  import * as _legendapp_list from '@legendapp/list';
3
3
  import { Animated } from 'react-native';
4
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
+ ref?: react.ForwardedRef<_legendapp_list.LegendListRef>;
7
+ }) => react.ReactElement)>;
8
8
 
9
9
  export { AnimatedLegendList };
package/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as react from 'react';
1
2
  import { ComponentProps, ReactNode, ForwardedRef, ReactElement } from 'react';
2
3
  import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
3
4
  import Animated from 'react-native-reanimated';
@@ -14,8 +15,8 @@ declare class ScrollAdjustHandler {
14
15
  getAppliedAdjust(): number;
15
16
  }
16
17
 
17
- type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, 'contentOffset' | 'contentInset' | 'maintainVisibleContentPosition' | 'stickyHeaderIndices'> & {
18
- data: ArrayLike<any> & ItemT[];
18
+ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
19
+ data: ReadonlyArray<ItemT>;
19
20
  initialScrollOffset?: number;
20
21
  initialScrollIndex?: number;
21
22
  drawDistance?: number;
@@ -44,7 +45,6 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
44
45
  ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
45
46
  ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
46
47
  ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
47
- ListEmptyComponentStyle?: StyleProp<ViewStyle> | undefined;
48
48
  ItemSeparatorComponent?: React.ComponentType<any>;
49
49
  viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
50
50
  viewabilityConfig?: ViewabilityConfig;
@@ -61,6 +61,12 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
61
61
  * @default (props) => <ScrollView {...props} />
62
62
  */
63
63
  renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
64
+ extraData?: any;
65
+ };
66
+ type AnchoredPosition = {
67
+ type: "top" | "bottom";
68
+ relativeCoordinate: number;
69
+ top: number;
64
70
  };
65
71
  type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
66
72
  interface InternalState {
@@ -75,12 +81,12 @@ interface InternalState {
75
81
  sizes: Map<string, number>;
76
82
  sizesLaidOut: Map<string, number> | undefined;
77
83
  pendingAdjust: number;
78
- animFrameLayout: any;
84
+ waitingForMicrotask: any;
79
85
  isStartReached: boolean;
80
86
  isEndReached: boolean;
81
87
  isAtBottom: boolean;
82
88
  isAtTop: boolean;
83
- data: any[];
89
+ data: readonly any[];
84
90
  idsInFirstRender: Set<string>;
85
91
  hasScrolled: boolean;
86
92
  scrollLength: number;
@@ -109,12 +115,12 @@ interface InternalState {
109
115
  }>;
110
116
  scrollTimer: Timer | undefined;
111
117
  startReachedBlockedByTimer: boolean;
112
- layoutsPending: Set<number>;
113
118
  scrollForNextCalculateItemsInView: {
114
119
  top: number;
115
120
  bottom: number;
116
121
  } | undefined;
117
122
  enableScrollForNextCalculateItemsInView: boolean;
123
+ minIndexSizeChanged: number | undefined;
118
124
  }
119
125
  interface ViewableRange<T> {
120
126
  startBuffered: number;
@@ -231,4 +237,9 @@ declare const LegendList: <T>(props: LegendListProps<T> & {
231
237
  ref?: ForwardedRef<LegendListRef>;
232
238
  }) => ReactElement;
233
239
 
234
- export { 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 };
240
+ declare function useViewability(configId: string, callback: ViewabilityCallback): void;
241
+ declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
242
+ declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
243
+ declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, react.Dispatch<any>];
244
+
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 };
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as react from 'react';
1
2
  import { ComponentProps, ReactNode, ForwardedRef, ReactElement } from 'react';
2
3
  import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
3
4
  import Animated from 'react-native-reanimated';
@@ -14,8 +15,8 @@ declare class ScrollAdjustHandler {
14
15
  getAppliedAdjust(): number;
15
16
  }
16
17
 
17
- type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, 'contentOffset' | 'contentInset' | 'maintainVisibleContentPosition' | 'stickyHeaderIndices'> & {
18
- data: ArrayLike<any> & ItemT[];
18
+ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
19
+ data: ReadonlyArray<ItemT>;
19
20
  initialScrollOffset?: number;
20
21
  initialScrollIndex?: number;
21
22
  drawDistance?: number;
@@ -44,7 +45,6 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
44
45
  ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
45
46
  ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
46
47
  ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
47
- ListEmptyComponentStyle?: StyleProp<ViewStyle> | undefined;
48
48
  ItemSeparatorComponent?: React.ComponentType<any>;
49
49
  viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
50
50
  viewabilityConfig?: ViewabilityConfig;
@@ -61,6 +61,12 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
61
61
  * @default (props) => <ScrollView {...props} />
62
62
  */
63
63
  renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
64
+ extraData?: any;
65
+ };
66
+ type AnchoredPosition = {
67
+ type: "top" | "bottom";
68
+ relativeCoordinate: number;
69
+ top: number;
64
70
  };
65
71
  type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
66
72
  interface InternalState {
@@ -75,12 +81,12 @@ interface InternalState {
75
81
  sizes: Map<string, number>;
76
82
  sizesLaidOut: Map<string, number> | undefined;
77
83
  pendingAdjust: number;
78
- animFrameLayout: any;
84
+ waitingForMicrotask: any;
79
85
  isStartReached: boolean;
80
86
  isEndReached: boolean;
81
87
  isAtBottom: boolean;
82
88
  isAtTop: boolean;
83
- data: any[];
89
+ data: readonly any[];
84
90
  idsInFirstRender: Set<string>;
85
91
  hasScrolled: boolean;
86
92
  scrollLength: number;
@@ -109,12 +115,12 @@ interface InternalState {
109
115
  }>;
110
116
  scrollTimer: Timer | undefined;
111
117
  startReachedBlockedByTimer: boolean;
112
- layoutsPending: Set<number>;
113
118
  scrollForNextCalculateItemsInView: {
114
119
  top: number;
115
120
  bottom: number;
116
121
  } | undefined;
117
122
  enableScrollForNextCalculateItemsInView: boolean;
123
+ minIndexSizeChanged: number | undefined;
118
124
  }
119
125
  interface ViewableRange<T> {
120
126
  startBuffered: number;
@@ -231,4 +237,9 @@ declare const LegendList: <T>(props: LegendListProps<T> & {
231
237
  ref?: ForwardedRef<LegendListRef>;
232
238
  }) => ReactElement;
233
239
 
234
- export { 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 };
240
+ declare function useViewability(configId: string, callback: ViewabilityCallback): void;
241
+ declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
242
+ declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
243
+ declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, react.Dispatch<any>];
244
+
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 };