@legendapp/list 3.1.1 → 3.1.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 3.1.2
2
+
3
+ - Fix: On Android, end-aligned lists could double apply scroll clamping during MVCP and be slightly underscrolled
4
+
1
5
  ## 3.1.1
2
6
 
3
7
  - Fix: `maintainScrollAtEnd` now stays pinned when a `ListFooterComponent` appears, disappears, or changes size, so chat typing indicators and other dynamic footers do not leave the list slightly above the end. If you use an explicit `maintainScrollAtEnd.on` config, add `footerLayout` to opt into footer size changes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
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,
package/react-native.js CHANGED
@@ -1861,8 +1861,11 @@ function updateAdaptiveRender(ctx, scrollVelocity) {
1861
1861
  // src/utils/getEffectiveDrawDistance.ts
1862
1862
  var INITIAL_DRAW_DISTANCE = 100;
1863
1863
  function getEffectiveDrawDistance(ctx) {
1864
+ var _a3;
1864
1865
  const drawDistance = ctx.state.props.drawDistance;
1865
- return peek$(ctx, "readyToRender") ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
1866
+ const initialScroll = ctx.state.initialScroll;
1867
+ const needsFullInitialDrawDistance = initialScroll !== void 0 && ((_a3 = initialScroll.viewPosition) != null ? _a3 : 0) > 0;
1868
+ return peek$(ctx, "readyToRender") || needsFullInitialDrawDistance ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
1866
1869
  }
1867
1870
 
1868
1871
  // src/utils/setInitialRenderState.ts
@@ -2763,6 +2766,9 @@ function prepareMVCP(ctx, dataChanged) {
2763
2766
  if (diff > 0) {
2764
2767
  diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
2765
2768
  } else {
2769
+ const maxScroll = Math.max(0, totalSize - state.scrollLength);
2770
+ state.scroll = maxScroll;
2771
+ state.scrollPending = maxScroll;
2766
2772
  diff = 0;
2767
2773
  }
2768
2774
  }
@@ -4970,7 +4976,7 @@ function calculateItemsInView(ctx, params = {}) {
4970
4976
  const scrollAdjustPendingBeforeMVCP = (_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0;
4971
4977
  checkMVCP == null ? void 0 : checkMVCP();
4972
4978
  const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_g = peek$(ctx, "scrollAdjustPending")) != null ? _g : 0) !== scrollAdjustPendingBeforeMVCP);
