@legendapp/list 3.0.0-beta.24 → 3.0.0-beta.26

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.js CHANGED
@@ -35,24 +35,14 @@ var Text = View;
35
35
 
36
36
  // src/state/getContentInsetEnd.ts
37
37
  function getContentInsetEnd(state) {
38
- var _a3, _b;
38
+ var _a3;
39
39
  const { props } = state;
40
40
  const horizontal = props.horizontal;
41
- let contentInset = props.contentInset;
42
- if (!contentInset) {
43
- const animatedInset = (_a3 = props.animatedProps) == null ? void 0 : _a3.contentInset;
44
- if (animatedInset) {
45
- if ("get" in animatedInset) {
46
- contentInset = animatedInset.get();
47
- } else {
48
- contentInset = animatedInset;
49
- }
50
- }
51
- }
41
+ const contentInset = props.contentInset;
52
42
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
53
- const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
43
+ const overrideInset = (_a3 = state.contentInsetOverride) != null ? _a3 : void 0;
54
44
  if (overrideInset) {
55
- const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
45
+ const mergedInset = { bottom: 0, left: 0, right: 0, top: 0, ...baseInset, ...overrideInset };
56
46
  return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
57
47
  }
58
48
  if (baseInset) {
@@ -3571,6 +3561,11 @@ function createImperativeHandle(ctx) {
3571
3561
  start: state.startNoBuffer,
3572
3562
  startBuffered: state.startBuffered
3573
3563
  }),
3564
+ reportContentInset: (inset) => {
3565
+ state.contentInsetOverride = inset != null ? inset : void 0;
3566
+ updateAlignItemsPaddingTop(ctx);
3567
+ updateScroll(ctx, state.scroll, true);
3568
+ },
3574
3569
  scrollIndexIntoView,
3575
3570
  scrollItemIntoView: ({ item, ...props }) => {
3576
3571
  const data = state.props.data;
@@ -3603,10 +3598,6 @@ function createImperativeHandle(ctx) {
3603
3598
  }
3604
3599
  },
3605
3600
  scrollToOffset: (params) => scrollTo(ctx, params),
3606
- reportContentInset: (inset) => {
3607
- state.contentInsetOverride = inset != null ? inset : void 0;
3608
- updateScroll(ctx, state.scroll, true);
3609
- },
3610
3601
  setScrollProcessingEnabled: (enabled) => {
3611
3602
  state.scrollProcessingEnabled = enabled;
3612
3603
  },
package/index.mjs CHANGED
@@ -14,24 +14,14 @@ var Text = View;
14
14
 
15
15
  // src/state/getContentInsetEnd.ts
16
16
  function getContentInsetEnd(state) {
17
- var _a3, _b;
17
+ var _a3;
18
18
  const { props } = state;
19
19
  const horizontal = props.horizontal;
20
- let contentInset = props.contentInset;
21
- if (!contentInset) {
22
- const animatedInset = (_a3 = props.animatedProps) == null ? void 0 : _a3.contentInset;
23
- if (animatedInset) {
24
- if ("get" in animatedInset) {
25
- contentInset = animatedInset.get();
26
- } else {
27
- contentInset = animatedInset;
28
- }
29
- }
30
- }
20
+ const contentInset = props.contentInset;
31
21
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
32
- const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
22
+ const overrideInset = (_a3 = state.contentInsetOverride) != null ? _a3 : void 0;
33
23
  if (overrideInset) {
34
- const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
24
+ const mergedInset = { bottom: 0, left: 0, right: 0, top: 0, ...baseInset, ...overrideInset };
35
25
  return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
36
26
  }
37
27
  if (baseInset) {
@@ -3550,6 +3540,11 @@ function createImperativeHandle(ctx) {
3550
3540
  start: state.startNoBuffer,
3551
3541
  startBuffered: state.startBuffered
3552
3542
  }),
3543
+ reportContentInset: (inset) => {
3544
+ state.contentInsetOverride = inset != null ? inset : void 0;
3545
+ updateAlignItemsPaddingTop(ctx);
3546
+ updateScroll(ctx, state.scroll, true);
3547
+ },
3553
3548
  scrollIndexIntoView,
3554
3549
  scrollItemIntoView: ({ item, ...props }) => {
3555
3550
  const data = state.props.data;
@@ -3582,10 +3577,6 @@ function createImperativeHandle(ctx) {
3582
3577
  }
3583
3578
  },
3584
3579
  scrollToOffset: (params) => scrollTo(ctx, params),
3585
- reportContentInset: (inset) => {
3586
- state.contentInsetOverride = inset != null ? inset : void 0;
3587
- updateScroll(ctx, state.scroll, true);
3588
- },
3589
3580
  setScrollProcessingEnabled: (enabled) => {
3590
3581
  state.scrollProcessingEnabled = enabled;
3591
3582
  },
package/index.native.js CHANGED
@@ -31,24 +31,14 @@ var Text = reactNative.Text;
31
31
 
32
32
  // src/state/getContentInsetEnd.ts
33
33
  function getContentInsetEnd(state) {
34
- var _a3, _b;
34
+ var _a3;
35
35
  const { props } = state;
36
36
  const horizontal = props.horizontal;
37
- let contentInset = props.contentInset;
38
- if (!contentInset) {
39
- const animatedInset = (_a3 = props.animatedProps) == null ? void 0 : _a3.contentInset;
40
- if (animatedInset) {
41
- if ("get" in animatedInset) {
42
- contentInset = animatedInset.get();
43
- } else {
44
- contentInset = animatedInset;
45
- }
46
- }
47
- }
37
+ const contentInset = props.contentInset;
48
38
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
49
- const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
39
+ const overrideInset = (_a3 = state.contentInsetOverride) != null ? _a3 : void 0;
50
40
  if (overrideInset) {
51
- const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
41
+ const mergedInset = { bottom: 0, left: 0, right: 0, top: 0, ...baseInset, ...overrideInset };
52
42
  return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
53
43
  }
54
44
  if (baseInset) {
@@ -3373,6 +3363,11 @@ function createImperativeHandle(ctx) {
3373
3363
  start: state.startNoBuffer,
3374
3364
  startBuffered: state.startBuffered
3375
3365
  }),
3366
+ reportContentInset: (inset) => {
3367
+ state.contentInsetOverride = inset != null ? inset : void 0;
3368
+ updateAlignItemsPaddingTop(ctx);
3369
+ updateScroll(ctx, state.scroll, true);
3370
+ },
3376
3371
  scrollIndexIntoView,
3377
3372
  scrollItemIntoView: ({ item, ...props }) => {
3378
3373
  const data = state.props.data;
@@ -3405,10 +3400,6 @@ function createImperativeHandle(ctx) {
3405
3400
  }
3406
3401
  },
3407
3402
  scrollToOffset: (params) => scrollTo(ctx, params),
3408
- reportContentInset: (inset) => {
3409
- state.contentInsetOverride = inset != null ? inset : void 0;
3410
- updateScroll(ctx, state.scroll, true);
3411
- },
3412
3403
  setScrollProcessingEnabled: (enabled) => {
3413
3404
  state.scrollProcessingEnabled = enabled;
3414
3405
  },
package/index.native.mjs CHANGED
@@ -10,24 +10,14 @@ var Text = Text$1;
10
10
 
11
11
  // src/state/getContentInsetEnd.ts
12
12
  function getContentInsetEnd(state) {
13
- var _a3, _b;
13
+ var _a3;
14
14
  const { props } = state;
15
15
  const horizontal = props.horizontal;
16
- let contentInset = props.contentInset;
17
- if (!contentInset) {
18
- const animatedInset = (_a3 = props.animatedProps) == null ? void 0 : _a3.contentInset;
19
- if (animatedInset) {
20
- if ("get" in animatedInset) {
21
- contentInset = animatedInset.get();
22
- } else {
23
- contentInset = animatedInset;
24
- }
25
- }
26
- }
16
+ const contentInset = props.contentInset;
27
17
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
28
- const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
18
+ const overrideInset = (_a3 = state.contentInsetOverride) != null ? _a3 : void 0;
29
19
  if (overrideInset) {
30
- const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
20
+ const mergedInset = { bottom: 0, left: 0, right: 0, top: 0, ...baseInset, ...overrideInset };
31
21
  return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
32
22
  }
33
23
  if (baseInset) {
@@ -3352,6 +3342,11 @@ function createImperativeHandle(ctx) {
3352
3342
  start: state.startNoBuffer,
3353
3343
  startBuffered: state.startBuffered
3354
3344
  }),
3345
+ reportContentInset: (inset) => {
3346
+ state.contentInsetOverride = inset != null ? inset : void 0;
3347
+ updateAlignItemsPaddingTop(ctx);
3348
+ updateScroll(ctx, state.scroll, true);
3349
+ },
3355
3350
  scrollIndexIntoView,
3356
3351
  scrollItemIntoView: ({ item, ...props }) => {
3357
3352
  const data = state.props.data;
@@ -3384,10 +3379,6 @@ function createImperativeHandle(ctx) {
3384
3379
  }
3385
3380
  },
3386
3381
  scrollToOffset: (params) => scrollTo(ctx, params),
3387
- reportContentInset: (inset) => {
3388
- state.contentInsetOverride = inset != null ? inset : void 0;
3389
- updateScroll(ctx, state.scroll, true);
3390
- },
3391
3382
  setScrollProcessingEnabled: (enabled) => {
3392
3383
  state.scrollProcessingEnabled = enabled;
3393
3384
  },
package/keyboard.js CHANGED
@@ -121,6 +121,13 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
121
121
  },
122
122
  [refLegendList]
123
123
  );
124
+ const reportContentInset = React.useCallback(
125
+ (bottom) => {
126
+ var _a;
127
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
128
+ },
129
+ [refLegendList]
130
+ );
124
131
  const updateScrollMetrics = React.useCallback(() => {
125
132
  var _a;
126
133
  const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
@@ -153,9 +160,30 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
153
160
  if (event.height > 0) {
154
161
  keyboardHeight.set(event.height - safeAreaInsetBottom);
155
162
  }
156
- isOpening.set(progress > 0);
157
- scrollOffsetAtKeyboardStart.set(scrollOffsetY.get());
158
- animatedOffsetY.set(scrollOffsetY.get());
163
+ const vIsOpening = progress > 0;
164
+ isOpening.set(vIsOpening);
165
+ const vScrollOffset = scrollOffsetY.get();
166
+ scrollOffsetAtKeyboardStart.set(vScrollOffset);
167
+ if (isIos) {
168
+ const vContentLength = contentLength.get();
169
+ const vScrollLength = scrollLength.get();
170
+ const vKeyboardHeight = keyboardHeight.get();
171
+ const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
172
+ vKeyboardHeight,
173
+ vContentLength,
174
+ vScrollLength,
175
+ alignItemsAtEnd
176
+ );
177
+ const targetOffset = Math.max(
178
+ 0,
179
+ vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
180
+ );
181
+ scrollOffsetY.set(targetOffset);
182
+ animatedOffsetY.set(targetOffset);
183
+ keyboardInset.set(vEffectiveKeyboardHeight);
184
+ } else if (isAndroid) {
185
+ animatedOffsetY.set(vScrollOffset);
186
+ }
159
187
  reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
160
188
  }
161
189
  },
@@ -173,7 +201,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
173
201
  keyboardInset.set(newInset);
174
202
  }
