@legendapp/list 1.0.0-beta.2 → 1.0.0-beta.4

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';
@@ -15,7 +16,7 @@ declare class ScrollAdjustHandler {
15
16
  }
16
17
 
17
18
  type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, 'contentOffset' | 'contentInset' | 'maintainVisibleContentPosition' | 'stickyHeaderIndices'> & {
18
- data: ArrayLike<any> & ItemT[];
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;
@@ -63,6 +63,11 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
63
63
  renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
64
64
  extraData?: any;
65
65
  };
66
+ type AnchoredPosition = {
67
+ type: 'top' | 'bottom';
68
+ relativeCoordinate: number;
69
+ top: number;
70
+ };
66
71
  type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
67
72
  interface InternalState {
68
73
  anchorElement?: {
@@ -76,12 +81,12 @@ interface InternalState {
76
81
  sizes: Map<string, number>;
77
82
  sizesLaidOut: Map<string, number> | undefined;
78
83
  pendingAdjust: number;
79
- animFrameLayout: any;
84
+ waitingForMicrotask: any;
80
85
  isStartReached: boolean;
81
86
  isEndReached: boolean;
82
87
  isAtBottom: boolean;
83
88
  isAtTop: boolean;
84
- data: any[];
89
+ data: readonly any[];
85
90
  idsInFirstRender: Set<string>;
86
91
  hasScrolled: boolean;
87
92
  scrollLength: number;
@@ -110,7 +115,6 @@ interface InternalState {
110
115
  }>;
111
116
  scrollTimer: Timer | undefined;
112
117
  startReachedBlockedByTimer: boolean;
113
- layoutsPending: Set<number>;
114
118
  scrollForNextCalculateItemsInView: {
115
119
  top: number;
116
120
  bottom: number;
@@ -232,4 +236,9 @@ declare const LegendList: <T>(props: LegendListProps<T> & {
232
236
  ref?: ForwardedRef<LegendListRef>;
233
237
  }) => ReactElement;
234
238
 
235
- 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 };
239
+ declare function useViewability(configId: string, callback: ViewabilityCallback): void;
240
+ declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
241
+ declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
242
+ declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, react.Dispatch<any>];
243
+
244
+ 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';
@@ -15,7 +16,7 @@ declare class ScrollAdjustHandler {
15
16
  }
16
17
 
17
18
  type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, 'contentOffset' | 'contentInset' | 'maintainVisibleContentPosition' | 'stickyHeaderIndices'> & {
18
- data: ArrayLike<any> & ItemT[];
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;
@@ -63,6 +63,11 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
63
63
  renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
64
64
  extraData?: any;
65
65
  };
66
+ type AnchoredPosition = {
67
+ type: 'top' | 'bottom';
68
+ relativeCoordinate: number;
69
+ top: number;
70
+ };
66
71
  type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
67
72
  interface InternalState {
68
73
  anchorElement?: {
@@ -76,12 +81,12 @@ interface InternalState {
76
81
  sizes: Map<string, number>;
77
82
  sizesLaidOut: Map<string, number> | undefined;
78
83
  pendingAdjust: number;
79
- animFrameLayout: any;
84
+ waitingForMicrotask: any;
80
85
  isStartReached: boolean;
81
86
  isEndReached: boolean;
82
87
  isAtBottom: boolean;
83
88
  isAtTop: boolean;
84
- data: any[];
89
+ data: readonly any[];
85
90
  idsInFirstRender: Set<string>;
86
91
  hasScrolled: boolean;
87
92
  scrollLength: number;
@@ -110,7 +115,6 @@ interface InternalState {
110
115
  }>;
111
116
  scrollTimer: Timer | undefined;
112
117
  startReachedBlockedByTimer: boolean;
113
- layoutsPending: Set<number>;
114
118
  scrollForNextCalculateItemsInView: {
115
119
  top: number;
116
120
  bottom: number;
@@ -232,4 +236,9 @@ declare const LegendList: <T>(props: LegendListProps<T> & {
232
236
  ref?: ForwardedRef<LegendListRef>;
233
237
  }) => ReactElement;
234
238
 
235
- 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 };
239
+ declare function useViewability(configId: string, callback: ViewabilityCallback): void;
240
+ declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
241
+ declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
242
+ declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, react.Dispatch<any>];
243
+
244
+ 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 };