@legendapp/list 3.0.0-beta.22 → 3.0.0-beta.23

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/index.d.mts CHANGED
@@ -178,6 +178,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
178
178
  initialScrollIndex?: number | {
179
179
  index: number;
180
180
  viewOffset?: number | undefined;
181
+ viewPosition?: number | undefined;
181
182
  };
182
183
  /**
183
184
  * When true, the list initializes scrolled to the last item.
package/index.d.ts CHANGED
@@ -178,6 +178,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
178
178
  initialScrollIndex?: number | {
179
179
  index: number;
180
180
  viewOffset?: number | undefined;
181
+ viewPosition?: number | undefined;
181
182
  };
182
183
  /**
183
184
  * When true, the list initializes scrolled to the last item.
package/index.js CHANGED
@@ -3851,7 +3851,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3851
3851
  maintainVisibleContentPositionProp
3852
3852
  );
3853
3853
  const [renderNum, setRenderNum] = React3.useState(0);
3854
- const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? { index: initialScrollIndexProp.index || 0, viewOffset: initialScrollIndexProp.viewOffset || 0 } : { index: initialScrollIndexProp || 0, viewOffset: initialScrollOffsetProp || 0 } : void 0;
3854
+ const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? {
3855
+ index: initialScrollIndexProp.index || 0,
3856
+ viewOffset: initialScrollIndexProp.viewOffset || (initialScrollIndexProp.viewPosition === 1 ? -stylePaddingBottomState : 0),
3857
+ viewPosition: initialScrollIndexProp.viewPosition || 0
3858
+ } : {
3859
+ index: initialScrollIndexProp || 0,
3860
+ viewOffset: initialScrollOffsetProp || 0
3861
+ } : void 0;
3855
3862
  const [canRender, setCanRender] = React3__namespace.useState(!IsNewArchitecture);
3856
3863
  const ctx = useStateContext();
3857
3864
  ctx.columnWrapperStyle = columnWrapperStyle || (contentContainerStyle ? createColumnWrapperStyle(contentContainerStyle) : void 0);
@@ -3889,6 +3896,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3889
3896
  columns: /* @__PURE__ */ new Map(),
3890
3897
  containerItemKeys: /* @__PURE__ */ new Map(),
3891
3898
  containerItemTypes: /* @__PURE__ */ new Map(),
3899
+ contentInsetOverride: void 0,
3892
3900
  dataChangeNeedsScrollUpdate: false,
3893
3901
  didColumnsChange: false,
3894
3902
  didDataChange: false,
@@ -3918,7 +3926,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3918
3926
  lastScrollDelta: 0,
3919
3927
  loadStartTime: Date.now(),
3920
3928
  minIndexSizeChanged: 0,
3921
- contentInsetOverride: void 0,
3922
3929
  nativeContentInset: void 0,
3923
3930
  nativeMarginTop: 0,
3924
3931
  positions: /* @__PURE__ */ new Map(),
package/index.mjs CHANGED
@@ -3830,7 +3830,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3830
3830
  maintainVisibleContentPositionProp
3831
3831
  );
3832
3832
  const [renderNum, setRenderNum] = useState(0);
3833
- const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? { index: initialScrollIndexProp.index || 0, viewOffset: initialScrollIndexProp.viewOffset || 0 } : { index: initialScrollIndexProp || 0, viewOffset: initialScrollOffsetProp || 0 } : void 0;
3833
+ const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? {
3834
+ index: initialScrollIndexProp.index || 0,
3835
+ viewOffset: initialScrollIndexProp.viewOffset || (initialScrollIndexProp.viewPosition === 1 ? -stylePaddingBottomState : 0),
3836
+ viewPosition: initialScrollIndexProp.viewPosition || 0
3837
+ } : {
3838
+ index: initialScrollIndexProp || 0,
3839
+ viewOffset: initialScrollOffsetProp || 0
3840
+ } : void 0;
3834
3841
  const [canRender, setCanRender] = React3.useState(!IsNewArchitecture);
3835
3842
  const ctx = useStateContext();
3836
3843
  ctx.columnWrapperStyle = columnWrapperStyle || (contentContainerStyle ? createColumnWrapperStyle(contentContainerStyle) : void 0);
@@ -3868,6 +3875,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3868
3875
  columns: /* @__PURE__ */ new Map(),
3869
3876
  containerItemKeys: /* @__PURE__ */ new Map(),
3870
3877
  containerItemTypes: /* @__PURE__ */ new Map(),
3878
+ contentInsetOverride: void 0,
3871
3879
  dataChangeNeedsScrollUpdate: false,
3872
3880
  didColumnsChange: false,
3873
3881
  didDataChange: false,
@@ -3897,7 +3905,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3897
3905
  lastScrollDelta: 0,
3898
3906
  loadStartTime: Date.now(),
3899
3907
  minIndexSizeChanged: 0,
3900
- contentInsetOverride: void 0,
3901
3908
  nativeContentInset: void 0,
3902
3909
  nativeMarginTop: 0,
3903
3910
  positions: /* @__PURE__ */ new Map(),
@@ -178,6 +178,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
178
178
  initialScrollIndex?: number | {
179
179
  index: number;
180
180
  viewOffset?: number | undefined;
181
+ viewPosition?: number | undefined;
181
182
  };
182
183
  /**
183
184
  * When true, the list initializes scrolled to the last item.
package/index.native.d.ts CHANGED
@@ -178,6 +178,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
178
178
  initialScrollIndex?: number | {
179
179
  index: number;
180
180
  viewOffset?: number | undefined;
181
+ viewPosition?: number | undefined;
181
182
  };
182
183
  /**
183
184
  * When true, the list initializes scrolled to the last item.
package/index.native.js CHANGED
@@ -3654,7 +3654,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3654
3654
  maintainVisibleContentPositionProp
3655
3655
  );
3656
3656
  const [renderNum, setRenderNum] = React2.useState(0);
3657
- const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? { index: initialScrollIndexProp.index || 0, viewOffset: initialScrollIndexProp.viewOffset || 0 } : { index: initialScrollIndexProp || 0, viewOffset: initialScrollOffsetProp || 0 } : void 0;
3657
+ const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? {
3658
+ index: initialScrollIndexProp.index || 0,
3659
+ viewOffset: initialScrollIndexProp.viewOffset || (initialScrollIndexProp.viewPosition === 1 ? -stylePaddingBottomState : 0),
3660
+ viewPosition: initialScrollIndexProp.viewPosition || 0
3661
+ } : {
3662
+ index: initialScrollIndexProp || 0,
3663
+ viewOffset: initialScrollOffsetProp || 0
3664
+ } : void 0;
3658
3665
  const [canRender, setCanRender] = React2__namespace.useState(!IsNewArchitecture);
3659
3666
  const ctx = useStateContext();
3660
3667
  ctx.columnWrapperStyle = columnWrapperStyle || (contentContainerStyle ? createColumnWrapperStyle(contentContainerStyle) : void 0);
@@ -3692,6 +3699,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3692
3699
  columns: /* @__PURE__ */ new Map(),