175
203
  },
176
- onMove: (event) => {
204
+ onMove: isAndroid ? (event) => {
177
205
  "worklet";
178
206
  if (!didInteractive.get()) {
179
207
  const progress = clampProgress(event.progress);
@@ -193,12 +221,12 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
193
221
  );
194
222
  scrollOffsetY.set(targetOffset);
195
223
  animatedOffsetY.set(targetOffset);
196
- if (!horizontal) {
224
+ if (isAndroid && !horizontal) {
197
225
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
198
226
  keyboardInset.set(newInset);
199
227
  }
200
228
  }
201
- },
229
+ } : void 0,
202
230
  onEnd: (event) => {
203
231
  "worklet";
204
232
  const wasInteractive = didInteractive.get();
@@ -230,6 +258,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
230
258
  if (!horizontal) {
231
259
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
232
260
  keyboardInset.set(newInset);
261
+ reactNativeReanimated.runOnJS(reportContentInset)(newInset);
233
262
  if (newInset <= 0) {
234
263
  animatedOffsetY.set(scrollOffsetY.get());
235
264
  }
@@ -249,15 +278,20 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
249
278
  y: vAnimatedOffsetY
250
279
  }
251
280
  };
252
- const keyboardInsetBottom = keyboardInset.get();
253
- return isIos ? Object.assign(baseProps, {
254
- contentInset: {
281
+ if (isIos) {
282
+ const keyboardInsetBottom = keyboardInset.get();
283
+ const contentInset = {
255
284
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
256
285
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
257
286
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
258
287
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
259
- }
260
- }) : baseProps;
288
+ };
289
+ return Object.assign(baseProps, {
290
+ contentInset
291
+ });
292
+ } else {
293
+ return baseProps;
294
+ }
261
295
  });
