@legendapp/list 3.0.0-beta.5 → 3.0.0-beta.51

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.
Files changed (51) hide show
  1. package/.DS_Store +0 -0
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +9 -2
  4. package/animated.d.ts +657 -5
  5. package/animated.js +2 -2
  6. package/animated.mjs +1 -1
  7. package/index.d.ts +1316 -11
  8. package/index.js +4023 -1277
  9. package/index.mjs +4022 -1278
  10. package/index.native.js +3784 -1333
  11. package/index.native.mjs +3772 -1323
  12. package/keyboard-chat.d.ts +228 -0
  13. package/keyboard-chat.js +105 -0
  14. package/keyboard-chat.mjs +84 -0
  15. package/keyboard-test.d.ts +216 -0
  16. package/keyboard-test.js +52 -0
  17. package/keyboard-test.mjs +31 -0
  18. package/keyboard.d.ts +216 -8
  19. package/keyboard.js +355 -64
  20. package/keyboard.mjs +358 -66
  21. package/package.json +68 -1
  22. package/{types-YNdphn_A.d.mts → react-native.d.ts} +306 -263
  23. package/react-native.js +6019 -0
  24. package/react-native.mjs +5990 -0
  25. package/{types-YNdphn_A.d.ts → react-native.web.d.ts} +367 -261
  26. package/react-native.web.js +6553 -0
  27. package/react-native.web.mjs +6524 -0
  28. package/react.d.ts +776 -0
  29. package/react.js +6553 -0
  30. package/react.mjs +6524 -0
  31. package/reanimated.d.ts +679 -8
  32. package/reanimated.js +226 -29
  33. package/reanimated.mjs +228 -31
  34. package/section-list.d.ts +661 -5
  35. package/section-list.js +50 -3675
  36. package/section-list.mjs +48 -3674
  37. package/animated.d.mts +0 -9
  38. package/index.d.mts +0 -23
  39. package/index.native.d.mts +0 -23
  40. package/index.native.d.ts +0 -23
  41. package/keyboard-controller.d.mts +0 -12
  42. package/keyboard-controller.d.ts +0 -12
  43. package/keyboard-controller.js +0 -69
  44. package/keyboard-controller.mjs +0 -48
  45. package/keyboard.d.mts +0 -13
  46. package/reanimated.d.mts +0 -18
  47. package/section-list.d.mts +0 -113
  48. package/section-list.native.d.mts +0 -113
  49. package/section-list.native.d.ts +0 -113
  50. package/section-list.native.js +0 -3711
  51. package/section-list.native.mjs +0 -3690
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import { useRef, useCallback } from 'react';
3
+ import { KeyboardChatScrollView } from 'react-native-keyboard-controller';
4
+ import { internal } from '@legendapp/list/react-native';
5
+ import { AnimatedLegendList } from '@legendapp/list/reanimated';
6
+
7
+ // src/integrations/keyboard-test.tsx
8
+ var { typedForwardRef, useCombinedRef } = internal;
9
+ var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
10
+ const { extraContentPadding, ...rest } = props;
11
+ const refLegendList = useRef(null);
12
+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);
13
+ const onContentInsetChange = useCallback((insets) => {
14
+ var _a;
15
+ (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
16
+ }, []);
17
+ const memoList = useCallback(
18
+ (listProps) => /* @__PURE__ */ React.createElement(
19
+ KeyboardChatScrollView,
20
+ {
21
+ ...listProps,
22
+ extraContentPadding,
23
+ onContentInsetChange
24
+ }
25
+ ),
26
+ [extraContentPadding, onContentInsetChange]
27
+ );
28
+ return /* @__PURE__ */ React.createElement(AnimatedLegendList, { ref: combinedRef, renderScrollComponent: memoList, ...rest });
29
+ });
30
+
31
+ export { KeyboardAvoidingLegendList };
package/keyboard.d.ts CHANGED
@@ -1,13 +1,221 @@
1
1
  import * as React from 'react';
2
- import { Insets } from 'react-native';
3
- import { ReanimatedScrollEvent } from 'react-native-reanimated/lib/typescript/hook/commonTypes';
4
- import { LegendListRef } from '@legendapp/list';
2
+ import { ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1 } from 'react-native';
3
+ import { ScrollEvent, ScrollHandlerProcessed } from 'react-native-reanimated';
5
4
  import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