3693
3700
  containerItemKeys: /* @__PURE__ */ new Map(),
3694
3701
  containerItemTypes: /* @__PURE__ */ new Map(),
3702
+ contentInsetOverride: void 0,
3695
3703
  dataChangeNeedsScrollUpdate: false,
3696
3704
  didColumnsChange: false,
3697
3705
  didDataChange: false,
@@ -3721,7 +3729,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3721
3729
  lastScrollDelta: 0,
3722
3730
  loadStartTime: Date.now(),
3723
3731
  minIndexSizeChanged: 0,
3724
- contentInsetOverride: void 0,
3725
3732
  nativeContentInset: void 0,
3726
3733
  nativeMarginTop: 0,
3727
3734
  positions: /* @__PURE__ */ new Map(),
package/index.native.mjs CHANGED
@@ -3633,7 +3633,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3633
3633
  maintainVisibleContentPositionProp
3634
3634
  );
3635
3635
  const [renderNum, setRenderNum] = useState(0);
3636
- const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? { index: initialScrollIndexProp.index || 0, viewOffset: initialScrollIndexProp.viewOffset || 0 } : { index: initialScrollIndexProp || 0, viewOffset: initialScrollOffsetProp || 0 } : void 0;
3636
+ const initialScrollProp = initialScrollAtEnd ? { index: Math.max(0, dataProp.length - 1), viewOffset: -stylePaddingBottomState, viewPosition: 1 } : initialScrollIndexProp || initialScrollOffsetProp ? typeof initialScrollIndexProp === "object" ? {
3637
+ index: initialScrollIndexProp.index || 0,
3638
+ viewOffset: initialScrollIndexProp.viewOffset || (initialScrollIndexProp.viewPosition === 1 ? -stylePaddingBottomState : 0),
3639
+ viewPosition: initialScrollIndexProp.viewPosition || 0
3640
+ } : {
3641
+ index: initialScrollIndexProp || 0,
3642
+ viewOffset: initialScrollOffsetProp || 0
3643
+ } : void 0;
3637
3644
  const [canRender, setCanRender] = React2.useState(!IsNewArchitecture);
3638
3645
  const ctx = useStateContext();
3639
3646
  ctx.columnWrapperStyle = columnWrapperStyle || (contentContainerStyle ? createColumnWrapperStyle(contentContainerStyle) : void 0);
@@ -3671,6 +3678,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3671
3678
  columns: /* @__PURE__ */ new Map(),
3672
3679
  containerItemKeys: /* @__PURE__ */ new Map(),
3673
3680
  containerItemTypes: /* @__PURE__ */ new Map(),
3681
+ contentInsetOverride: void 0,
3674
3682
  dataChangeNeedsScrollUpdate: false,
3675
3683
  didColumnsChange: false,
3676
3684
  didDataChange: false,
@@ -3700,7 +3708,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3700
3708
  lastScrollDelta: 0,
3701
3709
  loadStartTime: Date.now(),
3702
3710
  minIndexSizeChanged: 0,
3703
- contentInsetOverride: void 0,
3704
3711
  nativeContentInset: void 0,
3705
3712
  nativeMarginTop: 0,
3706
3713
  positions: /* @__PURE__ */ new Map(),
package/keyboard.d.mts CHANGED
@@ -4,13 +4,10 @@ import { ReanimatedScrollEvent } from 'react-native-reanimated/lib/typescript/ho
4
4
  import { LegendListRef } from '@legendapp/list';
5
5
  import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
6
6
 
7
- declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "contentInset"> & {
7
+ declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "automaticallyAdjustContentInsets" | "contentInset"> & {
8
8
  onScroll?: (event: ReanimatedScrollEvent) => void;
9
9
  contentInset?: Insets | undefined;
10
- safeAreaInsets?: {
11
- top: number;
12
- bottom: number;
13
- };
10
+ safeAreaInsetBottom?: number;
14
11
  } & React.RefAttributes<LegendListRef>) => React.ReactNode;
15
12
 
16
13
  export { KeyboardAvoidingLegendList, KeyboardAvoidingLegendList as LegendList };
package/keyboard.d.ts CHANGED
@@ -4,13 +4,10 @@ import { ReanimatedScrollEvent } from 'react-native-reanimated/lib/typescript/ho
4
4
  import { LegendListRef } from '@legendapp/list';
5
5
  import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
6
6
 
7
- declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "contentInset"> & {
7
+ declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "automaticallyAdjustContentInsets" | "contentInset"> & {
8
8
  onScroll?: (event: ReanimatedScrollEvent) => void;
9
9
  contentInset?: Insets | undefined;
10
- safeAreaInsets?: {
11
- top: number;
12
- bottom: number;
13
- };
10
+ safeAreaInsetBottom?: number;
14
11
  } & React.RefAttributes<LegendListRef>) => React.ReactNode;
15
12
 
16
13
  export { KeyboardAvoidingLegendList, KeyboardAvoidingLegendList as LegendList };
package/keyboard.js CHANGED
@@ -28,9 +28,6 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
28
 
29
29
  // src/integrations/keyboard.tsx
30
30
 
31
- // src/constants-platform.ts
32
- var IsNewArchitecture = true;
33
-
34
31
  // src/utils/helpers.ts
35
32
  function isFunction(obj) {
36
33
  return typeof obj === "function";
@@ -58,9 +55,9 @@ var clampProgress = (progress) => {
58
55
  "worklet";
59
56
  return Math.min(1, Math.max(0, progress));
60
57
  };
61
- var calculateKeyboardInset = (height, safeAreaInsetBottom, isNewArchitecture) => {
58
+ var calculateKeyboardInset = (height, safeAreaInsetBottom) => {
62
59
  "worklet";
63
- return Math.max(0, height - safeAreaInsetBottom) ;
60
+ return Math.max(0, height - safeAreaInsetBottom);
64
61
  };
65
62
  var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLength, alignItemsAtEnd) => {
66
63
  "worklet";
@@ -71,14 +68,6 @@ var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLen
71
68
  return Math.max(0, keyboardHeight - availableSpace);
72
69
  }
73
70
  };