262
296
  const style = isAndroid ? reactNativeReanimated.useAnimatedStyle(
263
297
  () => ({
package/keyboard.mjs CHANGED
@@ -100,6 +100,13 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
100
100
  },
101
101
  [refLegendList]
102
102
  );
103
+ const reportContentInset = useCallback(
104
+ (bottom) => {
105
+ var _a;
106
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
107
+ },
108
+ [refLegendList]
109
+ );
103
110
  const updateScrollMetrics = useCallback(() => {
104
111
  var _a;
105
112
  const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
@@ -132,9 +139,30 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
132
139
  if (event.height > 0) {
133
140
  keyboardHeight.set(event.height - safeAreaInsetBottom);
134
141
  }
135
- isOpening.set(progress > 0);
136
- scrollOffsetAtKeyboardStart.set(scrollOffsetY.get());
137
- animatedOffsetY.set(scrollOffsetY.get());
142
+ const vIsOpening = progress > 0;
143
+ isOpening.set(vIsOpening);
144
+ const vScrollOffset = scrollOffsetY.get();
145
+ scrollOffsetAtKeyboardStart.set(vScrollOffset);
146
+ if (isIos) {
147
+ const vContentLength = contentLength.get();
148
+ const vScrollLength = scrollLength.get();
149
+ const vKeyboardHeight = keyboardHeight.get();
150
+ const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
151
+ vKeyboardHeight,
152
+ vContentLength,
153
+ vScrollLength,
154
+ alignItemsAtEnd
155
+ );
156
+ const targetOffset = Math.max(
157
+ 0,
158
+ vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
159
+ );
160
+ scrollOffsetY.set(targetOffset);
161
+ animatedOffsetY.set(targetOffset);
162
+ keyboardInset.set(vEffectiveKeyboardHeight);
163
+ } else if (isAndroid) {
164
+ animatedOffsetY.set(vScrollOffset);
165
+ }
138
166
  runOnJS(setScrollProcessingEnabled)(false);
139
167
  }
140
168
  },