6
5
 
7
- declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "contentInset"> & {
8
- onScroll?: (event: ReanimatedScrollEvent) => void;
9
- contentInset?: Insets;
6
+ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
7
+ data: boolean;
8
+ size: boolean;
9
+ shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
10
+ }
11
+
12
+ type ListenerType = "activeStickyIndex" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
13
+ type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
14
+ type ListenerTypeValueMap = {
15
+ activeStickyIndex: number;
16
+ anchoredEndSpaceSize: number;
17
+ animatedScrollY: any;
18
+ debugComputedScroll: number;
19
+ debugRawScroll: number;
20
+ extraData: any;
21
+ footerSize: number;
22
+ headerSize: number;
23
+ isAtEnd: boolean;
24
+ isAtStart: boolean;
25
+ isNearEnd: boolean;
26
+ isNearStart: boolean;
27
+ isWithinMaintainScrollAtEndThreshold: boolean;
28
+ lastItemKeys: string[];
29
+ lastPositionUpdate: number;
30
+ maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
31
+ numColumns: number;
32
+ numContainers: number;
33
+ numContainersPooled: number;
34
+ otherAxisSize: number;
35
+ readyToRender: boolean;
36
+ scrollAdjust: number;
37
+ scrollAdjustPending: number;
38
+ scrollAdjustUserOffset: number;
39
+ scrollSize: {
40
+ width: number;
41
+ height: number;
42
+ };
43
+ snapToOffsets: number[];
44
+ stylePaddingTop: number;
45
+ totalSize: number;
46
+ } & {
47
+ [K in ListenerType as K extends `containerItemKey${number}` ? K : never]: string;
48
+ } & {
49
+ [K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
50
+ } & {
51
+ [K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
52
+ } & {
53
+ [K in ListenerType as K extends `containerColumn${number}` ? K : never]: number;
54
+ } & {
55
+ [K in ListenerType as K extends `containerSpan${number}` ? K : never]: number;
56
+ } & {
57
+ [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
58
+ };
59
+
60
+ interface Insets {
61
+ top: number;
62
+ left: number;
63
+ bottom: number;
64
+ right: number;
65
+ }
66
+ type LegendListState = {
67
+ activeStickyIndex: number;
68
+ contentLength: number;
69
+ data: readonly any[];
70
+ elementAtIndex: (index: number) => any;
71
+ end: number;
72
+ endBuffered: number;
73
+ isAtEnd: boolean;
74
+ isAtStart: boolean;
75
+ isNearEnd: boolean;
76
+ isNearStart: boolean;
77
+ isEndReached: boolean;
78
+ isStartReached: boolean;
79
+ isWithinMaintainScrollAtEndThreshold: boolean;
80
+ listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
81
+ listenToPosition: (key: string, callback: (value: number) => void) => () => void;
82
+ positionAtIndex: (index: number) => number;
83
+ positionByKey: (key: string) => number | undefined;
84
+ scroll: number;
85
+ scrollLength: number;
86
+ scrollVelocity: number;
87
+ sizeAtIndex: (index: number) => number;
88
+ sizes: Map<string, number>;
89
+ start: number;
90
+ startBuffered: number;
91
+ };
92
+ type LegendListRef$1 = {
93
+ /**
94
+ * Displays the scroll indicators momentarily.
95
+ */
96
+ flashScrollIndicators(): void;
97
+ /**
98
+ * Returns the native ScrollView component reference.
99
+ */
100
+ getNativeScrollRef(): any;
101
+ /**
102
+ * Returns the scroll responder instance for handling scroll events.
103
+ */
104
+ getScrollableNode(): any;
105
+ /**
106
+ * Returns the ScrollResponderMixin for advanced scroll handling.
107
+ */
108
+ getScrollResponder(): any;
109
+ /**
110
+ * Returns the internal state of the scroll virtualization.
111
+ */
112
+ getState(): LegendListState;
113
+ /**
114
+ * Scrolls a specific index into view.
115
+ * @param params - Parameters for scrolling.
116
+ * @param params.animated - If true, animates the scroll. Default: true.
117
+ * @param params.index - The index to scroll to.
118
+ */
119
+ scrollIndexIntoView(params: {
120
+ animated?: boolean | undefined;
121
+ index: number;
122
+ }): Promise<void>;
123
+ /**
124
+ * Scrolls a specific index into view.
125
+ * @param params - Parameters for scrolling.
126
+ * @param params.animated - If true, animates the scroll. Default: true.
127
+ * @param params.item - The item to scroll to.
128
+ */
129
+ scrollItemIntoView(params: {
130
+ animated?: boolean | undefined;
131
+ item: any;
132
+ }): Promise<void>;
133
+ /**
134
+ * Scrolls to the end of the list.
135
+ * @param options - Options for scrolling.
136
+ * @param options.animated - If true, animates the scroll. Default: true.
137
+ * @param options.viewOffset - Offset from the target position.
138
+ */
139
+ scrollToEnd(options?: {
140
+ animated?: boolean | undefined;
141
+ viewOffset?: number | undefined;
142
+ }): Promise<void>;
143
+ /**
144
+ * Scrolls to a specific index in the list.
145
+ * @param params - Parameters for scrolling.
146
+ * @param params.animated - If true, animates the scroll. Default: true.
147
+ * @param params.index - The index to scroll to.
148
+ * @param params.viewOffset - Offset from the target position.
149
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
150
+ */
151
+ scrollToIndex(params: {
152
+ animated?: boolean | undefined;
153
+ index: number;
154
+ viewOffset?: number | undefined;
155
+ viewPosition?: number | undefined;
156
+ }): Promise<void>;
157
+ /**
158
+ * Scrolls to a specific item in the list.
159
+ * @param params - Parameters for scrolling.
160
+ * @param params.animated - If true, animates the scroll. Default: true.
161
+ * @param params.item - The item to scroll to.
162
+ * @param params.viewOffset - Offset from the target position.
163
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
164
+ */
165
+ scrollToItem(params: {
166
+ animated?: boolean | undefined;
167
+ item: any;
168
+ viewOffset?: number | undefined;
169
+ viewPosition?: number | undefined;
170
+ }): Promise<void>;
171
+ /**
172
+ * Scrolls to a specific offset in pixels.
173
+ * @param params - Parameters for scrolling.
174
+ * @param params.offset - The pixel offset to scroll to.
175
+ * @param params.animated - If true, animates the scroll. Default: true.
176
+ */
177
+ scrollToOffset(params: {
178
+ offset: number;
179
+ animated?: boolean | undefined;
180
+ }): Promise<void>;
181
+ /**
182
+ * Sets or adds to the offset of the visible content anchor.
183
+ * @param value - The offset to set or add.
184
+ * @param animated - If true, uses Animated to animate the change.
185
+ */
186
+ setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
187
+ /**
188
+ * Sets whether scroll processing is enabled.
189
+ * @param enabled - If true, scroll processing is enabled.
190
+ */
191
+ setScrollProcessingEnabled(enabled: boolean): void;
192
+ /**
193
+ * Clears internal virtualization caches.
194
+ * @param options - Cache clearing options.
195
+ * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
196
+ */
197
+ clearCaches(options?: {
198
+ mode?: "sizes" | "full";
199
+ }): void;
200
+ /**
201
+ * Reports an externally measured content inset. Pass null/undefined to clear.
202
+ * Values are merged on top of props/animated/native insets.
203
+ */
204
+ reportContentInset(inset?: Partial<Insets> | null): void;
205
+ };
206
+
207
+ type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
208
+ getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
209
+ getScrollResponder(): ScrollResponderMixin;
210
+ reportContentInset(inset?: Partial<Insets$1> | null): void;
211
+ };
212
+
213
+ type KeyboardOnScrollCallback = (event: ScrollEvent) => void;
214
+ type KeyboardOnScrollHandler = KeyboardOnScrollCallback | ScrollHandlerProcessed<Record<string, unknown>>;
215
+ declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "automaticallyAdjustContentInsets" | "contentInset"> & {
216
+ onScroll?: KeyboardOnScrollHandler;
217
+ contentInset?: Insets$1 | undefined;
10
218
  safeAreaInsetBottom?: number;
11
- } & React.RefAttributes<LegendListRef>) => React.ReactNode;
219
+ } & React.RefAttributes<LegendListRef>) => React.ReactElement | null;
12
220
 
13
- export { KeyboardAvoidingLegendList, KeyboardAvoidingLegendList as LegendList };
221
+ export { KeyboardAvoidingLegendList };