74
- var calculateEndPaddingInset = (keyboardHeight, alignItemsAtEndPadding) => {
75
- "worklet";
76
- return Math.min(keyboardHeight, alignItemsAtEndPadding);
77
- };
78
- var calculateTopInset = (safeAreaInsetTop, isNewArchitecture, extraTopInset) => {
79
- "worklet";
80
- return (isNewArchitecture ? 0 : safeAreaInsetTop * 2) + extraTopInset;
81
- };
82
71
  var calculateKeyboardTargetOffset = (startOffset, keyboardHeight, isOpening, progress) => {
83
72
  "worklet";
84
73
  const normalizedProgress = isOpening ? progress : 1 - progress;
@@ -91,7 +80,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
91
80
  horizontal,
92
81
  onMetricsChange: onMetricsChangeProp,
93
82
  onScroll: onScrollProp,
94
- safeAreaInsets = { bottom: 0, top: 0 },
83
+ safeAreaInsetBottom = 0,
95
84
  style: styleProp,
96
85
  ...rest
97
86
  } = props;
@@ -106,14 +95,13 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
106
95
  const animatedOffsetY = reactNativeReanimated.useSharedValue(null);
107
96
  const scrollOffsetAtKeyboardStart = reactNativeReanimated.useSharedValue(0);
108
97
  const mode = reactNativeReanimated.useSharedValue("idle");
109
- const keyboardInset = reactNativeReanimated.useSharedValue({ bottom: 0, top: 0 });
98
+ const keyboardInset = reactNativeReanimated.useSharedValue(0);
110
99
  const keyboardHeight = reactNativeReanimated.useSharedValue(0);
111
100
  const contentLength = reactNativeReanimated.useSharedValue(0);
112
101
  const scrollLength = reactNativeReanimated.useSharedValue(0);
113
102
  const alignItemsAtEndPadding = reactNativeReanimated.useSharedValue(0);
114
103
  const isOpening = reactNativeReanimated.useSharedValue(false);
115
104
  const didInteractive = reactNativeReanimated.useSharedValue(false);
116
- const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = safeAreaInsets;
117
105
  const isKeyboardOpen = reactNativeReanimated.useSharedValue(false);
118
106
  const scrollHandler = reactNativeReanimated.useAnimatedScrollHandler(
119
107
  (event) => {
@@ -147,39 +135,9 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
147
135
  updateScrollMetrics();
148
136
  const nextPadding = metrics.alignItemsAtEndPadding || 0;
149
137
  alignItemsAtEndPadding.set(nextPadding);
150
- if (!horizontal) {
151
- reactNativeReanimated.runOnUI((padding, safeInsetTop, isNewArchitecture) => {
152
- "worklet";
153
- if (!isKeyboardOpen.get()) {
154
- return;
155
- }
156
- const vKeyboardHeight = keyboardHeight.get();
157
- const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
158
- vKeyboardHeight,
159
- contentLength.get(),
160
- scrollLength.get(),
161
- alignItemsAtEnd
162
- );
163
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, padding);
164
- const topInset = calculateTopInset(safeInsetTop, isNewArchitecture, vTopInset);
165
- keyboardInset.set({
166
- bottom: keyboardInset.get().bottom,
167
- top: topInset
168
- });
169
- })(nextPadding, safeAreaInsetTop, IsNewArchitecture);
170
- }
171
138
  onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
172
139
  },
173
- [
174
- alignItemsAtEndPadding,
175
- horizontal,
176
- isKeyboardOpen,
177
- keyboardHeight,
178
- keyboardInset,
179
- onMetricsChangeProp,
180
- safeAreaInsetTop,
181
- updateScrollMetrics
182
- ]
140
+ [alignItemsAtEndPadding, onMetricsChangeProp, updateScrollMetrics]
183
141
  );
184
142
  reactNativeKeyboardController.useKeyboardHandler(
185
143
  // biome-ignore assist/source/useSortedKeys: prefer start/move/end
@@ -208,18 +166,11 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
208
166
  }
209
167
  mode.set("running");
210
168
  if (!didInteractive.get()) {
211
- if (!isAndroid && !IsNewArchitecture) {
212
- keyboardInset.set({
213
- bottom: keyboardInset.get().bottom,
214
- // Legacy iOS uses a doubled top inset to keep content below the status bar.
215
- top: calculateTopInset(safeAreaInsetTop, IsNewArchitecture, 0)
216
- });
217
- }
218
169
  didInteractive.set(true);
219
170
  }
220
171
  if (isAndroid && !horizontal) {
221
172
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
222
- keyboardInset.set({ bottom: newInset, top: safeAreaInsetTop * 2 });
173
+ keyboardInset.set(newInset);
223
174
  }
224
175
  },
225
176
  onMove: (event) => {
@@ -234,8 +185,6 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
234
185
  scrollLength.get(),
235
186
  alignItemsAtEnd
236
187
  );
237
- const vAlignItemsPadding = alignItemsAtEndPadding.get();
238
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, vAlignItemsPadding);
239
188
  const targetOffset = calculateKeyboardTargetOffset(
240
189
  scrollOffsetAtKeyboardStart.get(),
241
190
  vEffectiveKeyboardHeight,
@@ -246,16 +195,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
246
195
  animatedOffsetY.set(targetOffset);
247
196
  if (!horizontal) {
248
197
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
249
- const topInset = calculateTopInset(
250
- safeAreaInsetTop,
251
- IsNewArchitecture,
252
- vIsOpening ? vTopInset : 0
253
- );
254
- keyboardInset.set({
255
- bottom: newInset,
256
- // Add top padding only while opening to keep end-aligned items visible.
257
- top: topInset
258
- });
198
+ keyboardInset.set(newInset);
259
199
  }
260
200
  }
261
201
  },
@@ -273,8 +213,6 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
273
213
  scrollLength.get(),
274
214
  alignItemsAtEnd
275
215
  );
276
- const vAlignItemsPadding = alignItemsAtEndPadding.get();
277
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, vAlignItemsPadding);
278
216
  const vIsOpening = isOpening.get();
