@legendapp/list 3.0.0-beta.32 → 3.0.0-beta.34
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/README.md +7 -1
- package/animated.d.ts +605 -6
- package/animated.js +2 -2
- package/animated.mjs +1 -1
- package/index.d.ts +503 -118
- package/index.js +607 -275
- package/index.mjs +607 -275
- package/index.native.js +348 -189
- package/index.native.mjs +347 -188
- package/keyboard-controller.d.ts +616 -6
- package/keyboard-controller.js +2 -2
- package/keyboard-controller.mjs +1 -1
- package/keyboard.d.ts +204 -8
- package/keyboard.js +68 -53
- package/keyboard.mjs +71 -55
- package/{index.d.mts → list-react-native.d.ts} +138 -42
- package/list-react-native.js +4348 -0
- package/list-react-native.mjs +4318 -0
- package/{index.native.d.mts → list-react.d.ts} +195 -42
- package/list-react.js +4709 -0
- package/list-react.mjs +4679 -0
- package/package.json +52 -1
- package/reanimated.d.ts +605 -7
- package/reanimated.js +180 -12
- package/reanimated.mjs +177 -9
- package/section-list.d.ts +615 -14
- package/section-list.js +6 -6
- package/section-list.mjs +1 -1
- package/animated.d.mts +0 -9
- package/animated.native.d.mts +0 -9
- package/animated.native.d.ts +0 -9
- package/animated.native.js +0 -9
- package/animated.native.mjs +0 -7
- package/index.native.d.ts +0 -817
- package/keyboard-controller.d.mts +0 -12
- package/keyboard-controller.native.d.mts +0 -12
- package/keyboard-controller.native.d.ts +0 -12
- package/keyboard-controller.native.js +0 -69
- package/keyboard-controller.native.mjs +0 -48
- package/keyboard.d.mts +0 -13
- package/keyboard.native.d.mts +0 -13
- package/keyboard.native.d.ts +0 -13
- package/keyboard.native.js +0 -399
- package/keyboard.native.mjs +0 -377
- package/reanimated.d.mts +0 -18
- package/reanimated.native.d.mts +0 -18
- package/reanimated.native.d.ts +0 -18
- package/reanimated.native.js +0 -89
- package/reanimated.native.mjs +0 -65
- package/section-list.d.mts +0 -112
- package/section-list.native.d.mts +0 -112
- package/section-list.native.d.ts +0 -112
- package/section-list.native.js +0 -293
- package/section-list.native.mjs +0 -271
package/keyboard.d.ts
CHANGED
|
@@ -1,13 +1,209 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Insets } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
import { LegendListRef } from '@legendapp/list';
|
|
1
|
+
import * as React$1 from 'react';
|
|
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
|
|
|
6
|
+
type ListenerType = "activeStickyIndex" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
|
|
7
|
+
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
8
|
+
type ListenerTypeValueMap = {
|
|
9
|
+
activeStickyIndex: number;
|
|
10
|
+
animatedScrollY: any;
|
|
11
|
+
debugComputedScroll: number;
|
|
12
|
+
debugRawScroll: number;
|
|
13
|
+
extraData: any;
|
|
14
|
+
footerSize: number;
|
|
15
|
+
headerSize: number;
|
|
16
|
+
lastItemKeys: string[];
|
|
17
|
+
lastPositionUpdate: number;
|
|
18
|
+
maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
|
|
19
|
+
numColumns: number;
|
|
20
|
+
numContainers: number;
|
|
21
|
+
numContainersPooled: number;
|
|
22
|
+
otherAxisSize: number;
|
|
23
|
+
readyToRender: boolean;
|
|
24
|
+
scrollAdjust: number;
|
|
25
|
+
scrollAdjustPending: number;
|
|
26
|
+
scrollAdjustUserOffset: number;
|
|
27
|
+
scrollSize: {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
snapToOffsets: number[];
|
|
32
|
+
stylePaddingTop: number;
|
|
33
|
+
totalSize: number;
|
|
34
|
+
} & {
|
|
35
|
+
[K in ListenerType as K extends `containerItemKey${number}` ? K : never]: string;
|
|
36
|
+
} & {
|
|
37
|
+
[K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
|
|
38
|
+
} & {
|
|
39
|
+
[K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
|
|
40
|
+
} & {
|
|
41
|
+
[K in ListenerType as K extends `containerColumn${number}` ? K : never]: number;
|
|
42
|
+
} & {
|
|
43
|
+
[K in ListenerType as K extends `containerSpan${number}` ? K : never]: number;
|
|
44
|
+
} & {
|
|
45
|
+
[K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
interface Insets {
|
|
49
|
+
top: number;
|
|
50
|
+
left: number;
|
|
51
|
+
bottom: number;
|
|
52
|
+
right: number;
|
|
53
|
+
}
|
|
54
|
+
interface MaintainVisibleContentPositionNormalized<ItemT = any> {
|
|
55
|
+
data: boolean;
|
|
56
|
+
size: boolean;
|
|
57
|
+
shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
58
|
+
}
|
|
59
|
+
type LegendListState = {
|
|
60
|
+
activeStickyIndex: number;
|
|
61
|
+
contentLength: number;
|
|
62
|
+
data: readonly any[];
|
|
63
|
+
elementAtIndex: (index: number) => any;
|
|
64
|
+
end: number;
|
|
65
|
+
endBuffered: number;
|
|
66
|
+
isAtEnd: boolean;
|
|
67
|
+
isAtStart: boolean;
|
|
68
|
+
listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
|
|
69
|
+
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
70
|
+
positionAtIndex: (index: number) => number;
|
|
71
|
+
positionByKey: (key: string) => number | undefined;
|
|
72
|
+
scroll: number;
|
|
73
|
+
scrollLength: number;
|
|
74
|
+
scrollVelocity: number;
|
|
75
|
+
sizeAtIndex: (index: number) => number;
|
|
76
|
+
sizes: Map<string, number>;
|
|
77
|
+
start: number;
|
|
78
|
+
startBuffered: number;
|
|
79
|
+
};
|
|
80
|
+
type LegendListRef$1 = {
|
|
81
|
+
/**
|
|
82
|
+
* Displays the scroll indicators momentarily.
|
|
83
|
+
*/
|
|
84
|
+
flashScrollIndicators(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the native ScrollView component reference.
|
|
87
|
+
*/
|
|
88
|
+
getNativeScrollRef(): any;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the scroll responder instance for handling scroll events.
|
|
91
|
+
*/
|
|
92
|
+
getScrollableNode(): any;
|
|
93
|
+
/**
|
|
94
|
+
* Returns the ScrollResponderMixin for advanced scroll handling.
|
|
95
|
+
*/
|
|
96
|
+
getScrollResponder(): any;
|
|
97
|
+
/**
|
|
98
|
+
* Returns the internal state of the scroll virtualization.
|
|
99
|
+
*/
|
|
100
|
+
getState(): LegendListState;
|
|
101
|
+
/**
|
|
102
|
+
* Scrolls a specific index into view.
|
|
103
|
+
* @param params - Parameters for scrolling.
|
|
104
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
105
|
+
* @param params.index - The index to scroll to.
|
|
106
|
+
*/
|
|
107
|
+
scrollIndexIntoView(params: {
|
|
108
|
+
animated?: boolean | undefined;
|
|
109
|
+
index: number;
|
|
110
|
+
}): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Scrolls a specific index into view.
|
|
113
|
+
* @param params - Parameters for scrolling.
|
|
114
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
115
|
+
* @param params.item - The item to scroll to.
|
|
116
|
+
*/
|
|
117
|
+
scrollItemIntoView(params: {
|
|
118
|
+
animated?: boolean | undefined;
|
|
119
|
+
item: any;
|
|
120
|
+
}): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Scrolls to the end of the list.
|
|
123
|
+
* @param options - Options for scrolling.
|
|
124
|
+
* @param options.animated - If true, animates the scroll. Default: true.
|
|
125
|
+
* @param options.viewOffset - Offset from the target position.
|
|
126
|
+
*/
|
|
127
|
+
scrollToEnd(options?: {
|
|
128
|
+
animated?: boolean | undefined;
|
|
129
|
+
viewOffset?: number | undefined;
|
|
130
|
+
}): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Scrolls to a specific index in the list.
|
|
133
|
+
* @param params - Parameters for scrolling.
|
|
134
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
135
|
+
* @param params.index - The index to scroll to.
|
|
136
|
+
* @param params.viewOffset - Offset from the target position.
|
|
137
|
+
* @param params.viewPosition - Position of the item in the viewport (0 to 1).
|
|
138
|
+
*/
|
|
139
|
+
scrollToIndex(params: {
|
|
140
|
+
animated?: boolean | undefined;
|
|
141
|
+
index: number;
|
|
142
|
+
viewOffset?: number | undefined;
|
|
143
|
+
viewPosition?: number | undefined;
|
|
144
|
+
}): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Scrolls to a specific item in the list.
|
|
147
|
+
* @param params - Parameters for scrolling.
|
|
148
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
149
|
+
* @param params.item - The item to scroll to.
|
|
150
|
+
* @param params.viewOffset - Offset from the target position.
|
|
151
|
+
* @param params.viewPosition - Position of the item in the viewport (0 to 1).
|
|
152
|
+
*/
|
|
153
|
+
scrollToItem(params: {
|
|
154
|
+
animated?: boolean | undefined;
|
|
155
|
+
item: any;
|
|
156
|
+
viewOffset?: number | undefined;
|
|
157
|
+
viewPosition?: number | undefined;
|
|
158
|
+
}): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Scrolls to a specific offset in pixels.
|
|
161
|
+
* @param params - Parameters for scrolling.
|
|
162
|
+
* @param params.offset - The pixel offset to scroll to.
|
|
163
|
+
* @param params.animated - If true, animates the scroll. Default: true.
|
|
164
|
+
*/
|
|
165
|
+
scrollToOffset(params: {
|
|
166
|
+
offset: number;
|
|
167
|
+
animated?: boolean | undefined;
|
|
168
|
+
}): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Sets or adds to the offset of the visible content anchor.
|
|
171
|
+
* @param value - The offset to set or add.
|
|
172
|
+
* @param animated - If true, uses Animated to animate the change.
|
|
173
|
+
*/
|
|
174
|
+
setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
|
|
175
|
+
/**
|
|
176
|
+
* Sets whether scroll processing is enabled.
|
|
177
|
+
* @param enabled - If true, scroll processing is enabled.
|
|
178
|
+
*/
|
|
179
|
+
setScrollProcessingEnabled(enabled: boolean): void;
|
|
180
|
+
/**
|
|
181
|
+
* Clears internal virtualization caches.
|
|
182
|
+
* @param options - Cache clearing options.
|
|
183
|
+
* @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
|
|
184
|
+
*/
|
|
185
|
+
clearCaches(options?: {
|
|
186
|
+
mode?: "sizes" | "full";
|
|
187
|
+
}): void;
|
|
188
|
+
/**
|
|
189
|
+
* Reports an externally measured content inset. Pass null/undefined to clear.
|
|
190
|
+
* Values are merged on top of props/animated/native insets.
|
|
191
|
+
*/
|
|
192
|
+
reportContentInset(inset?: Partial<Insets> | null): void;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
|
|
196
|
+
getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
197
|
+
getScrollResponder(): ScrollResponderMixin;
|
|
198
|
+
reportContentInset(inset?: Partial<Insets$1> | null): void;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
type KeyboardOnScrollCallback = (event: ScrollEvent) => void;
|
|
202
|
+
type KeyboardOnScrollHandler = KeyboardOnScrollCallback | ScrollHandlerProcessed<Record<string, unknown>>;
|
|
7
203
|
declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "automaticallyAdjustContentInsets" | "contentInset"> & {
|
|
8
|
-
onScroll?:
|
|
9
|
-
contentInset?: Insets | undefined;
|
|
204
|
+
onScroll?: KeyboardOnScrollHandler;
|
|
205
|
+
contentInset?: Insets$1 | undefined;
|
|
10
206
|
safeAreaInsetBottom?: number;
|
|
11
|
-
} & React.RefAttributes<LegendListRef>) => React.ReactNode;
|
|
207
|
+
} & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
|
|
12
208
|
|
|
13
|
-
export { KeyboardAvoidingLegendList
|
|
209
|
+
export { KeyboardAvoidingLegendList };
|
package/keyboard.js
CHANGED
|
@@ -49,6 +49,7 @@ var useCombinedRef = (...refs) => {
|
|
|
49
49
|
}, refs);
|
|
50
50
|
return callback;
|
|
51
51
|
};
|
|
52
|
+
var typedForwardRef = React.forwardRef;
|
|
52
53
|
|
|
53
54
|
// src/integrations/keyboard.tsx
|
|
54
55
|
var clampProgress = (progress) => {
|
|
@@ -74,7 +75,7 @@ var calculateKeyboardTargetOffset = (startOffset, keyboardHeight, isOpening, pro
|
|
|
74
75
|
const delta = (isOpening ? keyboardHeight : -keyboardHeight) * normalizedProgress;
|
|
75
76
|
return Math.max(0, startOffset + delta);
|
|
76
77
|
};
|
|
77
|
-
var KeyboardAvoidingLegendList =
|
|
78
|
+
var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
|
|
78
79
|
const {
|
|
79
80
|
contentContainerStyle: contentContainerStyleProp,
|
|
80
81
|
contentInset: contentInsetProp,
|
|
@@ -95,7 +96,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
95
96
|
const scrollOffsetY = reactNativeReanimated.useSharedValue(0);
|
|
96
97
|
const animatedOffsetY = reactNativeReanimated.useSharedValue(null);
|
|
97
98
|
const scrollOffsetAtKeyboardStart = reactNativeReanimated.useSharedValue(0);
|
|
98
|
-
const
|
|
99
|
+
const animationMode = reactNativeReanimated.useSharedValue("idle");
|
|
99
100
|
const keyboardInset = reactNativeReanimated.useSharedValue(0);
|
|
100
101
|
const keyboardHeight = reactNativeReanimated.useSharedValue(0);
|
|
101
102
|
const contentLength = reactNativeReanimated.useSharedValue(0);
|
|
@@ -106,17 +107,33 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
106
107
|
const isKeyboardOpen = reactNativeReanimated.useSharedValue(false);
|
|
107
108
|
const keyboardInsetRef = React.useRef(0);
|
|
108
109
|
const [alignItemsAtEndMinSize, setAlignItemsAtEndMinSize] = React.useState(void 0);
|
|
110
|
+
const onScrollValue = onScrollProp;
|
|
111
|
+
const onScrollCallback = typeof onScrollValue === "function" ? onScrollValue : void 0;
|
|
112
|
+
const onScrollProcessed = onScrollValue && typeof onScrollValue === "object" && "workletEventHandler" in onScrollValue ? onScrollValue : null;
|
|
113
|
+
const onScrollCallbackIsWorklet = React.useMemo(
|
|
114
|
+
() => onScrollCallback ? reactNativeReanimated.isWorkletFunction(onScrollCallback) : false,
|
|
115
|
+
[onScrollCallback]
|
|
116
|
+
);
|
|
109
117
|
const scrollHandler = reactNativeReanimated.useAnimatedScrollHandler(
|
|
110
118
|
(event) => {
|
|
111
|
-
if (
|
|
119
|
+
if (animationMode.get() !== "running" || didInteractive.get()) {
|
|
112
120
|
scrollOffsetY.set(event.contentOffset[horizontal ? "x" : "y"]);
|
|
113
121
|
}
|
|
114
|
-
if (
|
|
115
|
-
|
|
122
|
+
if (onScrollCallback) {
|
|
123
|
+
if (onScrollCallbackIsWorklet) {
|
|
124
|
+
onScrollCallback(event);
|
|
125
|
+
} else {
|
|
126
|
+
reactNativeReanimated.runOnJS(onScrollCallback)(event);
|
|
127
|
+
}
|
|
116
128
|
}
|
|
117
129
|
},
|
|
118
|
-
[
|
|
130
|
+
[horizontal, onScrollCallback, onScrollCallbackIsWorklet]
|
|
119
131
|
);
|
|
132
|
+
const composedScrollHandler = reactNativeReanimated.useComposedEventHandler([
|
|
133
|
+
scrollHandler,
|
|
134
|
+
onScrollProcessed
|
|
135
|
+
]);
|
|
136
|
+
const finalScrollHandler = onScrollProcessed ? composedScrollHandler : scrollHandler;
|
|
120
137
|
const setScrollProcessingEnabled = React.useCallback(
|
|
121
138
|
(enabled) => {
|
|
122
139
|
var _a;
|
|
@@ -184,19 +201,39 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
184
201
|
React.useEffect(() => {
|
|
185
202
|
updateAlignItemsAtEndMinSize();
|
|
186
203
|
}, [updateAlignItemsAtEndMinSize]);
|
|
204
|
+
const getEffectiveKeyboardHeightFromInset = React.useCallback(
|
|
205
|
+
(nextKeyboardInset) => {
|
|
206
|
+
"worklet";
|
|
207
|
+
return calculateEffectiveKeyboardHeight(
|
|
208
|
+
nextKeyboardInset,
|
|
209
|
+
contentLength.get(),
|
|
210
|
+
scrollLength.get(),
|
|
211
|
+
alignItemsAtEnd
|
|
212
|
+
);
|
|
213
|
+
},
|
|
214
|
+
[alignItemsAtEnd, contentLength, scrollLength]
|
|
215
|
+
);
|
|
216
|
+
const getEffectiveKeyboardHeightFromEvent = React.useCallback(
|
|
217
|
+
(eventHeight) => {
|
|
218
|
+
"worklet";
|
|
219
|
+
const nextKeyboardInset = calculateKeyboardInset(eventHeight, safeAreaInsetBottom);
|
|
220
|
+
return getEffectiveKeyboardHeightFromInset(nextKeyboardInset);
|
|
221
|
+
},
|
|
222
|
+
[getEffectiveKeyboardHeightFromInset, safeAreaInsetBottom]
|
|
223
|
+
);
|
|
187
224
|
reactNativeKeyboardController.useKeyboardHandler(
|
|
188
225
|
// biome-ignore assist/source/useSortedKeys: prefer start/move/end
|
|
189
226
|
{
|
|
190
227
|
onStart: (event) => {
|
|
191
228
|
"worklet";
|
|
192
|
-
|
|
229
|
+
animationMode.set("running");
|
|
193
230
|
const progress = clampProgress(event.progress);
|
|
194
231
|
if (isKeyboardOpen.get() && progress >= 1 && event.height > 0) {
|
|
195
232
|
return;
|
|
196
233
|
}
|
|
197
234
|
if (!didInteractive.get()) {
|
|
198
235
|
if (event.height > 0) {
|
|
199
|
-
keyboardHeight.set(event.height
|
|
236
|
+
keyboardHeight.set(calculateKeyboardInset(event.height, safeAreaInsetBottom));
|
|
200
237
|
}
|
|
201
238
|
const vIsOpening = progress > 0;
|
|
202
239
|
isOpening.set(vIsOpening);
|
|
@@ -209,15 +246,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
209
246
|
const vScrollOffset = scrollOffsetY.get();
|
|
210
247
|
scrollOffsetAtKeyboardStart.set(vScrollOffset);
|
|
211
248
|
if (isIos) {
|
|
212
|
-
const
|
|
213
|
-
const vScrollLength = scrollLength.get();
|
|
214
|
-
const vKeyboardHeight = keyboardHeight.get();
|
|
215
|
-
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
216
|
-
vKeyboardHeight,
|
|
217
|
-
vContentLength,
|
|
218
|
-
vScrollLength,
|
|
219
|
-
alignItemsAtEnd
|
|
220
|
-
);
|
|
249
|
+
const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromInset(keyboardHeight.get());
|
|
221
250
|
const targetOffset = Math.max(
|
|
222
251
|
0,
|
|
223
252
|
vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
|
|
@@ -234,10 +263,10 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
234
263
|
},
|
|
235
264
|
onInteractive: (event) => {
|
|
236
265
|
"worklet";
|
|
237
|
-
if (
|
|
266
|
+
if (animationMode.get() !== "running") {
|
|
238
267
|
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
|
|
239
268
|
}
|
|
240
|
-
|
|
269
|
+
animationMode.set("running");
|
|
241
270
|
if (!didInteractive.get()) {
|
|
242
271
|
didInteractive.set(true);
|
|
243
272
|
}
|
|
@@ -246,13 +275,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
246
275
|
keyboardInset.set(newInset);
|
|
247
276
|
}
|
|
248
277
|
if (shouldUpdateAlignItemsAtEndMinSize.get() && !horizontal && alignItemsAtEnd) {
|
|
249
|
-
const
|
|
250
|
-
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
251
|
-
vKeyboardHeight,
|
|
252
|
-
contentLength.get(),
|
|
253
|
-
scrollLength.get(),
|
|
254
|
-
alignItemsAtEnd
|
|
255
|
-
);
|
|
278
|
+
const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromEvent(event.height);
|
|
256
279
|
reactNativeReanimated.runOnJS(updateAlignItemsAtEndMinSize)(vEffectiveKeyboardHeight);
|
|
257
280
|
}
|
|
258
281
|
},
|
|
@@ -262,13 +285,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
262
285
|
if (isAndroid) {
|
|
263
286
|
if (!didInteractive.get()) {
|
|
264
287
|
const progress = clampProgress(event.progress);
|
|
265
|
-
const
|
|
266
|
-
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
267
|
-
vKeyboardHeight,
|
|
268
|
-
contentLength.get(),
|
|
269
|
-
scrollLength.get(),
|
|
270
|
-
alignItemsAtEnd
|
|
271
|
-
);
|
|
288
|
+
const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromInset(keyboardHeight.get());
|
|
272
289
|
const targetOffset = calculateKeyboardTargetOffset(
|
|
273
290
|
scrollOffsetAtKeyboardStart.get(),
|
|
274
291
|
vEffectiveKeyboardHeight,
|
|
@@ -284,30 +301,18 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
284
301
|
}
|
|
285
302
|
}
|
|
286
303
|
if (!horizontal && alignItemsAtEnd && !vIsOpening && shouldUpdateAlignItemsAtEndMinSize.get()) {
|
|
287
|
-
const
|
|
288
|
-
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
289
|
-
vKeyboardHeight,
|
|
290
|
-
contentLength.get(),
|
|
291
|
-
scrollLength.get(),
|
|
292
|
-
alignItemsAtEnd
|
|
293
|
-
);
|
|
304
|
+
const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromEvent(event.height);
|
|
294
305
|
reactNativeReanimated.runOnJS(updateAlignItemsAtEndMinSize)(vEffectiveKeyboardHeight);
|
|
295
306
|
}
|
|
296
307
|
},
|
|
297
308
|
onEnd: (event) => {
|
|
298
309
|
"worklet";
|
|
299
310
|
const wasInteractive = didInteractive.get();
|
|
300
|
-
const vMode =
|
|
301
|
-
|
|
311
|
+
const vMode = animationMode.get();
|
|
312
|
+
animationMode.set("idle");
|
|
302
313
|
if (vMode === "running") {
|
|
303
314
|
const progress = clampProgress(event.progress);
|
|
304
|
-
const
|
|
305
|
-
const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
|
|
306
|
-
vKeyboardHeight,
|
|
307
|
-
contentLength.get(),
|
|
308
|
-
scrollLength.get(),
|
|
309
|
-
alignItemsAtEnd
|
|
310
|
-
);
|
|
315
|
+
const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromInset(keyboardHeight.get());
|
|
311
316
|
const vIsOpening = isOpening.get();
|
|
312
317
|
if (!wasInteractive) {
|
|
313
318
|
const targetOffset = calculateKeyboardTargetOffset(
|
|
@@ -336,7 +341,18 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
336
341
|
}
|
|
337
342
|
}
|
|
338
343
|
},
|
|
339
|
-
[
|
|
344
|
+
[
|
|
345
|
+
alignItemsAtEnd,
|
|
346
|
+
clearAlignItemsAtEndMinSize,
|
|
347
|
+
getEffectiveKeyboardHeightFromEvent,
|
|
348
|
+
getEffectiveKeyboardHeightFromInset,
|
|
349
|
+
horizontal,
|
|
350
|
+
reportContentInset,
|
|
351
|
+
safeAreaInsetBottom,
|
|
352
|
+
scrollViewRef,
|
|
353
|
+
setScrollProcessingEnabled,
|
|
354
|
+
updateAlignItemsAtEndMinSize
|
|
355
|
+
]
|
|
340
356
|
);
|
|
341
357
|
const animatedProps = reactNativeReanimated.useAnimatedProps(() => {
|
|
342
358
|
"worklet";
|
|
@@ -369,7 +385,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
369
385
|
marginBottom: keyboardInset.get()
|
|
370
386
|
}),
|
|
371
387
|
[styleProp, keyboardInset]
|
|
372
|
-
) :
|
|
388
|
+
) : styleProp;
|
|
373
389
|
const contentContainerStyle = React.useMemo(() => {
|
|
374
390
|
if (alignItemsAtEndMinSize === void 0) {
|
|
375
391
|
return contentContainerStyleProp;
|
|
@@ -386,7 +402,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
386
402
|
contentContainerStyle,
|
|
387
403
|
keyboardDismissMode: "interactive",
|
|
388
404
|
onMetricsChange: handleMetricsChange,
|
|
389
|
-
onScroll:
|
|
405
|
+
onScroll: finalScrollHandler,
|
|
390
406
|
ref: combinedRef,
|
|
391
407
|
refScrollView: scrollViewRef,
|
|
392
408
|
scrollIndicatorInsets: { bottom: 0, top: 0 },
|
|
@@ -396,4 +412,3 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
|
|
|
396
412
|
});
|
|
397
413
|
|
|
398
414
|
exports.KeyboardAvoidingLegendList = KeyboardAvoidingLegendList;
|
|
399
|
-
exports.LegendList = KeyboardAvoidingLegendList;
|