@legendapp/list 2.0.0-beta.5 → 2.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +6 -4
  2. package/index.mjs +6 -4
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -288,17 +288,17 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
288
288
  index,
289
289
  ...rest
290
290
  }) {
291
- const [position = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);
291
+ const [position = POSITION_OUT_OF_VIEW, headerSize] = useArr$([`containerPosition${id}`, "headerSize"]);
292
292
  const transform = React3__namespace.useMemo(() => {
293
293
  if (animatedScrollY && stickyOffset) {
294
294
  const stickyPosition = animatedScrollY.interpolate({
295
295
  extrapolate: "clamp",
296
- inputRange: [position, position + 5e3],
296
+ inputRange: [position + headerSize, position + 5e3 + headerSize],
297
297
  outputRange: [position, position + 5e3]
298
298
  });
299
299
  return horizontal ? [{ translateX: stickyPosition }] : [{ translateY: stickyPosition }];
300
300
  }
301
- }, [position, horizontal, animatedScrollY, stickyOffset]);
301
+ }, [animatedScrollY, headerSize, horizontal, stickyOffset, position]);
302
302
  const viewStyle = React3__namespace.useMemo(() => [style, { zIndex: index + 1e3 }, { transform }], [style, transform]);
303
303
  return /* @__PURE__ */ React3__namespace.createElement(reactNative.Animated.View, { ref: refView, style: viewStyle, ...rest });
304
304
  });
@@ -1456,6 +1456,7 @@ function maybeUpdateViewabilityCallback(ctx, configId, containerId, viewToken) {
1456
1456
  const cb = ctx.mapViewabilityCallbacks.get(key);
1457
1457
  cb == null ? void 0 : cb(viewToken);
1458
1458
  }
1459
+ var batchedUpdates = reactNative.unstable_batchedUpdates || ((callback) => callback());
1459
1460
 
1460
1461
  // src/utils/checkAllSizesKnown.ts
1461
1462
  function checkAllSizesKnown(state) {
@@ -1799,7 +1800,7 @@ function handleStickyRecycling(ctx, state, stickyArray, scroll, scrollBuffer, pe
1799
1800
  }
1800
1801
  }
1801
1802
  function calculateItemsInView(ctx, state, params = {}) {
1802
- reactNative.unstable_batchedUpdates(() => {
1803
+ batchedUpdates(() => {
1803
1804
  var _a, _b, _c, _d, _e, _f, _g, _h;
1804
1805
  const {
1805
1806
  columns,
@@ -2030,6 +2031,7 @@ function calculateItemsInView(ctx, state, params = {}) {
2030
2031
  set$(ctx, `containerStickyOffset${containerIndex}`, new reactNative.Animated.Value(topPadding));
2031
2032
  state.stickyContainerPool.add(containerIndex);
2032
2033
  } else {
2034
+ set$(ctx, `containerSticky${containerIndex}`, false);
2033
2035
  state.stickyContainerPool.delete(containerIndex);
2034
2036
  }
2035
2037
  if (containerIndex >= numContainers2) {
package/index.mjs CHANGED
@@ -267,17 +267,17 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
267
267
  index,
268
268
  ...rest
269
269
  }) {
270
- const [position = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);
270
+ const [position = POSITION_OUT_OF_VIEW, headerSize] = useArr$([`containerPosition${id}`, "headerSize"]);
271
271
  const transform = React3.useMemo(() => {
272
272
  if (animatedScrollY && stickyOffset) {
273
273
  const stickyPosition = animatedScrollY.interpolate({
274
274
  extrapolate: "clamp",
275
- inputRange: [position, position + 5e3],
275
+ inputRange: [position + headerSize, position + 5e3 + headerSize],
276
276
  outputRange: [position, position + 5e3]
277
277
  });
278
278
  return horizontal ? [{ translateX: stickyPosition }] : [{ translateY: stickyPosition }];
279
279
  }
280
- }, [position, horizontal, animatedScrollY, stickyOffset]);
280
+ }, [animatedScrollY, headerSize, horizontal, stickyOffset, position]);
281
281
  const viewStyle = React3.useMemo(() => [style, { zIndex: index + 1e3 }, { transform }], [style, transform]);
282
282
  return /* @__PURE__ */ React3.createElement(Animated.View, { ref: refView, style: viewStyle, ...rest });
283
283
  });
@@ -1435,6 +1435,7 @@ function maybeUpdateViewabilityCallback(ctx, configId, containerId, viewToken) {
1435
1435
  const cb = ctx.mapViewabilityCallbacks.get(key);
1436
1436
  cb == null ? void 0 : cb(viewToken);
1437
1437
  }
1438
+ var batchedUpdates = unstable_batchedUpdates || ((callback) => callback());
1438
1439
 
1439
1440
  // src/utils/checkAllSizesKnown.ts
1440
1441
  function checkAllSizesKnown(state) {
@@ -1778,7 +1779,7 @@ function handleStickyRecycling(ctx, state, stickyArray, scroll, scrollBuffer, pe
1778
1779
  }
1779
1780
  }
1780
1781
  function calculateItemsInView(ctx, state, params = {}) {
1781
- unstable_batchedUpdates(() => {
1782
+ batchedUpdates(() => {
1782
1783
  var _a, _b, _c, _d, _e, _f, _g, _h;
1783
1784
  const {
1784
1785
  columns,
@@ -2009,6 +2010,7 @@ function calculateItemsInView(ctx, state, params = {}) {
2009
2010
  set$(ctx, `containerStickyOffset${containerIndex}`, new Animated.Value(topPadding));
2010
2011
  state.stickyContainerPool.add(containerIndex);
2011
2012
  } else {
2013
+ set$(ctx, `containerSticky${containerIndex}`, false);
2012
2014
  state.stickyContainerPool.delete(containerIndex);
2013
2015
  }
2014
2016
  if (containerIndex >= numContainers2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
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,