279
217
  if (!wasInteractive) {
280
218
  const targetOffset = calculateKeyboardTargetOffset(
@@ -291,16 +229,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
291
229
  isKeyboardOpen.set(event.height > 0);
292
230
  if (!horizontal) {
293
231
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
294
- const topInset = calculateTopInset(
295
- safeAreaInsetTop,
296
- IsNewArchitecture,
297
- event.height > 0 ? vTopInset : 0
298
- );
299
- keyboardInset.set({
300
- bottom: newInset,
301
- // Preserve end-aligned padding only while the keyboard is visible.
302
- top: topInset
303
- });
232
+ keyboardInset.set(newInset);
304
233
  if (newInset <= 0) {
305
234
  animatedOffsetY.set(scrollOffsetY.get());
306
235
  }
@@ -320,24 +249,21 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
320
249
  y: vAnimatedOffsetY
321
250
  }
322
251
  };
323
- const { top: keyboardInsetTop, bottom: keyboardInsetBottom } = keyboardInset.get();
252
+ const keyboardInsetBottom = keyboardInset.get();
324
253
  return isIos ? Object.assign(baseProps, {
325
254
  contentInset: {
326
255
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
327
256
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
328
257
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
329
- top: ((_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0) - keyboardInsetTop
258
+ top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
330
259
  }
331
260
  }) : baseProps;
332
261
  });
333
262
  const style = isAndroid ? reactNativeReanimated.useAnimatedStyle(
334
- () => {
335
- var _a;
336
- return {
337
- ...styleFlattened || {},
338
- marginBottom: (_a = keyboardInset.get().bottom) != null ? _a : 0
339
- };
340
- },
263
+ () => ({
264
+ ...styleFlattened || {},
265
+ marginBottom: keyboardInset.get()
266
+ }),
341
267
  [styleProp, keyboardInset]
342
268
  ) : void 0;
343
269
  return /* @__PURE__ */ React__namespace.createElement(
@@ -345,6 +271,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
345
271
  {
346
272
  ...rest,
347
273
  animatedProps,
274
+ automaticallyAdjustContentInsets: false,
348
275
  keyboardDismissMode: "interactive",
349
276
  onMetricsChange: handleMetricsChange,
350
277
  onScroll: scrollHandler,
package/keyboard.mjs CHANGED
@@ -2,14 +2,11 @@ import * as React from 'react';
2
2
  import { forwardRef, useRef, useCallback } from 'react';
3
3
  import { StyleSheet, Platform } from 'react-native';
4
4
  import { useKeyboardHandler } from 'react-native-keyboard-controller';
5
- import { useAnimatedRef, useSharedValue, useAnimatedScrollHandler, runOnJS, runOnUI, useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';
5
+ import { useAnimatedRef, useSharedValue, useAnimatedScrollHandler, runOnJS, useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';
6
6
  import { AnimatedLegendList } from '@legendapp/list/reanimated';
7
7
 
8
8
  // src/integrations/keyboard.tsx
9
9
 
10
- // src/constants-platform.ts
11
- var IsNewArchitecture = true;
12
-
13
10
  // src/utils/helpers.ts
14
11
  function isFunction(obj) {
15
12
  return typeof obj === "function";
@@ -37,9 +34,9 @@ var clampProgress = (progress) => {
37
34
  "worklet";
38
35
  return Math.min(1, Math.max(0, progress));
39
36
  };
40
- var calculateKeyboardInset = (height, safeAreaInsetBottom, isNewArchitecture) => {
37
+ var calculateKeyboardInset = (height, safeAreaInsetBottom) => {
41
38
  "worklet";
42
- return Math.max(0, height - safeAreaInsetBottom) ;
39
+ return Math.max(0, height - safeAreaInsetBottom);
43
40
  };
44
41
  var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLength, alignItemsAtEnd) => {
45
42
  "worklet";
@@ -50,14 +47,6 @@ var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLen
50
47
  return Math.max(0, keyboardHeight - availableSpace);
51
48
  }
52
49
  };
53
- var calculateEndPaddingInset = (keyboardHeight, alignItemsAtEndPadding) => {
54
- "worklet";
55
- return Math.min(keyboardHeight, alignItemsAtEndPadding);
56
- };
57
- var calculateTopInset = (safeAreaInsetTop, isNewArchitecture, extraTopInset) => {
58
- "worklet";
59
- return (isNewArchitecture ? 0 : safeAreaInsetTop * 2) + extraTopInset;
60
- };
61
50
  var calculateKeyboardTargetOffset = (startOffset, keyboardHeight, isOpening, progress) => {
62
51
  "worklet";
63
52
  const normalizedProgress = isOpening ? progress : 1 - progress;
@@ -70,7 +59,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
70
59
  horizontal,
71
60
  onMetricsChange: onMetricsChangeProp,
72
61
  onScroll: onScrollProp,
73
- safeAreaInsets = { bottom: 0, top: 0 },
62
+ safeAreaInsetBottom = 0,
74
63
  style: styleProp,
75
64
  ...rest
76
65
  } = props;
@@ -85,14 +74,13 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
85
74
  const animatedOffsetY = useSharedValue(null);
86
75
  const scrollOffsetAtKeyboardStart = useSharedValue(0);
87
76
  const mode = useSharedValue("idle");
88
- const keyboardInset = useSharedValue({ bottom: 0, top: 0 });
77
+ const keyboardInset = useSharedValue(0);
89
78
  const keyboardHeight = useSharedValue(0);
90
79
  const contentLength = useSharedValue(0);
91
80
  const scrollLength = useSharedValue(0);
92
81
  const alignItemsAtEndPadding = useSharedValue(0);
93
82
  const isOpening = useSharedValue(false);
94
83
  const didInteractive = useSharedValue(false);
95
- const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = safeAreaInsets;
96
84
  const isKeyboardOpen = useSharedValue(false);
97
85
  const scrollHandler = useAnimatedScrollHandler(
98
86
  (event) => {
@@ -126,39 +114,9 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
126
114
  updateScrollMetrics();
127
115
  const nextPadding = metrics.alignItemsAtEndPadding || 0;
128
116
  alignItemsAtEndPadding.set(nextPadding);
129
- if (!horizontal) {
130
- runOnUI((padding, safeInsetTop, isNewArchitecture) => {
131
- "worklet";
132
- if (!isKeyboardOpen.get()) {
133
- return;
134
- }
135
- const vKeyboardHeight = keyboardHeight.get();
136
- const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
137
- vKeyboardHeight,
138
- contentLength.get(),
139
- scrollLength.get(),
140
- alignItemsAtEnd
141
- );
142
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, padding);
143
- const topInset = calculateTopInset(safeInsetTop, isNewArchitecture, vTopInset);
144
- keyboardInset.set({
145
- bottom: keyboardInset.get().bottom,
146
- top: topInset
147
- });
148
- })(nextPadding, safeAreaInsetTop, IsNewArchitecture);
149
- }
150
117
  onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
151
118
  },
152
- [
153
- alignItemsAtEndPadding,
154
- horizontal,
155
- isKeyboardOpen,
156
- keyboardHeight,
157
- keyboardInset,
158
- onMetricsChangeProp,
159
- safeAreaInsetTop,
160
- updateScrollMetrics
161
- ]
119
+ [alignItemsAtEndPadding, onMetricsChangeProp, updateScrollMetrics]
162
120
  );
163
121
  useKeyboardHandler(
164
122
  // biome-ignore assist/source/useSortedKeys: prefer start/move/end
@@ -187,18 +145,11 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
187
145
  }
188
146
  mode.set("running");
189
147
  if (!didInteractive.get()) {
190
- if (!isAndroid && !IsNewArchitecture) {
191
- keyboardInset.set({
192
- bottom: keyboardInset.get().bottom,
193
- // Legacy iOS uses a doubled top inset to keep content below the status bar.
194
- top: calculateTopInset(safeAreaInsetTop, IsNewArchitecture, 0)
195
- });
196
- }
197
148
  didInteractive.set(true);
198
149
  }
199
150
  if (isAndroid && !horizontal) {
200
151
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
201
- keyboardInset.set({ bottom: newInset, top: safeAreaInsetTop * 2 });
152
+ keyboardInset.set(newInset);
202
153
  }
203
154
  },
204
155
  onMove: (event) => {
@@ -213,8 +164,6 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
213
164
  scrollLength.get(),
214
165
  alignItemsAtEnd
215
166
  );
216
- const vAlignItemsPadding = alignItemsAtEndPadding.get();
217
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, vAlignItemsPadding);
218
167
  const targetOffset = calculateKeyboardTargetOffset(
219
168
  scrollOffsetAtKeyboardStart.get(),
220
169
  vEffectiveKeyboardHeight,
@@ -225,16 +174,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
225
174
  animatedOffsetY.set(targetOffset);
226
175
  if (!horizontal) {
227
176
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
228
- const topInset = calculateTopInset(
229
- safeAreaInsetTop,
230
- IsNewArchitecture,
231
- vIsOpening ? vTopInset : 0
232
- );
233
- keyboardInset.set({
234
- bottom: newInset,
235
- // Add top padding only while opening to keep end-aligned items visible.
236
- top: topInset
237
- });
177
+ keyboardInset.set(newInset);
238
178
  }
239
179
  }