@@ -152,7 +180,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
152
180
  keyboardInset.set(newInset);
153
181
  }
154
182
  },
155
- onMove: (event) => {
183
+ onMove: isAndroid ? (event) => {
156
184
  "worklet";
157
185
  if (!didInteractive.get()) {
158
186
  const progress = clampProgress(event.progress);
@@ -172,12 +200,12 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
172
200
  );
173
201
  scrollOffsetY.set(targetOffset);
174
202
  animatedOffsetY.set(targetOffset);
175
- if (!horizontal) {
203
+ if (isAndroid && !horizontal) {
176
204
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
177
205
  keyboardInset.set(newInset);
178
206
  }
179
207
  }
180
- },
208
+ } : void 0,
181
209
  onEnd: (event) => {
182
210
  "worklet";
183
211
  const wasInteractive = didInteractive.get();
@@ -209,6 +237,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
209
237
  if (!horizontal) {
210
238
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
211
239
  keyboardInset.set(newInset);
240
+ runOnJS(reportContentInset)(newInset);
212
241
  if (newInset <= 0) {
213
242
  animatedOffsetY.set(scrollOffsetY.get());
214
243
  }
@@ -228,15 +257,20 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
228
257
  y: vAnimatedOffsetY
229
258
  }
230
259
  };
