@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,228 @@
1
+ import * as React from 'react';
2
+ import { ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1, ScrollViewProps } from 'react-native';
3
+ import { KeyboardChatScrollViewProps } from 'react-native-keyboard-controller';
4
+ import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
5
+
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
+ interface AnchoredEndSpaceConfig$1 {
67
+ anchorIndex: number;
68
+ anchorOffset?: number;
69
+ anchorMaxSize?: number;
70
+ includeInEndInset?: boolean;
71
+ onSizeChanged?: (size: number) => void;
72
+ }
73
+ type LegendListState = {
74
+ activeStickyIndex: number;
75
+ contentLength: number;
76
+ data: readonly any[];
77
+ elementAtIndex: (index: number) => any;
78
+ end: number;
79
+ endBuffered: number;
80
+ isAtEnd: boolean;
81
+ isAtStart: boolean;
82
+ isNearEnd: boolean;
83
+ isNearStart: boolean;
84
+ isEndReached: boolean;
85
+ isStartReached: boolean;
86
+ isWithinMaintainScrollAtEndThreshold: boolean;
87
+ listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
88
+ listenToPosition: (key: string, callback: (value: number) => void) => () => void;
89
+ positionAtIndex: (index: number) => number;
90
+ positionByKey: (key: string) => number | undefined;
91
+ scroll: number;
92
+ scrollLength: number;
93
+ scrollVelocity: number;
94
+ sizeAtIndex: (index: number) => number;
95
+ sizes: Map<string, number>;
96
+ start: number;
97
+ startBuffered: number;
98
+ };
99
+ type LegendListRef$1 = {
100
+ /**
101
+ * Displays the scroll indicators momentarily.
102
+ */
103
+ flashScrollIndicators(): void;
104
+ /**
105
+ * Returns the native ScrollView component reference.
106
+ */
107
+ getNativeScrollRef(): any;
108
+ /**
109
+ * Returns the scroll responder instance for handling scroll events.
110
+ */
111
+ getScrollableNode(): any;
112
+ /**
113
+ * Returns the ScrollResponderMixin for advanced scroll handling.
114
+ */
115
+ getScrollResponder(): any;
116
+ /**
117
+ * Returns the internal state of the scroll virtualization.
118
+ */
119
+ getState(): LegendListState;
120
+ /**
121
+ * Scrolls a specific index into view.
122
+ * @param params - Parameters for scrolling.
123
+ * @param params.animated - If true, animates the scroll. Default: true.
124
+ * @param params.index - The index to scroll to.
125
+ */
126
+ scrollIndexIntoView(params: {
127
+ animated?: boolean | undefined;
128
+ index: number;
129
+ }): Promise<void>;
130
+ /**
131
+ * Scrolls a specific index into view.
132
+ * @param params - Parameters for scrolling.
133
+ * @param params.animated - If true, animates the scroll. Default: true.
134
+ * @param params.item - The item to scroll to.
135
+ */
136
+ scrollItemIntoView(params: {
137
+ animated?: boolean | undefined;
138
+ item: any;
139
+ }): Promise<void>;
140
+ /**
141
+ * Scrolls to the end of the list.
142
+ * @param options - Options for scrolling.
143
+ * @param options.animated - If true, animates the scroll. Default: true.
144
+ * @param options.viewOffset - Offset from the target position.
145
+ */
146
+ scrollToEnd(options?: {
147
+ animated?: boolean | undefined;
148
+ viewOffset?: number | undefined;
149
+ }): Promise<void>;
150
+ /**
151
+ * Scrolls to a specific index in the list.
152
+ * @param params - Parameters for scrolling.
153
+ * @param params.animated - If true, animates the scroll. Default: true.
154
+ * @param params.index - The index to scroll to.
155
+ * @param params.viewOffset - Offset from the target position.
156
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
157
+ */
158
+ scrollToIndex(params: {
159
+ animated?: boolean | undefined;
160
+ index: number;
161
+ viewOffset?: number | undefined;
162
+ viewPosition?: number | undefined;
163
+ }): Promise<void>;
164
+ /**
165
+ * Scrolls to a specific item in the list.
166
+ * @param params - Parameters for scrolling.
167
+ * @param params.animated - If true, animates the scroll. Default: true.
168
+ * @param params.item - The item to scroll to.
169
+ * @param params.viewOffset - Offset from the target position.
170
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
171
+ */
172
+ scrollToItem(params: {
173
+ animated?: boolean | undefined;
174
+ item: any;
175
+ viewOffset?: number | undefined;
176
+ viewPosition?: number | undefined;
177
+ }): Promise<void>;
178
+ /**
179
+ * Scrolls to a specific offset in pixels.
180
+ * @param params - Parameters for scrolling.
181
+ * @param params.offset - The pixel offset to scroll to.
182
+ * @param params.animated - If true, animates the scroll. Default: true.
183
+ */
184
+ scrollToOffset(params: {
185
+ offset: number;
186
+ animated?: boolean | undefined;
187
+ }): Promise<void>;
188
+ /**
189
+ * Sets or adds to the offset of the visible content anchor.
190
+ * @param value - The offset to set or add.
191
+ * @param animated - If true, uses Animated to animate the change.
192
+ */
193
+ setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
194
+ /**
195
+ * Sets whether scroll processing is enabled.
196
+ * @param enabled - If true, scroll processing is enabled.
197
+ */
198
+ setScrollProcessingEnabled(enabled: boolean): void;
199
+ /**
200
+ * Clears internal virtualization caches.
201
+ * @param options - Cache clearing options.
202
+ * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
203
+ */
204
+ clearCaches(options?: {
205
+ mode?: "sizes" | "full";
206
+ }): void;
207
+ /**
208
+ * Reports an externally measured content inset. Pass null/undefined to clear.
209
+ * Values are merged on top of props/animated/native insets.
210
+ */
211
+ reportContentInset(inset?: Partial<Insets> | null): void;
212
+ };
213
+
214
+ interface AnchoredEndSpaceConfig extends Omit<AnchoredEndSpaceConfig$1, "includeInEndInset"> {
215
+ }
216
+
217
+ type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
218
+ getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
219
+ getScrollResponder(): ScrollResponderMixin;
220
+ reportContentInset(inset?: Partial<Insets$1> | null): void;
221
+ };
222
+
223
+ type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent" | "blankSpace" | "onContentInsetChange">;
224
+ declare const KeyboardChatLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "anchoredEndSpace" | "renderScrollComponent"> & KeyboardChatScrollViewPropsUnique & {
225
+ anchoredEndSpace?: AnchoredEndSpaceConfig;
226
+ } & React.RefAttributes<LegendListRef>) => React.ReactElement | null;
227
+
228
+ export { KeyboardChatLegendList };
@@ -0,0 +1,105 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var reactNativeKeyboardController = require('react-native-keyboard-controller');
5
+ var reactNativeReanimated = require('react-native-reanimated');
6
+ var reactNative = require('@legendapp/list/react-native');
7
+ var reanimated = require('@legendapp/list/reanimated');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+
29
+ // src/integrations/keyboard-chat.tsx
30
+ var { typedForwardRef, useCombinedRef } = reactNative.internal;
31
+ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(props, forwardedRef) {
32
+ const {
33
+ anchoredEndSpace,
34
+ applyWorkaroundForContentInsetHitTestBug,
35
+ extraContentPadding,
36
+ freeze,
37
+ keyboardLiftBehavior,
38
+ offset,
39
+ ...rest
40
+ } = props;
41
+ const refLegendList = React.useRef(null);
42
+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);
43
+ const blankSpace = reactNativeReanimated.useSharedValue(0);
44
+ React.useEffect(() => {
45
+ if (!anchoredEndSpace) {
46
+ blankSpace.value = 0;
47
+ }
48
+ }, [anchoredEndSpace, blankSpace]);
49
+ const anchoredEndSpaceWithBlankSpace = React.useMemo(() => {
50
+ if (!anchoredEndSpace) {
51
+ return void 0;
52
+ }
53
+ return {
54
+ ...anchoredEndSpace,
55
+ includeInEndInset: true,
56
+ onSizeChanged: (size) => {
57
+ var _a;
58
+ blankSpace.value = size;
59
+ (_a = anchoredEndSpace.onSizeChanged) == null ? void 0 : _a.call(anchoredEndSpace, size);
60
+ }
61
+ };
62
+ }, [anchoredEndSpace, blankSpace]);
63
+ const onContentInsetChange = React.useCallback((insets) => {
64
+ var _a;
65
+ (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
66
+ }, []);
67
+ const memoList = React.useCallback(
68
+ (scrollProps) => {
69
+ return /* @__PURE__ */ React__namespace.createElement(
70
+ reactNativeKeyboardController.KeyboardChatScrollView,
71
+ {
72
+ ...scrollProps,
73
+ applyWorkaroundForContentInsetHitTestBug,
74
+ blankSpace,
75
+ extraContentPadding,
76
+ freeze,
77
+ keyboardLiftBehavior,
78
+ offset,
79
+ onContentInsetChange
80
+ }
81
+ );
82
+ },
83
+ [
84
+ applyWorkaroundForContentInsetHitTestBug,
85
+ blankSpace,
86
+ extraContentPadding,
87
+ freeze,
88
+ keyboardLiftBehavior,
89
+ onContentInsetChange,
90
+ offset
91
+ ]
92
+ );
93
+ const AnimatedLegendListInternal = reanimated.AnimatedLegendList;
94
+ return /* @__PURE__ */ React__namespace.createElement(
95
+ AnimatedLegendListInternal,
96
+ {
97
+ anchoredEndSpace: anchoredEndSpaceWithBlankSpace,
98
+ ref: combinedRef,
99
+ renderScrollComponent: memoList,
100
+ ...rest
101
+ }
102
+ );
103
+ });
104
+
105
+ exports.KeyboardChatLegendList = KeyboardChatLegendList;
@@ -0,0 +1,84 @@
1
+ import * as React from 'react';
2
+ import { useRef, useEffect, useMemo, useCallback } from 'react';
3
+ import { KeyboardChatScrollView } from 'react-native-keyboard-controller';
4
+ import { useSharedValue } from 'react-native-reanimated';
5
+ import { internal } from '@legendapp/list/react-native';
6
+ import { AnimatedLegendList } from '@legendapp/list/reanimated';
7
+
8
+ // src/integrations/keyboard-chat.tsx
9
+ var { typedForwardRef, useCombinedRef } = internal;
10
+ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(props, forwardedRef) {
11
+ const {
12
+ anchoredEndSpace,
13
+ applyWorkaroundForContentInsetHitTestBug,
14
+ extraContentPadding,
15
+ freeze,
16
+ keyboardLiftBehavior,
17
+ offset,
18
+ ...rest
19
+ } = props;
20
+ const refLegendList = useRef(null);
21
+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);
22
+ const blankSpace = useSharedValue(0);
23
+ useEffect(() => {
24
+ if (!anchoredEndSpace) {
25
+ blankSpace.value = 0;
26
+ }
27
+ }, [anchoredEndSpace, blankSpace]);
28
+ const anchoredEndSpaceWithBlankSpace = useMemo(() => {
29
+ if (!anchoredEndSpace) {
30
+ return void 0;
31
+ }
32
+ return {
33
+ ...anchoredEndSpace,
34
+ includeInEndInset: true,
35
+ onSizeChanged: (size) => {
36
+ var _a;
37
+ blankSpace.value = size;
38
+ (_a = anchoredEndSpace.onSizeChanged) == null ? void 0 : _a.call(anchoredEndSpace, size);
39
+ }
40
+ };
41
+ }, [anchoredEndSpace, blankSpace]);
42
+ const onContentInsetChange = useCallback((insets) => {
43
+ var _a;
44
+ (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
45
+ }, []);
46
+ const memoList = useCallback(
47
+ (scrollProps) => {
48
+ return /* @__PURE__ */ React.createElement(
49
+ KeyboardChatScrollView,
50
+ {
51
+ ...scrollProps,
52
+ applyWorkaroundForContentInsetHitTestBug,
53
+ blankSpace,
54
+ extraContentPadding,
55
+ freeze,
56
+ keyboardLiftBehavior,
57
+ offset,
58
+ onContentInsetChange
59
+ }
60
+ );
61
+ },
62
+ [
63
+ applyWorkaroundForContentInsetHitTestBug,
64
+ blankSpace,
65
+ extraContentPadding,
66
+ freeze,
67
+ keyboardLiftBehavior,
68
+ onContentInsetChange,
69
+ offset
70
+ ]
71
+ );
72
+ const AnimatedLegendListInternal = AnimatedLegendList;
73
+ return /* @__PURE__ */ React.createElement(
74
+ AnimatedLegendListInternal,
75
+ {
76
+ anchoredEndSpace: anchoredEndSpaceWithBlankSpace,
77
+ ref: combinedRef,
78
+ renderScrollComponent: memoList,
79
+ ...rest
80
+ }
81
+ );
82
+ });
83
+
84
+ export { KeyboardChatLegendList };
@@ -0,0 +1,216 @@
1
+ import * as React from 'react';
2
+ import { ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1, ScrollViewProps } from 'react-native';
3
+ import { KeyboardChatScrollViewProps } from 'react-native-keyboard-controller';
4
+ import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
5
+
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 KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent" | "onContentInsetChange">;
214
+ declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "renderScrollComponent"> & KeyboardChatScrollViewPropsUnique & React.RefAttributes<LegendListRef>) => React.ReactElement | null;
215
+
216
+ export { KeyboardAvoidingLegendList };
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var reactNativeKeyboardController = require('react-native-keyboard-controller');
5
+ var reactNative = require('@legendapp/list/react-native');
6
+ var reanimated = require('@legendapp/list/reanimated');
7
+
8
+ function _interopNamespace(e) {
9
+ if (e && e.__esModule) return e;
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
+
28
+ // src/integrations/keyboard-test.tsx
29
+ var { typedForwardRef, useCombinedRef } = reactNative.internal;
30
+ var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
31
+ const { extraContentPadding, ...rest } = props;
32
+ const refLegendList = React.useRef(null);
33
+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);
34
+ const onContentInsetChange = React.useCallback((insets) => {
35
+ var _a;
36
+ (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
37
+ }, []);
38
+ const memoList = React.useCallback(
39
+ (listProps) => /* @__PURE__ */ React__namespace.createElement(
40
+ reactNativeKeyboardController.KeyboardChatScrollView,
41
+ {
42
+ ...listProps,
43
+ extraContentPadding,
44
+ onContentInsetChange
45
+ }
46
+ ),
47
+ [extraContentPadding, onContentInsetChange]
48
+ );
49
+ return /* @__PURE__ */ React__namespace.createElement(reanimated.AnimatedLegendList, { ref: combinedRef, renderScrollComponent: memoList, ...rest });
50
+ });
51
+
52
+ exports.KeyboardAvoidingLegendList = KeyboardAvoidingLegendList;