240
180
  },
@@ -252,8 +192,6 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
252
192
  scrollLength.get(),
253
193
  alignItemsAtEnd
254
194
  );
255
- const vAlignItemsPadding = alignItemsAtEndPadding.get();
256
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, vAlignItemsPadding);
257
195
  const vIsOpening = isOpening.get();
258
196
  if (!wasInteractive) {
259
197
  const targetOffset = calculateKeyboardTargetOffset(
@@ -270,16 +208,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
270
208
  isKeyboardOpen.set(event.height > 0);
271
209
  if (!horizontal) {
272
210
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
273
- const topInset = calculateTopInset(
274
- safeAreaInsetTop,
275
- IsNewArchitecture,
276
- event.height > 0 ? vTopInset : 0
277
- );
278
- keyboardInset.set({
279
- bottom: newInset,
280
- // Preserve end-aligned padding only while the keyboard is visible.
281
- top: topInset
282
- });
211
+ keyboardInset.set(newInset);
283
212
  if (newInset <= 0) {
284
213
  animatedOffsetY.set(scrollOffsetY.get());
285
214
  }
@@ -299,24 +228,21 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
299
228
  y: vAnimatedOffsetY
300
229
  }
301
230
  };
302
- const { top: keyboardInsetTop, bottom: keyboardInsetBottom } = keyboardInset.get();
231
+ const keyboardInsetBottom = keyboardInset.get();
303
232
  return isIos ? Object.assign(baseProps, {
304
233
  contentInset: {
305
234
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
306
235
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
307
236
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
308
- top: ((_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0) - keyboardInsetTop
237
+ top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
309
238
  }
310
239
  }) : baseProps;
311
240
  });
312
241
  const style = isAndroid ? useAnimatedStyle(
313
- () => {
314
- var _a;
315
- return {
316
- ...styleFlattened || {},
317
- marginBottom: (_a = keyboardInset.get().bottom) != null ? _a : 0
318
- };
319
- },
242
+ () => ({
243
+ ...styleFlattened || {},
244
+ marginBottom: keyboardInset.get()
245
+ }),
320
246
  [styleProp, keyboardInset]
321
247
  ) : void 0;