231
- const keyboardInsetBottom = keyboardInset.get();
232
- return isIos ? Object.assign(baseProps, {
233
- contentInset: {
260
+ if (isIos) {
261
+ const keyboardInsetBottom = keyboardInset.get();
262
+ const contentInset = {
234
263
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
235
264
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
236
265
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
237
266
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
238
- }
239
- }) : baseProps;
267
+ };
268
+ return Object.assign(baseProps, {
269
+ contentInset
270
+ });
271
+ } else {
272
+ return baseProps;
273
+ }
240
274
  });
241
275
  const style = isAndroid ? useAnimatedStyle(
242
276
  () => ({
@@ -121,6 +121,13 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
121
121
  },
122
122
  [refLegendList]
123
123
  );
124
+ const reportContentInset = React.useCallback(
125
+ (bottom) => {
126
+ var _a;
127
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
128
+ },
129
+ [refLegendList]
130
+ );
124
131
  const updateScrollMetrics = React.useCallback(() => {
125
132
  var _a;
126
133
  const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
@@ -153,9 +160,30 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
153
160
  if (event.height > 0) {
154
161
  keyboardHeight.set(event.height - safeAreaInsetBottom);
155
162
  }
156
- isOpening.set(progress > 0);
157
- scrollOffsetAtKeyboardStart.set(scrollOffsetY.get());
158
- animatedOffsetY.set(scrollOffsetY.get());
163
+ const vIsOpening = progress > 0;
164
+ isOpening.set(vIsOpening);
165
+ const vScrollOffset = scrollOffsetY.get();
166
+ scrollOffsetAtKeyboardStart.set(vScrollOffset);
167
+ if (isIos) {
168
+ const vContentLength = contentLength.get();
169
+ const vScrollLength = scrollLength.get();
170
+ const vKeyboardHeight = keyboardHeight.get();
171
+ const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
172
+ vKeyboardHeight,
173
+ vContentLength,
174
+ vScrollLength,
175
+ alignItemsAtEnd
176
+ );
177
+ const targetOffset = Math.max(
178
+ 0,
179
+ vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
180
+ );
181
+ scrollOffsetY.set(targetOffset);
182
+ animatedOffsetY.set(targetOffset);
183
+ keyboardInset.set(vEffectiveKeyboardHeight);
184
+ } else if (isAndroid) {
185
+ animatedOffsetY.set(vScrollOffset);
186
+ }
159
187
  reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
160
188
  }
161
189
  },
@@ -173,7 +201,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
173
201
  keyboardInset.set(newInset);
174
202
  }
175
203
  },
176
- onMove: (event) => {
204
+ onMove: isAndroid ? (event) => {
177
205
  "worklet";
178
206
  if (!didInteractive.get()) {
179
207
  const progress = clampProgress(event.progress);
@@ -193,12 +221,12 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
193
221
  );
194
222
  scrollOffsetY.set(targetOffset);
195
223
  animatedOffsetY.set(targetOffset);
196
- if (!horizontal) {
224
+ if (isAndroid && !horizontal) {
197
225
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
198
226
  keyboardInset.set(newInset);
199
227
  }
200
228
  }
201
- },
229
+ } : void 0,
202
230
  onEnd: (event) => {
203
231
  "worklet";
204
232
  const wasInteractive = didInteractive.get();
@@ -230,6 +258,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
230
258
  if (!horizontal) {
231
259
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
232
260
  keyboardInset.set(newInset);
261
+ reactNativeReanimated.runOnJS(reportContentInset)(newInset);
233
262
  if (newInset <= 0) {
234
263
  animatedOffsetY.set(scrollOffsetY.get());
235
264
  }
@@ -249,15 +278,20 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
249
278
  y: vAnimatedOffsetY
250
279
  }
251
280
  };
252
- const keyboardInsetBottom = keyboardInset.get();
253
- return isIos ? Object.assign(baseProps, {
254
- contentInset: {
281
+ if (isIos) {
282
+ const keyboardInsetBottom = keyboardInset.get();
283
+ const contentInset = {
255
284
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
256
285
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
257
286
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
258
287
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
259
- }
260
- }) : baseProps;
288
+ };
289
+ return Object.assign(baseProps, {
290
+ contentInset
291
+ });
292
+ } else {
293
+ return baseProps;
294
+ }
261
295
  });
