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

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 +4009 -1279
  9. package/index.mjs +4008 -1280
  10. package/index.native.js +3772 -1337
  11. package/index.native.mjs +3758 -1325
  12. package/keyboard-chat.d.ts +228 -0
  13. package/keyboard-chat.js +97 -0
  14. package/keyboard-chat.mjs +76 -0
  15. package/keyboard-test.d.ts +216 -0
  16. package/keyboard-test.js +39 -0
  17. package/keyboard-test.mjs +18 -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 +6003 -0
  24. package/react-native.mjs +5974 -0
  25. package/{types-YNdphn_A.d.ts → react-native.web.d.ts} +367 -261
  26. package/react-native.web.js +6537 -0
  27. package/react-native.web.mjs +6508 -0
  28. package/react.d.ts +776 -0
  29. package/react.js +6537 -0
  30. package/react.mjs +6508 -0
  31. package/reanimated.d.ts +679 -8
  32. package/reanimated.js +230 -29
  33. package/reanimated.mjs +232 -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
package/keyboard.js CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var reactNative = require('react-native');
4
+ var reactNative$1 = require('react-native');
5
5
  var reactNativeKeyboardController = require('react-native-keyboard-controller');
6
6
  var reactNativeReanimated = require('react-native-reanimated');
7
+ var reactNative = require('@legendapp/list/react-native');
7
8
  var reanimated = require('@legendapp/list/reanimated');
8
9
 