322
248
  return /* @__PURE__ */ React.createElement(
@@ -324,6 +250,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
324
250
  {
325
251
  ...rest,
326
252
  animatedProps,
253
+ automaticallyAdjustContentInsets: false,
327
254
  keyboardDismissMode: "interactive",
328
255
  onMetricsChange: handleMetricsChange,
329
256
  onScroll: scrollHandler,
@@ -4,13 +4,10 @@ import { ReanimatedScrollEvent } from 'react-native-reanimated/lib/typescript/ho
4
4
  import { LegendListRef } from '@legendapp/list';
5
5
  import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
6
6
 
7
- declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "contentInset"> & {
7
+ declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "automaticallyAdjustContentInsets" | "contentInset"> & {
8
8
  onScroll?: (event: ReanimatedScrollEvent) => void;
9
9
  contentInset?: Insets | undefined;
10
- safeAreaInsets?: {
11
- top: number;
12
- bottom: number;
13
- };
10
+ safeAreaInsetBottom?: number;
14
11
  } & React.RefAttributes<LegendListRef>) => React.ReactNode;
15
12
 
16
13
  export { KeyboardAvoidingLegendList, KeyboardAvoidingLegendList as LegendList };
@@ -4,13 +4,10 @@ import { ReanimatedScrollEvent } from 'react-native-reanimated/lib/typescript/ho
4
4
  import { LegendListRef } from '@legendapp/list';
5
5
  import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
6
6
 
7
- declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "contentInset"> & {
7
+ declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "automaticallyAdjustContentInsets" | "contentInset"> & {
8
8
  onScroll?: (event: ReanimatedScrollEvent) => void;
9
9
  contentInset?: Insets | undefined;
10
- safeAreaInsets?: {
11
- top: number;
12
- bottom: number;
13
- };
10
+ safeAreaInsetBottom?: number;
14
11
  } & React.RefAttributes<LegendListRef>) => React.ReactNode;
15
12
 
16
13
  export { KeyboardAvoidingLegendList, KeyboardAvoidingLegendList as LegendList };
@@ -28,10 +28,6 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
28
 
29
29
  // src/integrations/keyboard.tsx
30
30
 
31
- // src/constants-platform.native.ts
32
- var f = global.nativeFabricUIManager;
33
- var IsNewArchitecture = f !== void 0 && f != null;
34
-
35
31
  // src/utils/helpers.ts
36
32
  function isFunction(obj) {
37
33
  return typeof obj === "function";
@@ -59,9 +55,9 @@ var clampProgress = (progress) => {
59
55
  "worklet";
60
56
  return Math.min(1, Math.max(0, progress));
61
57
  };
62
- var calculateKeyboardInset = (height, safeAreaInsetBottom, isNewArchitecture) => {
58
+ var calculateKeyboardInset = (height, safeAreaInsetBottom) => {
63
59
  "worklet";
64
- return isNewArchitecture ? Math.max(0, height - safeAreaInsetBottom) : Math.max(isNewArchitecture ? 0 : -safeAreaInsetBottom, height - safeAreaInsetBottom * 2);
60
+ return Math.max(0, height - safeAreaInsetBottom);
65
61
  };
66
62
  var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLength, alignItemsAtEnd) => {
67
63
  "worklet";
@@ -72,14 +68,6 @@ var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLen
72
68
  return Math.max(0, keyboardHeight - availableSpace);
73
69
  }
74
70
  };
75
- var calculateEndPaddingInset = (keyboardHeight, alignItemsAtEndPadding) => {
76
- "worklet";
77
- return Math.min(keyboardHeight, alignItemsAtEndPadding);
78
- };
79
- var calculateTopInset = (safeAreaInsetTop, isNewArchitecture, extraTopInset) => {
80
- "worklet";
81
- return (isNewArchitecture ? 0 : safeAreaInsetTop * 2) + extraTopInset;
82
- };
83
71
  var calculateKeyboardTargetOffset = (startOffset, keyboardHeight, isOpening, progress) => {
84
72
  "worklet";
85
73
  const normalizedProgress = isOpening ? progress : 1 - progress;
@@ -92,7 +80,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
92
80
  horizontal,
93
81
  onMetricsChange: onMetricsChangeProp,
94
82
  onScroll: onScrollProp,
95
- safeAreaInsets = { bottom: 0, top: 0 },
83
+ safeAreaInsetBottom = 0,
96
84
  style: styleProp,
97
85
  ...rest
98
86
  } = props;
@@ -107,14 +95,13 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
107
95
  const animatedOffsetY = reactNativeReanimated.useSharedValue(null);
108
96
  const scrollOffsetAtKeyboardStart = reactNativeReanimated.useSharedValue(0);
109
97
  const mode = reactNativeReanimated.useSharedValue("idle");
110
- const keyboardInset = reactNativeReanimated.useSharedValue({ bottom: 0, top: 0 });
98
+ const keyboardInset = reactNativeReanimated.useSharedValue(0);
111
99
  const keyboardHeight = reactNativeReanimated.useSharedValue(0);
112
100
  const contentLength = reactNativeReanimated.useSharedValue(0);
113
101
  const scrollLength = reactNativeReanimated.useSharedValue(0);
114
102
  const alignItemsAtEndPadding = reactNativeReanimated.useSharedValue(0);
115
103
  const isOpening = reactNativeReanimated.useSharedValue(false);
116
104
  const didInteractive = reactNativeReanimated.useSharedValue(false);
117
- const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = safeAreaInsets;
118
105
  const isKeyboardOpen = reactNativeReanimated.useSharedValue(false);
119
106
  const scrollHandler = reactNativeReanimated.useAnimatedScrollHandler(
120
107
  (event) => {
@@ -148,39 +135,9 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
148
135
  updateScrollMetrics();
149
136
  const nextPadding = metrics.alignItemsAtEndPadding || 0;
150
137
  alignItemsAtEndPadding.set(nextPadding);
151
- if (!horizontal) {
152
- reactNativeReanimated.runOnUI((padding, safeInsetTop, isNewArchitecture) => {
153
- "worklet";
154
- if (!isKeyboardOpen.get()) {
155
- return;
156
- }
157
- const vKeyboardHeight = keyboardHeight.get();
158
- const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
159
- vKeyboardHeight,
160
- contentLength.get(),
161
- scrollLength.get(),
162
- alignItemsAtEnd
163
- );
164
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, padding);
165
- const topInset = calculateTopInset(safeInsetTop, isNewArchitecture, vTopInset);
166
- keyboardInset.set({
167
- bottom: keyboardInset.get().bottom,
168
- top: topInset
169
- });
170
- })(nextPadding, safeAreaInsetTop, IsNewArchitecture);
171
- }
172
138
  onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
173
139
  },
174
- [
175
- alignItemsAtEndPadding,
176
- horizontal,
177
- isKeyboardOpen,
178
- keyboardHeight,
179
- keyboardInset,
180
- onMetricsChangeProp,
181
- safeAreaInsetTop,
182
- updateScrollMetrics
183
- ]
140
+ [alignItemsAtEndPadding, onMetricsChangeProp, updateScrollMetrics]
184
141
  );
185
142
  reactNativeKeyboardController.useKeyboardHandler(
186
143
  // biome-ignore assist/source/useSortedKeys: prefer start/move/end
@@ -209,18 +166,11 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
209
166
  }
210
167
  mode.set("running");
211
168
  if (!didInteractive.get()) {
212
- if (!isAndroid && !IsNewArchitecture) {
213
- keyboardInset.set({
214
- bottom: keyboardInset.get().bottom,
215
- // Legacy iOS uses a doubled top inset to keep content below the status bar.
216
- top: calculateTopInset(safeAreaInsetTop, IsNewArchitecture, 0)
217
- });
218
- }
219
169
  didInteractive.set(true);
220
170
  }
221
171
  if (isAndroid && !horizontal) {
222
- const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom, IsNewArchitecture);
223
- keyboardInset.set({ bottom: newInset, top: safeAreaInsetTop * 2 });
172
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
173
+ keyboardInset.set(newInset);
224
174
  }
225
175
  },
226
176
  onMove: (event) => {
@@ -235,8 +185,6 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
235
185
  scrollLength.get(),
236
186
  alignItemsAtEnd
237
187
  );
238
- const vAlignItemsPadding = alignItemsAtEndPadding.get();
239
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, vAlignItemsPadding);
240
188
  const targetOffset = calculateKeyboardTargetOffset(
241
189
  scrollOffsetAtKeyboardStart.get(),
242
190
  vEffectiveKeyboardHeight,
@@ -246,17 +194,8 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
246
194
  scrollOffsetY.set(targetOffset);
247
195
  animatedOffsetY.set(targetOffset);
248
196
  if (!horizontal) {
249
- const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom, IsNewArchitecture);
250
- const topInset = calculateTopInset(
251
- safeAreaInsetTop,
252
- IsNewArchitecture,
253
- vIsOpening ? vTopInset : 0
254
- );
255
- keyboardInset.set({
256
- bottom: newInset,
257
- // Add top padding only while opening to keep end-aligned items visible.
258
- top: topInset
259
- });
197
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
198
+ keyboardInset.set(newInset);
260
199
  }