262
296
  const style = isAndroid ? reactNativeReanimated.useAnimatedStyle(
263
297
  () => ({
@@ -100,6 +100,13 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
100
100
  },
101
101
  [refLegendList]
102
102
  );
103
+ const reportContentInset = useCallback(
104
+ (bottom) => {
105
+ var _a;
106
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
107
+ },
108
+ [refLegendList]
109
+ );
103
110
  const updateScrollMetrics = useCallback(() => {
104
111
  var _a;
105
112
  const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
@@ -132,9 +139,30 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
132
139
  if (event.height > 0) {
133
140
  keyboardHeight.set(event.height - safeAreaInsetBottom);
134
141
  }
135
- isOpening.set(progress > 0);
136
- scrollOffsetAtKeyboardStart.set(scrollOffsetY.get());
137
- animatedOffsetY.set(scrollOffsetY.get());
142
+ const vIsOpening = progress > 0;
143
+ isOpening.set(vIsOpening);
144
+ const vScrollOffset = scrollOffsetY.get();
145
+ scrollOffsetAtKeyboardStart.set(vScrollOffset);
146
+ if (isIos) {
147
+ const vContentLength = contentLength.get();
148
+ const vScrollLength = scrollLength.get();
149
+ const vKeyboardHeight = keyboardHeight.get();
150
+ const vEffectiveKeyboardHeight = calculateEffectiveKeyboardHeight(
151
+ vKeyboardHeight,
152
+ vContentLength,
153
+ vScrollLength,
154
+ alignItemsAtEnd
155
+ );
156
+ const targetOffset = Math.max(
157
+ 0,
158
+ vIsOpening ? vScrollOffset + vEffectiveKeyboardHeight : vScrollOffset - vEffectiveKeyboardHeight
159
+ );
160
+ scrollOffsetY.set(targetOffset);
161
+ animatedOffsetY.set(targetOffset);
162
+ keyboardInset.set(vEffectiveKeyboardHeight);
163
+ } else if (isAndroid) {
164
+ animatedOffsetY.set(vScrollOffset);
165
+ }
138
166
  runOnJS(setScrollProcessingEnabled)(false);
139
167
  }
140
168
  },
@@ -152,7 +180,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
152
180
  keyboardInset.set(newInset);
153
181
  }
154
182
  },
155
- onMove: (event) => {
183
+ onMove: isAndroid ? (event) => {
156
184
  "worklet";
157
185
  if (!didInteractive.get()) {
158
186
  const progress = clampProgress(event.progress);
@@ -172,12 +200,12 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
172
200
  );
173
201
  scrollOffsetY.set(targetOffset);
174
202
  animatedOffsetY.set(targetOffset);
175
- if (!horizontal) {
203
+ if (isAndroid && !horizontal) {
176
204
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
177
205
  keyboardInset.set(newInset);
178
206
  }
179
207
  }
180
- },
208
+ } : void 0,
181
209
  onEnd: (event) => {
182
210
  "worklet";
183
211
  const wasInteractive = didInteractive.get();
@@ -209,6 +237,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
209
237
  if (!horizontal) {
210
238
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
211
239
  keyboardInset.set(newInset);
240
+ runOnJS(reportContentInset)(newInset);
212
241
  if (newInset <= 0) {
213
242
  animatedOffsetY.set(scrollOffsetY.get());
214
243
  }
@@ -228,15 +257,20 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
228
257
  y: vAnimatedOffsetY
229
258
  }
230
259
  };
231
- const keyboardInsetBottom = keyboardInset.get();
232
- return isIos ? Object.assign(baseProps, {
233
- contentInset: {
260
+ if (isIos) {
261
+ const keyboardInsetBottom = keyboardInset.get();
262
+ const contentInset = {
234
263
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
235
264
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
236
265
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
237
266
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
238
- }
239
- }) : baseProps;
267
+ };
268
+ return Object.assign(baseProps, {
269
+ contentInset
270
+ });
271
+ } else {
272
+ return baseProps;
273
+ }
240
274
  });
241
275
  const style = isAndroid ? useAnimatedStyle(
242
276
  () => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.0.0-beta.24",
3
+ "version": "3.0.0-beta.26",
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,