@legendapp/list 2.0.5 → 2.0.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.0.7
2
+ - Fix: Layout not working on react-native-macos because of transform instead of position
3
+
4
+ ## 2.0.6
5
+ - Fix: updateItemPositions edge case with items multiple screen heights long was breaking the loop too early
6
+
1
7
  ## 2.0.5
2
8
  - Perf: Change updateAllPositions to constrain processing to the scroll range
3
9
  - Fix: Crash when using snapTo in some environments
package/index.js CHANGED
@@ -266,17 +266,13 @@ var PositionViewAnimated = typedMemo(function PositionView2({
266
266
  const position$ = useValue$(`containerPosition${id}`, {
267
267
  getValue: (v) => v != null ? v : POSITION_OUT_OF_VIEW
268
268
  });
269
- return /* @__PURE__ */ React2__namespace.createElement(
270
- reactNative.Animated.View,
271
- {
272
- ref: refView,
273
- style: [
274
- style,
275
- horizontal ? { transform: [{ translateX: position$ }] } : { transform: [{ translateY: position$ }] }
276
- ],
277
- ...rest
278
- }
279
- );
269
+ let position;
270
+ if (reactNative.Platform.OS === "ios" || reactNative.Platform.OS === "android") {
271
+ position = horizontal ? { transform: [{ translateX: position$ }] } : { transform: [{ translateY: position$ }] };
272
+ } else {
273
+ position = horizontal ? { left: position$ } : { top: position$ };
274
+ }
275
+ return /* @__PURE__ */ React2__namespace.createElement(reactNative.Animated.View, { ref: refView, style: [style, position], ...rest });
280
276
  });
281
277
  var PositionViewSticky = typedMemo(function PositionViewSticky2({
282
278
  id,
@@ -1217,12 +1213,16 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
1217
1213
  }
1218
1214
  const needsIndexByKey = dataChanged || indexByKey.size === 0;
1219
1215
  let didBreakEarly = false;
1216
+ let breakAt;
1220
1217
  const dataLength = data.length;
1221
1218
  for (let i = startIndex; i < dataLength; i++) {
1222
- if (!dataChanged && currentRowTop > maxVisibleArea) {
1219
+ if (breakAt && i > breakAt) {
1223
1220
  didBreakEarly = true;
1224
1221
  break;
1225
1222
  }
1223
+ if (!dataChanged && currentRowTop > maxVisibleArea) {
1224
+ breakAt = i + 10;
1225
+ }
1226
1226
  const id = (_e = idCache.get(i)) != null ? _e : getId(state, i);
1227
1227
  const size = (_f = sizesKnown.get(id)) != null ? _f : getItemSize(state, id, i, data[i], useAverageSize);
1228
1228
  if (__DEV__ && needsIndexByKey) {
package/index.mjs CHANGED
@@ -245,17 +245,13 @@ var PositionViewAnimated = typedMemo(function PositionView2({
245
245
  const position$ = useValue$(`containerPosition${id}`, {
246
246
  getValue: (v) => v != null ? v : POSITION_OUT_OF_VIEW
247
247
  });
248
- return /* @__PURE__ */ React2.createElement(
249
- Animated.View,
250
- {
251
- ref: refView,
252
- style: [
253
- style,
254
- horizontal ? { transform: [{ translateX: position$ }] } : { transform: [{ translateY: position$ }] }
255
- ],
256
- ...rest
257
- }
258
- );
248
+ let position;
249
+ if (Platform.OS === "ios" || Platform.OS === "android") {
250
+ position = horizontal ? { transform: [{ translateX: position$ }] } : { transform: [{ translateY: position$ }] };
251
+ } else {
252
+ position = horizontal ? { left: position$ } : { top: position$ };
253
+ }
254
+ return /* @__PURE__ */ React2.createElement(Animated.View, { ref: refView, style: [style, position], ...rest });
259
255
  });
260
256
  var PositionViewSticky = typedMemo(function PositionViewSticky2({
261
257
  id,
@@ -1196,12 +1192,16 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
1196
1192
  }
1197
1193
  const needsIndexByKey = dataChanged || indexByKey.size === 0;
1198
1194
  let didBreakEarly = false;
1195
+ let breakAt;
1199
1196
  const dataLength = data.length;
1200
1197
  for (let i = startIndex; i < dataLength; i++) {
1201
- if (!dataChanged && currentRowTop > maxVisibleArea) {
1198
+ if (breakAt && i > breakAt) {
1202
1199
  didBreakEarly = true;
1203
1200
  break;
1204
1201
  }
1202
+ if (!dataChanged && currentRowTop > maxVisibleArea) {
1203
+ breakAt = i + 10;
1204
+ }
1205
1205
  const id = (_e = idCache.get(i)) != null ? _e : getId(state, i);
1206
1206
  const size = (_f = sizesKnown.get(id)) != null ? _f : getItemSize(state, id, i, data[i], useAverageSize);
1207
1207
  if (__DEV__ && needsIndexByKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "2.0.5",
3
+ "version": "2.0.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,