261
200
  }
262
201
  },
@@ -274,8 +213,6 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
274
213
  scrollLength.get(),
275
214
  alignItemsAtEnd
276
215
  );
277
- const vAlignItemsPadding = alignItemsAtEndPadding.get();
278
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, vAlignItemsPadding);
279
216
  const vIsOpening = isOpening.get();
280
217
  if (!wasInteractive) {
281
218
  const targetOffset = calculateKeyboardTargetOffset(
@@ -291,17 +228,8 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
291
228
  didInteractive.set(false);
292
229
  isKeyboardOpen.set(event.height > 0);
293
230
  if (!horizontal) {
294
- const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom, IsNewArchitecture);
295
- const topInset = calculateTopInset(
296
- safeAreaInsetTop,
297
- IsNewArchitecture,
298
- event.height > 0 ? vTopInset : 0
299
- );
300
- keyboardInset.set({
301
- bottom: newInset,
302
- // Preserve end-aligned padding only while the keyboard is visible.
303
- top: topInset
304
- });
231
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
232
+ keyboardInset.set(newInset);
305
233
  if (newInset <= 0) {
306
234
  animatedOffsetY.set(scrollOffsetY.get());
307
235
  }
@@ -321,24 +249,21 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
321
249
  y: vAnimatedOffsetY
322
250
  }
323
251
  };
324
- const { top: keyboardInsetTop, bottom: keyboardInsetBottom } = keyboardInset.get();
252
+ const keyboardInsetBottom = keyboardInset.get();
325
253
  return isIos ? Object.assign(baseProps, {
326
254
  contentInset: {
327
255
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
328
256
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
329
257
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
330
- top: ((_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0) - keyboardInsetTop
258
+ top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
331
259
  }
332
260
  }) : baseProps;
333
261
  });
334
262
  const style = isAndroid ? reactNativeReanimated.useAnimatedStyle(
335
- () => {
336
- var _a;
337
- return {
338
- ...styleFlattened || {},
339
- marginBottom: (_a = keyboardInset.get().bottom) != null ? _a : 0
340
- };
341
- },
263
+ () => ({
264
+ ...styleFlattened || {},
265
+ marginBottom: keyboardInset.get()
266
+ }),
342
267
  [styleProp, keyboardInset]
343
268
  ) : void 0;
344
269
  return /* @__PURE__ */ React__namespace.createElement(
@@ -346,6 +271,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
346
271
  {
347
272
  ...rest,
348
273
  animatedProps,
274
+ automaticallyAdjustContentInsets: false,
349
275
  keyboardDismissMode: "interactive",
350
276
  onMetricsChange: handleMetricsChange,
351
277
  onScroll: scrollHandler,
@@ -2,15 +2,11 @@ import * as React from 'react';
2
2
  import { forwardRef, useRef, useCallback } from 'react';
3
3
  import { StyleSheet, Platform } from 'react-native';
4
4
  import { useKeyboardHandler } from 'react-native-keyboard-controller';
5
- import { useAnimatedRef, useSharedValue, useAnimatedScrollHandler, runOnJS, runOnUI, useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';
5
+ import { useAnimatedRef, useSharedValue, useAnimatedScrollHandler, runOnJS, useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';
6
6
  import { AnimatedLegendList } from '@legendapp/list/reanimated';
7
7
 
8
8
  // src/integrations/keyboard.tsx
9
9
 
10
- // src/constants-platform.native.ts
11
- var f = global.nativeFabricUIManager;
12
- var IsNewArchitecture = f !== void 0 && f != null;
13
-
14
10
  // src/utils/helpers.ts
15
11
  function isFunction(obj) {
16
12
  return typeof obj === "function";
@@ -38,9 +34,9 @@ var clampProgress = (progress) => {
38
34
  "worklet";
39
35
  return Math.min(1, Math.max(0, progress));
40
36
  };
41
- var calculateKeyboardInset = (height, safeAreaInsetBottom, isNewArchitecture) => {
37
+ var calculateKeyboardInset = (height, safeAreaInsetBottom) => {
42
38
  "worklet";
43
- return isNewArchitecture ? Math.max(0, height - safeAreaInsetBottom) : Math.max(isNewArchitecture ? 0 : -safeAreaInsetBottom, height - safeAreaInsetBottom * 2);
39
+ return Math.max(0, height - safeAreaInsetBottom);
44
40
  };
45
41
  var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLength, alignItemsAtEnd) => {
46
42
  "worklet";
@@ -51,14 +47,6 @@ var calculateEffectiveKeyboardHeight = (keyboardHeight, contentLength, scrollLen
51
47
  return Math.max(0, keyboardHeight - availableSpace);
52
48
  }
53
49
  };
54
- var calculateEndPaddingInset = (keyboardHeight, alignItemsAtEndPadding) => {
55
- "worklet";
56
- return Math.min(keyboardHeight, alignItemsAtEndPadding);
57
- };
58
- var calculateTopInset = (safeAreaInsetTop, isNewArchitecture, extraTopInset) => {
59
- "worklet";
60
- return (isNewArchitecture ? 0 : safeAreaInsetTop * 2) + extraTopInset;
61
- };
62
50
  var calculateKeyboardTargetOffset = (startOffset, keyboardHeight, isOpening, progress) => {
63
51
  "worklet";
64
52
  const normalizedProgress = isOpening ? progress : 1 - progress;
@@ -71,7 +59,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
71
59
  horizontal,
72
60
  onMetricsChange: onMetricsChangeProp,
73
61
  onScroll: onScrollProp,
74
- safeAreaInsets = { bottom: 0, top: 0 },
62
+ safeAreaInsetBottom = 0,
75
63
  style: styleProp,
76
64
  ...rest
77
65
  } = props;
@@ -86,14 +74,13 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
86
74
  const animatedOffsetY = useSharedValue(null);
87
75
  const scrollOffsetAtKeyboardStart = useSharedValue(0);
88
76
  const mode = useSharedValue("idle");
89
- const keyboardInset = useSharedValue({ bottom: 0, top: 0 });
77
+ const keyboardInset = useSharedValue(0);
90
78
  const keyboardHeight = useSharedValue(0);
91
79
  const contentLength = useSharedValue(0);
92
80
  const scrollLength = useSharedValue(0);
93
81
  const alignItemsAtEndPadding = useSharedValue(0);
94
82
  const isOpening = useSharedValue(false);
95
83
  const didInteractive = useSharedValue(false);
96
- const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = safeAreaInsets;
97
84
  const isKeyboardOpen = useSharedValue(false);
98
85
  const scrollHandler = useAnimatedScrollHandler(
99
86
  (event) => {
@@ -127,39 +114,9 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
127
114
  updateScrollMetrics();
128
115
  const nextPadding = metrics.alignItemsAtEndPadding || 0;
129
116
  alignItemsAtEndPadding.set(nextPadding);
130
- if (!horizontal) {
131
- runOnUI((padding, safeInsetTop, isNewArchitecture) => {
132
- "worklet";
133
- if (!isKeyboardOpen.get()) {
134
- return;
135
- }
136
- const vKeyboardHeight = keyboardHeight.get();
137
- const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
138
- vKeyboardHeight,
139
- contentLength.get(),
140
- scrollLength.get(),
141
- alignItemsAtEnd
142
- );
143
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, padding);
144
- const topInset = calculateTopInset(safeInsetTop, isNewArchitecture, vTopInset);
145
- keyboardInset.set({
146
- bottom: keyboardInset.get().bottom,
147
- top: topInset
148
- });
149
- })(nextPadding, safeAreaInsetTop, IsNewArchitecture);
150
- }
151
117
  onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
152
118
  },
153
- [
154
- alignItemsAtEndPadding,
155
- horizontal,
156
- isKeyboardOpen,
157
- keyboardHeight,
158
- keyboardInset,
159
- onMetricsChangeProp,
160
- safeAreaInsetTop,
161
- updateScrollMetrics
162
- ]
119
+ [alignItemsAtEndPadding, onMetricsChangeProp, updateScrollMetrics]
163
120
  );
164
121
  useKeyboardHandler(
165
122
  // biome-ignore assist/source/useSortedKeys: prefer start/move/end
@@ -188,18 +145,11 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
188
145
  }
189
146
  mode.set("running");
190
147
  if (!didInteractive.get()) {
191
- if (!isAndroid && !IsNewArchitecture) {
192
- keyboardInset.set({
193
- bottom: keyboardInset.get().bottom,
194
- // Legacy iOS uses a doubled top inset to keep content below the status bar.
195
- top: calculateTopInset(safeAreaInsetTop, IsNewArchitecture, 0)
196
- });
197
- }
198
148
  didInteractive.set(true);
199
149
  }
200
150
  if (isAndroid && !horizontal) {
201
- const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom, IsNewArchitecture);
202
- keyboardInset.set({ bottom: newInset, top: safeAreaInsetTop * 2 });
151
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
152
+ keyboardInset.set(newInset);
203
153
  }
204
154
  },
205
155
  onMove: (event) => {
@@ -214,8 +164,6 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
214
164
  scrollLength.get(),
215
165
  alignItemsAtEnd
216
166
  );
217
- const vAlignItemsPadding = alignItemsAtEndPadding.get();
218
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, vAlignItemsPadding);
219
167
  const targetOffset = calculateKeyboardTargetOffset(
220
168
  scrollOffsetAtKeyboardStart.get(),
221
169
  vEffectiveKeyboardHeight,
@@ -225,17 +173,8 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
225
173
  scrollOffsetY.set(targetOffset);
226
174
  animatedOffsetY.set(targetOffset);
227
175
  if (!horizontal) {
228
- const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom, IsNewArchitecture);
229
- const topInset = calculateTopInset(
230
- safeAreaInsetTop,
231
- IsNewArchitecture,
232
- vIsOpening ? vTopInset : 0
233
- );
234
- keyboardInset.set({
235
- bottom: newInset,
236
- // Add top padding only while opening to keep end-aligned items visible.
237
- top: topInset
238
- });
176
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
177
+ keyboardInset.set(newInset);
239
178
  }