4973
- if (didMVCPAdjustScroll && initialScroll) {
4979
+ if (didMVCPAdjustScroll && (initialScroll || state.scrollingTo)) {
4974
4980
  updateScroll2(state.scroll);
4975
4981
  updateScrollRange();
4976
4982
  }
package/react-native.mjs CHANGED
@@ -1840,8 +1840,11 @@ function updateAdaptiveRender(ctx, scrollVelocity) {
1840
1840
  // src/utils/getEffectiveDrawDistance.ts
1841
1841
  var INITIAL_DRAW_DISTANCE = 100;
1842
1842
  function getEffectiveDrawDistance(ctx) {
1843
+ var _a3;
1843
1844
  const drawDistance = ctx.state.props.drawDistance;
1844
- return peek$(ctx, "readyToRender") ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
1845
+ const initialScroll = ctx.state.initialScroll;
1846
+ const needsFullInitialDrawDistance = initialScroll !== void 0 && ((_a3 = initialScroll.viewPosition) != null ? _a3 : 0) > 0;
1847
+ return peek$(ctx, "readyToRender") || needsFullInitialDrawDistance ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
1845
1848
  }
1846
1849
 
1847
1850
  // src/utils/setInitialRenderState.ts
@@ -2742,6 +2745,9 @@ function prepareMVCP(ctx, dataChanged) {
2742
2745
  if (diff > 0) {
2743
2746
  diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
2744
2747
  } else {
2748
+ const maxScroll = Math.max(0, totalSize - state.scrollLength);
2749
+ state.scroll = maxScroll;
2750
+ state.scrollPending = maxScroll;
2745
2751
  diff = 0;
2746
2752
  }
2747
2753
  }
@@ -4949,7 +4955,7 @@ function calculateItemsInView(ctx, params = {}) {
4949
4955
  const scrollAdjustPendingBeforeMVCP = (_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0;
4950
4956
  checkMVCP == null ? void 0 : checkMVCP();
4951
4957
  const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_g = peek$(ctx, "scrollAdjustPending")) != null ? _g : 0) !== scrollAdjustPendingBeforeMVCP);
4952
- if (didMVCPAdjustScroll && initialScroll) {
4958
+ if (didMVCPAdjustScroll && (initialScroll || state.scrollingTo)) {
4953
4959
  updateScroll2(state.scroll);
4954
4960
  updateScrollRange();
4955
4961
  }
@@ -2330,8 +2330,11 @@ function updateAdaptiveRender(ctx, scrollVelocity) {
2330
2330
  // src/utils/getEffectiveDrawDistance.ts
2331
2331
  var INITIAL_DRAW_DISTANCE = 100;
2332
2332
  function getEffectiveDrawDistance(ctx) {
2333
+ var _a3;
2333
2334
  const drawDistance = ctx.state.props.drawDistance;
2334
- return peek$(ctx, "readyToRender") ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
2335
+ const initialScroll = ctx.state.initialScroll;
2336
+ const needsFullInitialDrawDistance = initialScroll !== void 0 && ((_a3 = initialScroll.viewPosition) != null ? _a3 : 0) > 0;
2337
+ return peek$(ctx, "readyToRender") || needsFullInitialDrawDistance ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
2335
2338
  }
2336
2339
 
2337
2340
  // src/utils/setInitialRenderState.ts
@@ -3251,6 +3254,9 @@ function prepareMVCP(ctx, dataChanged) {
3251
3254
  if (diff > 0) {
3252
3255
  diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
3253
3256
  } else {
3257
+ const maxScroll = Math.max(0, totalSize - state.scrollLength);
3258
+ state.scroll = maxScroll;
3259
+ state.scrollPending = maxScroll;
3254
3260
  diff = 0;
3255
3261
  }
3256
3262
  }
@@ -5598,7 +5604,7 @@ function calculateItemsInView(ctx, params = {}) {
5598
5604
  const scrollAdjustPendingBeforeMVCP = (_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0;
5599
5605
  checkMVCP == null ? void 0 : checkMVCP();
5600
5606
  const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_g = peek$(ctx, "scrollAdjustPending")) != null ? _g : 0) !== scrollAdjustPendingBeforeMVCP);
5601
- if (didMVCPAdjustScroll && initialScroll) {
5607
+ if (didMVCPAdjustScroll && (initialScroll || state.scrollingTo)) {
5602
5608
  updateScroll2(state.scroll);
5603
5609
  updateScrollRange();
5604
5610
  }
@@ -2309,8 +2309,11 @@ function updateAdaptiveRender(ctx, scrollVelocity) {
2309
2309
  // src/utils/getEffectiveDrawDistance.ts
2310
2310
  var INITIAL_DRAW_DISTANCE = 100;
2311
2311
  function getEffectiveDrawDistance(ctx) {
2312
+ var _a3;
2312
2313
  const drawDistance = ctx.state.props.drawDistance;
2313
- return peek$(ctx, "readyToRender") ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
2314
+ const initialScroll = ctx.state.initialScroll;
2315
+ const needsFullInitialDrawDistance = initialScroll !== void 0 && ((_a3 = initialScroll.viewPosition) != null ? _a3 : 0) > 0;
2316
+ return peek$(ctx, "readyToRender") || needsFullInitialDrawDistance ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
2314
2317
  }
2315
2318
 
2316
2319
  // src/utils/setInitialRenderState.ts
@@ -3230,6 +3233,9 @@ function prepareMVCP(ctx, dataChanged) {
3230
3233
  if (diff > 0) {
3231
3234
  diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
3232
3235
  } else {
3236
+ const maxScroll = Math.max(0, totalSize - state.scrollLength);
3237
+ state.scroll = maxScroll;
3238
+ state.scrollPending = maxScroll;
3233
3239
  diff = 0;
3234
3240
  }
3235
3241
  }
@@ -5577,7 +5583,7 @@ function calculateItemsInView(ctx, params = {}) {
5577
5583
  const scrollAdjustPendingBeforeMVCP = (_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0;
5578
5584
  checkMVCP == null ? void 0 : checkMVCP();
5579
5585
  const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_g = peek$(ctx, "scrollAdjustPending")) != null ? _g : 0) !== scrollAdjustPendingBeforeMVCP);
5580
- if (didMVCPAdjustScroll && initialScroll) {
5586
+ if (didMVCPAdjustScroll && (initialScroll || state.scrollingTo)) {
5581
5587
  updateScroll2(state.scroll);
5582
5588
  updateScrollRange();
5583
5589
  }
package/react.js CHANGED
@@ -2330,8 +2330,11 @@ function updateAdaptiveRender(ctx, scrollVelocity) {
2330
2330
  // src/utils/getEffectiveDrawDistance.ts
2331
2331
  var INITIAL_DRAW_DISTANCE = 100;
2332
2332
  function getEffectiveDrawDistance(ctx) {
2333
+ var _a3;
2333
2334
  const drawDistance = ctx.state.props.drawDistance;
2334
- return peek$(ctx, "readyToRender") ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
2335
+ const initialScroll = ctx.state.initialScroll;
2336
+ const needsFullInitialDrawDistance = initialScroll !== void 0 && ((_a3 = initialScroll.viewPosition) != null ? _a3 : 0) > 0;
2337
+ return peek$(ctx, "readyToRender") || needsFullInitialDrawDistance ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
2335
2338
  }
2336
2339
 
2337
2340
  // src/utils/setInitialRenderState.ts
@@ -3251,6 +3254,9 @@ function prepareMVCP(ctx, dataChanged) {
3251
3254
  if (diff > 0) {
3252
3255
  diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
3253
3256
  } else {
3257
+ const maxScroll = Math.max(0, totalSize - state.scrollLength);
3258
+ state.scroll = maxScroll;
3259
+ state.scrollPending = maxScroll;
3254
3260
  diff = 0;
3255
3261
  }
3256
3262
  }
@@ -5598,7 +5604,7 @@ function calculateItemsInView(ctx, params = {}) {
5598
5604
  const scrollAdjustPendingBeforeMVCP = (_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0;
5599
5605
  checkMVCP == null ? void 0 : checkMVCP();
5600
5606
  const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_g = peek$(ctx, "scrollAdjustPending")) != null ? _g : 0) !== scrollAdjustPendingBeforeMVCP);
5601
- if (didMVCPAdjustScroll && initialScroll) {
5607
+ if (didMVCPAdjustScroll && (initialScroll || state.scrollingTo)) {
5602
5608
  updateScroll2(state.scroll);
5603
5609
  updateScrollRange();
5604
5610
  }
package/react.mjs CHANGED
@@ -2309,8 +2309,11 @@ function updateAdaptiveRender(ctx, scrollVelocity) {
2309
2309
  // src/utils/getEffectiveDrawDistance.ts
2310
2310
  var INITIAL_DRAW_DISTANCE = 100;
2311
2311
  function getEffectiveDrawDistance(ctx) {
2312
+ var _a3;
2312
2313
  const drawDistance = ctx.state.props.drawDistance;
2313
- return peek$(ctx, "readyToRender") ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
2314
+ const initialScroll = ctx.state.initialScroll;
2315
+ const needsFullInitialDrawDistance = initialScroll !== void 0 && ((_a3 = initialScroll.viewPosition) != null ? _a3 : 0) > 0;
2316
+ return peek$(ctx, "readyToRender") || needsFullInitialDrawDistance ? drawDistance : Math.min(drawDistance, INITIAL_DRAW_DISTANCE);
2314
2317
  }
2315
2318
 
2316
2319
  // src/utils/setInitialRenderState.ts
@@ -3230,6 +3233,9 @@ function prepareMVCP(ctx, dataChanged) {
3230
3233
  if (diff > 0) {
3231
3234
  diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
3232
3235
  } else {
3236
+ const maxScroll = Math.max(0, totalSize - state.scrollLength);
3237
+ state.scroll = maxScroll;
3238
+ state.scrollPending = maxScroll;
3233
3239
  diff = 0;
3234
3240
  }
3235
3241
  }
@@ -5577,7 +5583,7 @@ function calculateItemsInView(ctx, params = {}) {
5577
5583
  const scrollAdjustPendingBeforeMVCP = (_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0;
5578
5584
  checkMVCP == null ? void 0 : checkMVCP();
5579
5585
  const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_g = peek$(ctx, "scrollAdjustPending")) != null ? _g : 0) !== scrollAdjustPendingBeforeMVCP);
5580
- if (didMVCPAdjustScroll && initialScroll) {
5586
+ if (didMVCPAdjustScroll && (initialScroll || state.scrollingTo)) {
5581
5587
  updateScroll2(state.scroll);
5582
5588
  updateScrollRange();
5583
5589
  }