9
10
  function _interopNamespace(e) {
@@ -27,131 +28,422 @@ function _interopNamespace(e) {
27
28
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
29
 
29
30
  // src/integrations/keyboard.tsx
30
-
31
- // src/utils/helpers.ts
32
- function isFunction(obj) {
33
- return typeof obj === "function";
34
- }
35
-
36
- // src/hooks/useCombinedRef.ts
37
- var useCombinedRef = (...refs) => {
38
- const callback = React.useCallback((element) => {
39
- for (const ref of refs) {
40
- if (!ref) {
41
- continue;
42
- }
43
- if (isFunction(ref)) {
44
- ref(element);
45
- } else {
46
- ref.current = element;
47
- }
48
- }
49
- }, refs);
50
- return callback;
31
+ var { typedForwardRef, useCombinedRef } = reactNative.internal;
32
+ var clampProgress = (progress) => {
33
+ "worklet";
34
+ return Math.min(1, Math.max(0, progress));
51
35
  };
52
-
53
- // src/integrations/keyboard.tsx
54
- var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
36
+ var calculateKeyboardInset = (height, safeAreaInsetBottom) => {
37
+ "worklet";
38
+ return Math.max(0, height - safeAreaInsetBottom);
39
+ };
40
+ var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLength, alignItemsAtEnd) => {
41
+ "worklet";
42
+ if (alignItemsAtEnd) {
43
+ return keyboardHeight;
44
+ } else {
45
+ const availableSpace = Math.max(0, scrollLength - contentLength);
46
+ return Math.max(0, keyboardHeight - availableSpace);
47
+ }
48
+ };
49
+ var calculateKeyboardTargetOffset = (startOffset, keyboardHeight, isOpening, progress) => {
50
+ "worklet";
51
+ const normalizedProgress = isOpening ? progress : 1 - progress;
52
+ const delta = (isOpening ? keyboardHeight : -keyboardHeight) * normalizedProgress;
53
+ return Math.max(0, startOffset + delta);
54
+ };
55
+ var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
55
56
  const {
57
+ contentContainerStyle: contentContainerStyleProp,
56
58
  contentInset: contentInsetProp,
57
59
  horizontal,
60
+ onMetricsChange: onMetricsChangeProp,
61
+ onContentSizeChange: onContentSizeChangeProp,
62
+ onLayout: onLayoutProp,
58
63
  onScroll: onScrollProp,
59
64
  safeAreaInsetBottom = 0,
65
+ style: styleProp,
60
66
  ...rest
61
67
  } = props;
68
+ const { alignItemsAtEnd } = props;
69
+ const styleFlattened = reactNative$1.StyleSheet.flatten(styleProp);
62
70
  const refLegendList = React.useRef(null);
63
71
  const combinedRef = useCombinedRef(forwardedRef, refLegendList);
72
+ const isIos = reactNative$1.Platform.OS === "ios";
73
+ const isAndroid = reactNative$1.Platform.OS === "android";
64
74
  const scrollViewRef = reactNativeReanimated.useAnimatedRef();
65
75
  const scrollOffsetY = reactNativeReanimated.useSharedValue(0);
66
76
  const animatedOffsetY = reactNativeReanimated.useSharedValue(null);
67
77
  const scrollOffsetAtKeyboardStart = reactNativeReanimated.useSharedValue(0);
78
+ const animationMode = reactNativeReanimated.useSharedValue("idle");
68
79
  const keyboardInset = reactNativeReanimated.useSharedValue(0);
69
80
  const keyboardHeight = reactNativeReanimated.useSharedValue(0);
81
+ const contentLength = reactNativeReanimated.useSharedValue(0);
82
+ const scrollLength = reactNativeReanimated.useSharedValue(0);
70
83
  const isOpening = reactNativeReanimated.useSharedValue(false);
84
+ const didInteractive = reactNativeReanimated.useSharedValue(false);
85
+ const shouldUpdateAlignItemsAtEndMinSize = reactNativeReanimated.useSharedValue(false);
86
+ const isKeyboardOpen = reactNativeReanimated.useSharedValue(false);
87
+ const hasSeenKeyboardTransition = reactNativeReanimated.useSharedValue(false);
88
+ const skipKeyboardAnimationForCurrentTransition = reactNativeReanimated.useSharedValue(false);
89
+ const keyboardInsetRef = React.useRef(0);
90
+ const [alignItemsAtEndMinSize, setAlignItemsAtEndMinSize] = React.useState(void 0);
91
+ const onScrollValue = onScrollProp;
92
+ const onScrollCallback = typeof onScrollValue === "function" ? onScrollValue : void 0;
93
+ const onScrollProcessed = onScrollValue && typeof onScrollValue === "object" && "workletEventHandler" in onScrollValue ? onScrollValue : null;
94
+ const onScrollCallbackIsWorklet = React.useMemo(
95
+ () => onScrollCallback ? reactNativeReanimated.isWorkletFunction(onScrollCallback) : false,
96
+ [onScrollCallback]
97
+ );
98
+ const handleContentSizeChange = React.useCallback(
99
+ (width, height) => {
100
+ const nextContentLength = horizontal ? width : height;
101
+ if (Number.isFinite(nextContentLength) && nextContentLength > 0) {
102
+ contentLength.set(nextContentLength);
103
+ }
104
+ onContentSizeChangeProp == null ? void 0 : onContentSizeChangeProp(width, height);
105
+ },
106
+ [contentLength, horizontal, onContentSizeChangeProp]
107
+ );
108
+ const handleLayout = React.useCallback(
109
+ (event) => {
110
+ const nextScrollLength = event.nativeEvent.layout[horizontal ? "width" : "height"];
111
+ if (Number.isFinite(nextScrollLength) && nextScrollLength > 0) {
112
+ scrollLength.set(nextScrollLength);
113
+ }
114
+ onLayoutProp == null ? void 0 : onLayoutProp(event);
115
+ },
116
+ [horizontal, onLayoutProp, scrollLength]
117
+ );
71
118
  const scrollHandler = reactNativeReanimated.useAnimatedScrollHandler(
72
119
  (event) => {
73
- scrollOffsetY.value = event.contentOffset[horizontal ? "x" : "y"];
74
- if (onScrollProp) {
75
- reactNativeReanimated.runOnJS(onScrollProp)(event);
120
+ if (animationMode.get() !== "running" || didInteractive.get()) {
121
+ scrollOffsetY.set(event.contentOffset[horizontal ? "x" : "y"]);
122
+ }
123
+ if (onScrollCallback) {
124
+ if (onScrollCallbackIsWorklet) {
125
+ onScrollCallback(event);
126
+ } else {
127
+ reactNativeReanimated.runOnJS(onScrollCallback)(event);
128
+ }
76
129
  }
77
130
  },
78
- [onScrollProp, horizontal]
131
+ [horizontal, onScrollCallback, onScrollCallbackIsWorklet]
79
132
  );
133
+ const composedScrollHandler = reactNativeReanimated.useComposedEventHandler([
134
+ scrollHandler,
135
+ onScrollProcessed
136
+ ]);
137
+ const finalScrollHandler = onScrollProcessed ? composedScrollHandler : scrollHandler;
80
138
  const setScrollProcessingEnabled = React.useCallback(
81
139
  (enabled) => {
82
140
  var _a;
83
- (_a = refLegendList.current) == null ? void 0 : _a.setScrollProcessingEnabled(enabled);
141
+ return (_a = refLegendList.current) == null ? void 0 : _a.setScrollProcessingEnabled(enabled);
84
142
  },
85
143
  [refLegendList]
86
144
  );
145
+ const reportContentInset = React.useCallback(
146
+ (bottom) => {
147
+ var _a;
148
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
149
+ },
150
+ [refLegendList]
151
+ );
152
+ const clearAlignItemsAtEndMinSize = React.useCallback(() => {
153
+ setAlignItemsAtEndMinSize((prev) => prev === void 0 ? prev : void 0);
154
+ }, []);
155
+ const updateAlignItemsAtEndMinSize = React.useCallback(
156
+ (nextKeyboardInset) => {
157
+ var _a;
158
+ if (isAndroid) {
159
+ return;
160
+ }
161
+ if (nextKeyboardInset !== void 0) {
162
+ keyboardInsetRef.current = nextKeyboardInset;
163
+ }
164
+ if (!alignItemsAtEnd || horizontal) {
165
+ clearAlignItemsAtEndMinSize();
166
+ return;
167
+ }
168
+ const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
169
+ if (!state) {
170
+ return;
171
+ }
172
+ const currentInset = keyboardInsetRef.current;
173
+ if (currentInset <= 0) {
174
+ clearAlignItemsAtEndMinSize();
175
+ return;
176
+ }
177
+ if (state.scrollLength <= 0) {
178
+ return;
179
+ }
180
+ const nextMinSize = Math.max(0, state.scrollLength - currentInset);
181
+ setAlignItemsAtEndMinSize((prev) => prev === nextMinSize ? prev : nextMinSize);
182
+ },
183
+ [alignItemsAtEnd, clearAlignItemsAtEndMinSize, horizontal]
184
+ );
185
+ const updateScrollMetrics = React.useCallback(() => {
186
+ var _a;
187
+ const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
188
+ if (!state) {
189
+ return;
190
+ }
191
+ contentLength.set(state.contentLength);
192
+ if (animationMode.get() !== "running") {
193
+ scrollOffsetY.set(state.scroll);
194
+ }
195
+ scrollLength.set(state.scrollLength);
196
+ updateAlignItemsAtEndMinSize();
197
+ }, [animationMode, contentLength, scrollLength, scrollOffsetY, updateAlignItemsAtEndMinSize]);
198
+ const handleMetricsChange = React.useCallback(
199
+ (metrics) => {
200
+ updateScrollMetrics();
201
+ onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
202
+ },
203
+ [onMetricsChangeProp, updateScrollMetrics]
204
+ );
205
+ React.useEffect(() => {
206
+ updateScrollMetrics();
207
+ }, [updateScrollMetrics]);
208
+ React.useEffect(() => {
209
+ updateAlignItemsAtEndMinSize();
210
+ }, [updateAlignItemsAtEndMinSize]);
211
+ const getEffectiveKeyboardHeightFromInset = React.useCallback(
212
+ (nextKeyboardInset) => {
213
+ "worklet";
214
+ return calculateEffectiveKeyboardHeight(
215
+ nextKeyboardInset,
216
+ contentLength.get(),
217
+ scrollLength.get(),
218
+ alignItemsAtEnd
219
+ );
220
+ },
221
+ [alignItemsAtEnd, contentLength, scrollLength]
222
+ );
223
+ const getEffectiveKeyboardHeightFromEvent = React.useCallback(
224
+ (eventHeight) => {
225
+ "worklet";
226
+ const nextKeyboardInset = calculateKeyboardInset(eventHeight, safeAreaInsetBottom);
227
+ return getEffectiveKeyboardHeightFromInset(nextKeyboardInset);
228
+ },
229
+ [getEffectiveKeyboardHeightFromInset, safeAreaInsetBottom]
230
+ );
87
231
  reactNativeKeyboardController.useKeyboardHandler(
88
232
  // biome-ignore assist/source/useSortedKeys: prefer start/move/end
89
233
  {
90
234
  onStart: (event) => {
91
235
  "worklet";
92
- if (event.height > 0) {
93
- keyboardHeight.set(event.height - safeAreaInsetBottom);
236
+ const progress = clampProgress(event.progress);
237
+ const shouldSkipInitialCloseAnimation = !hasSeenKeyboardTransition.get() && !isKeyboardOpen.get() && keyboardHeight.get() <= 0 && progress <= 0 && event.height <= 0;
238
+ skipKeyboardAnimationForCurrentTransition.set(shouldSkipInitialCloseAnimation);
239
+ hasSeenKeyboardTransition.set(true);
240
+ if (isKeyboardOpen.get() && progress >= 1 && event.height > 0) {
241
+ didInteractive.set(false);
242
+ animationMode.set("idle");
243
+ reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(true);
244
+ return;
245
+ }
246
+ if (shouldSkipInitialCloseAnimation) {
247
+ isOpening.set(false);
248
+ return;
249
+ }
250
+ animationMode.set("running");
251
+ if (!didInteractive.get()) {
252
+ if (event.height > 0) {
253
+ keyboardHeight.set(calculateKeyboardInset(event.height, safeAreaInsetBottom));
254
+ }
255
+ const vIsOpening = progress > 0;
256
+ isOpening.set(vIsOpening);
257
+ shouldUpdateAlignItemsAtEndMinSize.set(
258
+ !!alignItemsAtEnd && !horizontal && contentLength.get() < scrollLength.get()
259
+ );
260
+ if (!shouldUpdateAlignItemsAtEndMinSize.get()) {
261
+ reactNativeReanimated.runOnJS(clearAlignItemsAtEndMinSize)();
262
+ }
263
+ const vScrollOffset = scrollOffsetY.get();
264
+ scrollOffsetAtKeyboardStart.set(vScrollOffset);
265
+ if (isIos) {
266
+ const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromInset(keyboardHeight.get());
267
+ const targetOffset = Math.max(
268
+ 0,
269
+ vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
270
+ );
271
+ scrollOffsetY.set(targetOffset);
272
+ animatedOffsetY.set(targetOffset);
273
+ keyboardInset.set(vEffectiveKeyboardHeight);
274
+ reactNativeReanimated.runOnJS(updateAlignItemsAtEndMinSize)(vEffectiveKeyboardHeight);
275
+ } else if (isAndroid) {
276
+ animatedOffsetY.set(vScrollOffset);
277
+ }
278
+ reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
279
+ }
280
+ },
281
+ onInteractive: (event) => {
282
+ "worklet";
283
+ if (animationMode.get() !== "running") {
284
+ reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
285
+ }
286
+ animationMode.set("running");
287
+ if (!didInteractive.get()) {
288
+ didInteractive.set(true);
289
+ }
290
+ if (isAndroid && !horizontal) {
291
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
292
+ keyboardInset.set(newInset);
293
+ }
294
+ if (shouldUpdateAlignItemsAtEndMinSize.get() && !horizontal && alignItemsAtEnd) {
295
+ const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromEvent(event.height);
296
+ reactNativeReanimated.runOnJS(updateAlignItemsAtEndMinSize)(vEffectiveKeyboardHeight);
94
297
  }
95
- isOpening.set(event.progress > 0);
96
- scrollOffsetAtKeyboardStart.value = scrollOffsetY.value;
97
- animatedOffsetY.set(scrollOffsetY.value);
98
- reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
99
298
  },
100
299
  onMove: (event) => {
101
300
  "worklet";
102
301
  const vIsOpening = isOpening.get();
103
- const vKeyboardHeight = keyboardHeight.get();
104
- const vProgress = vIsOpening ? event.progress : 1 - event.progress;
105
- const targetOffset = scrollOffsetAtKeyboardStart.value + (vIsOpening ? vKeyboardHeight : -vKeyboardHeight) * vProgress;
106
- scrollOffsetY.value = targetOffset;
107
- animatedOffsetY.set(targetOffset);
108
- if (!horizontal) {
109
- keyboardInset.value = Math.max(0, event.height - safeAreaInsetBottom);
302
+ const progress = clampProgress(event.progress);
303
+ const skipKeyboardAnimation = skipKeyboardAnimationForCurrentTransition.get();
304
+ if (skipKeyboardAnimation) {
305
+ return;
306
+ }
307
+ if (isAndroid) {
308
+ if (!didInteractive.get()) {
309
+ const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromInset(keyboardHeight.get());
310
+ const targetOffset = calculateKeyboardTargetOffset(
311
+ scrollOffsetAtKeyboardStart.get(),
312
+ vEffectiveKeyboardHeight,
313
+ vIsOpening,
314
+ progress
315
+ );
316
+ scrollOffsetY.set(targetOffset);
317
+ animatedOffsetY.set(targetOffset);
318
+ }
319
+ if (!horizontal) {
320
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
321
+ keyboardInset.set(newInset);
322
+ }
323
+ }
324
+ if (!horizontal && alignItemsAtEnd && !vIsOpening && shouldUpdateAlignItemsAtEndMinSize.get()) {
325
+ const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromEvent(event.height);
326
+ reactNativeReanimated.runOnJS(updateAlignItemsAtEndMinSize)(vEffectiveKeyboardHeight);
110
327
  }
111
328
  },
112
329
  onEnd: (event) => {
113
330
  "worklet";
114
- const vIsOpening = isOpening.get();
115
- const vKeyboardHeight = keyboardHeight.get();
116
- const targetOffset = scrollOffsetAtKeyboardStart.value + (vIsOpening ? vKeyboardHeight : -vKeyboardHeight) * (vIsOpening ? event.progress : 1 - event.progress);
117
- scrollOffsetY.value = targetOffset;
118
- animatedOffsetY.set(targetOffset);
119
- if (!horizontal) {
120
- keyboardInset.value = Math.max(0, event.height - safeAreaInsetBottom);
331
+ const wasInteractive = didInteractive.get();
332
+ const skipKeyboardAnimation = skipKeyboardAnimationForCurrentTransition.get();
333
+ const vMode = animationMode.get();
334
+ animationMode.set("idle");
335
+ if (skipKeyboardAnimation) {
336
+ skipKeyboardAnimationForCurrentTransition.set(false);
337
+ didInteractive.set(false);
338
+ isOpening.set(false);
339
+ isKeyboardOpen.set(false);
340
+ keyboardHeight.set(0);
341
+ if (!horizontal) {
342
+ keyboardInset.set(0);
343
+ reactNativeReanimated.runOnJS(reportContentInset)(0);
344
+ reactNativeReanimated.runOnJS(updateAlignItemsAtEndMinSize)(0);
345
+ }
346
+ return;
347
+ }
348
+ if (vMode === "running") {
349
+ const progress = clampProgress(event.progress);
350
+ const vEffectiveKeyboardHeight = getEffectiveKeyboardHeightFromInset(keyboardHeight.get());
351
+ const vIsOpening = isOpening.get();
352
+ if (!wasInteractive) {
353
+ const targetOffset = calculateKeyboardTargetOffset(
354
+ scrollOffsetAtKeyboardStart.get(),
355
+ vEffectiveKeyboardHeight,
356
+ vIsOpening,
357
+ progress
358
+ );
359
+ scrollOffsetY.set(targetOffset);
360
+ animatedOffsetY.set(targetOffset);
361
+ }
362
+ reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(true);
363
+ didInteractive.set(false);
364
+ isKeyboardOpen.set(event.height > 0);
365
+ if (event.height > 0) {
366
+ keyboardHeight.set(calculateKeyboardInset(event.height, safeAreaInsetBottom));
367
+ }
368
+ if (!horizontal) {
369
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
370
+ keyboardInset.set(newInset);
371
+ reactNativeReanimated.runOnJS(reportContentInset)(newInset);
372
+ if (!vIsOpening) {
373
+ reactNativeReanimated.runOnJS(updateAlignItemsAtEndMinSize)(newInset);
374
+ }
375
+ if (newInset <= 0) {
376
+ animatedOffsetY.set(scrollOffsetY.get());
377
+ }
378
+ }
121
379
  }
122
- reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(true);
123
380
  }
124
381
  },
125
- [scrollViewRef, safeAreaInsetBottom]
382
+ [
383
+ alignItemsAtEnd,
384
+ clearAlignItemsAtEndMinSize,
385
+ getEffectiveKeyboardHeightFromEvent,
386
+ getEffectiveKeyboardHeightFromInset,
387
+ horizontal,
388
+ reportContentInset,
389
+ safeAreaInsetBottom,
390
+ scrollViewRef,
391
+ setScrollProcessingEnabled,
392
+ updateAlignItemsAtEndMinSize
393
+ ]
126
394
  );
127
395
  const animatedProps = reactNativeReanimated.useAnimatedProps(() => {
128
396
  "worklet";
129
397
  var _a, _b, _c, _d;
398
+ const vAnimatedOffsetY = animatedOffsetY.get();
130
399
  const baseProps = {
131
- contentOffset: animatedOffsetY.value === null ? void 0 : {
400
+ contentOffset: vAnimatedOffsetY === null ? void 0 : {
132
401
  x: 0,
133
- y: animatedOffsetY.value
402
+ y: vAnimatedOffsetY
134
403
  }
135
404
  };
136
- return reactNative.Platform.OS === "ios" ? Object.assign(baseProps, {
137
- contentInset: {
138
- bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInset.value),
405
+ if (isIos) {
406
+ const keyboardInsetBottom = keyboardInset.get();
407
+ const contentInset = {
408
+ bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
139
409
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
140
410
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
141
411
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
142
- }
143
- }) : baseProps;
412
+ };
413
+ return Object.assign(baseProps, {
414
+ contentInset
415
+ });
416
+ } else {
417
+ return baseProps;
418
+ }
144
419
  });
145
- const style = reactNative.Platform.OS !== "ios" ? reactNativeReanimated.useAnimatedStyle(() => ({
146
- marginBottom: keyboardInset.value
147
- })) : void 0;
420
+ const androidAnimatedStyle = reactNativeReanimated.useAnimatedStyle(
421
+ () => ({
422
+ ...styleFlattened || {},
423
+ marginBottom: keyboardInset.get()
424
+ }),
425
+ [styleProp, keyboardInset]
426
+ );
427
+ const style = isAndroid ? androidAnimatedStyle : styleProp;
428
+ const contentContainerStyle = React.useMemo(() => {
429
+ if (alignItemsAtEndMinSize === void 0) {
430
+ return contentContainerStyleProp;
431
+ }
432
+ const minSizeStyle = horizontal ? { minWidth: alignItemsAtEndMinSize } : { minHeight: alignItemsAtEndMinSize };
433
+ return contentContainerStyleProp ? [contentContainerStyleProp, minSizeStyle] : minSizeStyle;
434
+ }, [alignItemsAtEndMinSize, contentContainerStyleProp, horizontal]);
148
435
  return /* @__PURE__ */ React__namespace.createElement(
149
436
  reanimated.AnimatedLegendList,
150
437
  {
151
438
  ...rest,
152
439
  animatedProps,
440
+ automaticallyAdjustContentInsets: false,
441
+ contentContainerStyle,
153
442
  keyboardDismissMode: "interactive",
154
- onScroll: scrollHandler,
443
+ onContentSizeChange: handleContentSizeChange,
444
+ onLayout: handleLayout,
445
+ onMetricsChange: handleMetricsChange,
446
+ onScroll: finalScrollHandler,
155
447
  ref: combinedRef,
156
448
  refScrollView: scrollViewRef,
157
449
  scrollIndicatorInsets: { bottom: 0, top: 0 },
@@ -161,4 +453,3 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
161
453
  });
162
454
 
163
455
  exports.KeyboardAvoidingLegendList = KeyboardAvoidingLegendList;
164
- exports.LegendList = KeyboardAvoidingLegendList;