240
179
  }
241
180
  },
@@ -253,8 +192,6 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
253
192
  scrollLength.get(),
254
193
  alignItemsAtEnd
255
194
  );
256
- const vAlignItemsPadding = alignItemsAtEndPadding.get();
257
- const vTopInset = calculateEndPaddingInset(vEffectiveKeyboardHeight, vAlignItemsPadding);
258
195
  const vIsOpening = isOpening.get();
259
196
  if (!wasInteractive) {
260
197
  const targetOffset = calculateKeyboardTargetOffset(
@@ -270,17 +207,8 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
270
207
  didInteractive.set(false);
271
208
  isKeyboardOpen.set(event.height > 0);
272
209
  if (!horizontal) {
273
- const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom, IsNewArchitecture);
274
- const topInset = calculateTopInset(
275
- safeAreaInsetTop,
276
- IsNewArchitecture,
277
- event.height > 0 ? vTopInset : 0
278
- );
279
- keyboardInset.set({
280
- bottom: newInset,
281
- // Preserve end-aligned padding only while the keyboard is visible.
282
- top: topInset
283
- });
210
+ const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
211
+ keyboardInset.set(newInset);
284
212
  if (newInset <= 0) {
285
213
  animatedOffsetY.set(scrollOffsetY.get());
286
214
  }
@@ -300,24 +228,21 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
300
228
  y: vAnimatedOffsetY
301
229
  }
302
230
  };
303
- const { top: keyboardInsetTop, bottom: keyboardInsetBottom } = keyboardInset.get();
231
+ const keyboardInsetBottom = keyboardInset.get();
304
232
  return isIos ? Object.assign(baseProps, {
305
233
  contentInset: {
306
234
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
307
235
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
308
236
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
309
- top: ((_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0) - keyboardInsetTop
237
+ top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
310
238
  }
311
239
  }) : baseProps;
312
240
  });
313
241
  const style = isAndroid ? useAnimatedStyle(
314
- () => {
315
- var _a;
316
- return {
317
- ...styleFlattened || {},
318
- marginBottom: (_a = keyboardInset.get().bottom) != null ? _a : 0
319
- };
320
- },
242
+ () => ({
243
+ ...styleFlattened || {},
244
+ marginBottom: keyboardInset.get()
245
+ }),
321
246
  [styleProp, keyboardInset]
322
247
  ) : void 0;
323
248
  return /* @__PURE__ */ React.createElement(
@@ -325,6 +250,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
325
250
  {
326
251
  ...rest,
327
252
  animatedProps,
253
+ automaticallyAdjustContentInsets: false,
328
254
  keyboardDismissMode: "interactive",
329
255
  onMetricsChange: handleMetricsChange,
330
256
  onScroll: scrollHandler,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.0.0-beta.22",
3
+ "version": "3.0.0-beta.23",
4
4
  "description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
5
  "sideEffects": false,
6
6
  "private": false,