@legendapp/list 3.0.0-beta.39 → 3.0.0-beta.40

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
@@ -3577,14 +3577,32 @@ function doInitialAllocateContainers(ctx) {
3577
3577
  }
3578
3578
  }
3579
3579
 
3580
+ // src/platform/getWindowSize.ts
3581
+ function getWindowSize() {
3582
+ if (typeof window === "undefined") {
3583
+ return { height: 0, width: 0 };
3584
+ }
3585
+ return {
3586
+ height: window.innerHeight,
3587
+ width: window.innerWidth
3588
+ };
3589
+ }
3590
+
3580
3591
  // src/core/handleLayout.ts
3581
- function handleLayout(ctx, layout, setCanRender) {
3592
+ function handleLayout(ctx, layoutParam, setCanRender) {
3582
3593
  const state = ctx.state;
3583
- const { maintainScrollAtEnd } = state.props;
3584
- const measuredLength = layout[state.props.horizontal ? "width" : "height"];
3594
+ const { maintainScrollAtEnd, useWindowScroll } = state.props;
3595
+ const scrollAxis = state.props.horizontal ? "width" : "height";
3596
+ const otherAxis = state.props.horizontal ? "height" : "width";
3597
+ let layout = layoutParam;
3598
+ if (useWindowScroll) {
3599
+ const windowScrollAxisLength = getWindowSize()[scrollAxis];
3600
+ layout = windowScrollAxisLength > 0 ? { ...layoutParam, [scrollAxis]: windowScrollAxisLength } : layoutParam;
3601
+ }
3602
+ const measuredLength = layout[scrollAxis];
3585
3603
  const previousLength = state.scrollLength;
3586
3604
  const scrollLength = measuredLength > 0 ? measuredLength : previousLength;
3587
- const otherAxisSize = layout[state.props.horizontal ? "height" : "width"];
3605
+ const otherAxisSize = layout[otherAxis];
3588
3606
  const needsCalculate = !state.lastLayout || scrollLength > state.scrollLength || state.lastLayout.x !== layout.x || state.lastLayout.y !== layout.y;
3589
3607
  state.lastLayout = layout;
3590
3608
  const prevOtherAxisSize = state.otherAxisSize;
package/index.mjs CHANGED
@@ -3556,14 +3556,32 @@ function doInitialAllocateContainers(ctx) {
3556
3556
  }
3557
3557
  }
3558
3558
 
3559
+ // src/platform/getWindowSize.ts
3560
+ function getWindowSize() {
3561
+ if (typeof window === "undefined") {
3562
+ return { height: 0, width: 0 };
3563
+ }
3564
+ return {
3565
+ height: window.innerHeight,
3566
+ width: window.innerWidth
3567
+ };
3568
+ }
3569
+
3559
3570
  // src/core/handleLayout.ts
3560
- function handleLayout(ctx, layout, setCanRender) {
3571
+ function handleLayout(ctx, layoutParam, setCanRender) {
3561
3572
  const state = ctx.state;
3562
- const { maintainScrollAtEnd } = state.props;
3563
- const measuredLength = layout[state.props.horizontal ? "width" : "height"];
3573
+ const { maintainScrollAtEnd, useWindowScroll } = state.props;
3574
+ const scrollAxis = state.props.horizontal ? "width" : "height";
3575
+ const otherAxis = state.props.horizontal ? "height" : "width";
3576
+ let layout = layoutParam;
3577
+ if (useWindowScroll) {
3578
+ const windowScrollAxisLength = getWindowSize()[scrollAxis];
3579
+ layout = windowScrollAxisLength > 0 ? { ...layoutParam, [scrollAxis]: windowScrollAxisLength } : layoutParam;
3580
+ }
3581
+ const measuredLength = layout[scrollAxis];
3564
3582
  const previousLength = state.scrollLength;
3565
3583
  const scrollLength = measuredLength > 0 ? measuredLength : previousLength;
3566
- const otherAxisSize = layout[state.props.horizontal ? "height" : "width"];
3584
+ const otherAxisSize = layout[otherAxis];
3567
3585
  const needsCalculate = !state.lastLayout || scrollLength > state.scrollLength || state.lastLayout.x !== layout.x || state.lastLayout.y !== layout.y;
3568
3586
  state.lastLayout = layout;
3569
3587
  const prevOtherAxisSize = state.otherAxisSize;
package/index.native.js CHANGED
@@ -3154,15 +3154,29 @@ function doInitialAllocateContainers(ctx) {
3154
3154
  return true;
3155
3155
  }
3156
3156
  }
3157
+ function getWindowSize() {
3158
+ const screenSize = ReactNative.Dimensions.get("window");
3159
+ return {
3160
+ height: screenSize.height,
3161
+ width: screenSize.width
3162
+ };
3163
+ }
3157
3164
 
3158
3165
  // src/core/handleLayout.ts
3159
- function handleLayout(ctx, layout, setCanRender) {
3166
+ function handleLayout(ctx, layoutParam, setCanRender) {
3160
3167
  const state = ctx.state;
3161
- const { maintainScrollAtEnd } = state.props;
3162
- const measuredLength = layout[state.props.horizontal ? "width" : "height"];
3168
+ const { maintainScrollAtEnd, useWindowScroll } = state.props;
3169
+ const scrollAxis = state.props.horizontal ? "width" : "height";
3170
+ const otherAxis = state.props.horizontal ? "height" : "width";
3171
+ let layout = layoutParam;
3172
+ if (useWindowScroll) {
3173
+ const windowScrollAxisLength = getWindowSize()[scrollAxis];
3174
+ layout = windowScrollAxisLength > 0 ? { ...layoutParam, [scrollAxis]: windowScrollAxisLength } : layoutParam;
3175
+ }
3176
+ const measuredLength = layout[scrollAxis];
3163
3177
  const previousLength = state.scrollLength;
3164
3178
  const scrollLength = measuredLength > 0 ? measuredLength : previousLength;
3165
- const otherAxisSize = layout[state.props.horizontal ? "height" : "width"];
3179
+ const otherAxisSize = layout[otherAxis];
3166
3180
  const needsCalculate = !state.lastLayout || scrollLength > state.scrollLength || state.lastLayout.x !== layout.x || state.lastLayout.y !== layout.y;
3167
3181
  state.lastLayout = layout;
3168
3182
  const prevOtherAxisSize = state.otherAxisSize;
@@ -3468,13 +3482,6 @@ var useCombinedRef = (...refs) => {
3468
3482
  }, refs);
3469
3483
  return callback;
3470
3484
  };
3471
- function getWindowSize() {
3472
- const screenSize = ReactNative.Dimensions.get("window");
3473
- return {
3474
- height: screenSize.height,
3475
- width: screenSize.width
3476
- };
3477
- }
3478
3485
  var StyleSheet = ReactNative.StyleSheet;
3479
3486
  function useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, onScroll2) {
3480
3487
  const shouldUseRnAnimatedEngine = !ctx.state.props.stickyPositionComponentInternal;
package/index.native.mjs CHANGED
@@ -3133,15 +3133,29 @@ function doInitialAllocateContainers(ctx) {
3133
3133
  return true;
3134
3134
  }
3135
3135
  }
3136
+ function getWindowSize() {
3137
+ const screenSize = Dimensions.get("window");
3138
+ return {
3139
+ height: screenSize.height,
3140
+ width: screenSize.width
3141
+ };
3142
+ }
3136
3143
 
3137
3144
  // src/core/handleLayout.ts
3138
- function handleLayout(ctx, layout, setCanRender) {
3145
+ function handleLayout(ctx, layoutParam, setCanRender) {
3139
3146
  const state = ctx.state;
3140
- const { maintainScrollAtEnd } = state.props;
3141
- const measuredLength = layout[state.props.horizontal ? "width" : "height"];
3147
+ const { maintainScrollAtEnd, useWindowScroll } = state.props;
3148
+ const scrollAxis = state.props.horizontal ? "width" : "height";
3149
+ const otherAxis = state.props.horizontal ? "height" : "width";
3150
+ let layout = layoutParam;
3151
+ if (useWindowScroll) {
3152
+ const windowScrollAxisLength = getWindowSize()[scrollAxis];
3153
+ layout = windowScrollAxisLength > 0 ? { ...layoutParam, [scrollAxis]: windowScrollAxisLength } : layoutParam;
3154
+ }
3155
+ const measuredLength = layout[scrollAxis];
3142
3156
  const previousLength = state.scrollLength;
3143
3157
  const scrollLength = measuredLength > 0 ? measuredLength : previousLength;
3144
- const otherAxisSize = layout[state.props.horizontal ? "height" : "width"];
3158
+ const otherAxisSize = layout[otherAxis];
3145
3159
  const needsCalculate = !state.lastLayout || scrollLength > state.scrollLength || state.lastLayout.x !== layout.x || state.lastLayout.y !== layout.y;
3146
3160
  state.lastLayout = layout;
3147
3161
  const prevOtherAxisSize = state.otherAxisSize;
@@ -3447,13 +3461,6 @@ var useCombinedRef = (...refs) => {
3447
3461
  }, refs);
3448
3462
  return callback;
3449
3463
  };
3450
- function getWindowSize() {
3451
- const screenSize = Dimensions.get("window");
3452
- return {
3453
- height: screenSize.height,
3454
- width: screenSize.width
3455
- };
3456
- }
3457
3464
  var StyleSheet = StyleSheet$1;
3458
3465
  function useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, onScroll2) {
3459
3466
  const shouldUseRnAnimatedEngine = !ctx.state.props.stickyPositionComponentInternal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.0.0-beta.39",
3
+ "version": "3.0.0-beta.40",
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
@@ -3154,15 +3154,29 @@ function doInitialAllocateContainers(ctx) {
3154
3154
  return true;
3155
3155
  }
3156
3156
  }
3157
+ function getWindowSize() {
3158
+ const screenSize = ReactNative.Dimensions.get("window");
3159
+ return {
3160
+ height: screenSize.height,
3161
+ width: screenSize.width
3162
+ };
3163
+ }
3157
3164
 
3158
3165
  // src/core/handleLayout.ts
3159
- function handleLayout(ctx, layout, setCanRender) {
3166
+ function handleLayout(ctx, layoutParam, setCanRender) {
3160
3167
  const state = ctx.state;
3161
- const { maintainScrollAtEnd } = state.props;
3162
- const measuredLength = layout[state.props.horizontal ? "width" : "height"];
3168
+ const { maintainScrollAtEnd, useWindowScroll } = state.props;
3169
+ const scrollAxis = state.props.horizontal ? "width" : "height";
3170
+ const otherAxis = state.props.horizontal ? "height" : "width";
3171
+ let layout = layoutParam;
3172
+ if (useWindowScroll) {
3173
+ const windowScrollAxisLength = getWindowSize()[scrollAxis];
3174
+ layout = windowScrollAxisLength > 0 ? { ...layoutParam, [scrollAxis]: windowScrollAxisLength } : layoutParam;
3175
+ }
3176
+ const measuredLength = layout[scrollAxis];
3163
3177
  const previousLength = state.scrollLength;
3164
3178
  const scrollLength = measuredLength > 0 ? measuredLength : previousLength;
3165
- const otherAxisSize = layout[state.props.horizontal ? "height" : "width"];
3179
+ const otherAxisSize = layout[otherAxis];
3166
3180
  const needsCalculate = !state.lastLayout || scrollLength > state.scrollLength || state.lastLayout.x !== layout.x || state.lastLayout.y !== layout.y;
3167
3181
  state.lastLayout = layout;
3168
3182
  const prevOtherAxisSize = state.otherAxisSize;
@@ -3468,13 +3482,6 @@ var useCombinedRef = (...refs) => {
3468
3482
  }, refs);
3469
3483
  return callback;
3470
3484
  };
3471
- function getWindowSize() {
3472
- const screenSize = ReactNative.Dimensions.get("window");
3473
- return {
3474
- height: screenSize.height,
3475
- width: screenSize.width
3476
- };
3477
- }
3478
3485
  var StyleSheet = ReactNative.StyleSheet;
3479
3486
  function useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, onScroll2) {
3480
3487
  const shouldUseRnAnimatedEngine = !ctx.state.props.stickyPositionComponentInternal;
package/react-native.mjs CHANGED
@@ -3133,15 +3133,29 @@ function doInitialAllocateContainers(ctx) {
3133
3133
  return true;
3134
3134
  }
3135
3135
  }
3136
+ function getWindowSize() {
3137
+ const screenSize = Dimensions.get("window");
3138
+ return {
3139
+ height: screenSize.height,
3140
+ width: screenSize.width
3141
+ };
3142
+ }
3136
3143
 
3137
3144
  // src/core/handleLayout.ts
3138
- function handleLayout(ctx, layout, setCanRender) {
3145
+ function handleLayout(ctx, layoutParam, setCanRender) {
3139
3146
  const state = ctx.state;
3140
- const { maintainScrollAtEnd } = state.props;
3141
- const measuredLength = layout[state.props.horizontal ? "width" : "height"];
3147
+ const { maintainScrollAtEnd, useWindowScroll } = state.props;
3148
+ const scrollAxis = state.props.horizontal ? "width" : "height";
3149
+ const otherAxis = state.props.horizontal ? "height" : "width";
3150
+ let layout = layoutParam;
3151
+ if (useWindowScroll) {
3152
+ const windowScrollAxisLength = getWindowSize()[scrollAxis];
3153
+ layout = windowScrollAxisLength > 0 ? { ...layoutParam, [scrollAxis]: windowScrollAxisLength } : layoutParam;
3154
+ }
3155
+ const measuredLength = layout[scrollAxis];
3142
3156
  const previousLength = state.scrollLength;
3143
3157
  const scrollLength = measuredLength > 0 ? measuredLength : previousLength;
3144
- const otherAxisSize = layout[state.props.horizontal ? "height" : "width"];
3158
+ const otherAxisSize = layout[otherAxis];
3145
3159
  const needsCalculate = !state.lastLayout || scrollLength > state.scrollLength || state.lastLayout.x !== layout.x || state.lastLayout.y !== layout.y;
3146
3160
  state.lastLayout = layout;
3147
3161
  const prevOtherAxisSize = state.otherAxisSize;
@@ -3447,13 +3461,6 @@ var useCombinedRef = (...refs) => {
3447
3461
  }, refs);
3448
3462
  return callback;
3449
3463
  };
3450
- function getWindowSize() {
3451
- const screenSize = Dimensions.get("window");
3452
- return {
3453
- height: screenSize.height,
3454
- width: screenSize.width
3455
- };
3456
- }
3457
3464
  var StyleSheet = StyleSheet$1;
3458
3465
  function useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, onScroll2) {
3459
3466
  const shouldUseRnAnimatedEngine = !ctx.state.props.stickyPositionComponentInternal;
package/react.js CHANGED
@@ -3577,14 +3577,32 @@ function doInitialAllocateContainers(ctx) {
3577
3577
  }
3578
3578
  }
3579
3579
 
3580
+ // src/platform/getWindowSize.ts
3581
+ function getWindowSize() {
3582
+ if (typeof window === "undefined") {
3583
+ return { height: 0, width: 0 };
3584
+ }
3585
+ return {
3586
+ height: window.innerHeight,
3587
+ width: window.innerWidth
3588
+ };
3589
+ }
3590
+
3580
3591
  // src/core/handleLayout.ts
3581
- function handleLayout(ctx, layout, setCanRender) {
3592
+ function handleLayout(ctx, layoutParam, setCanRender) {
3582
3593
  const state = ctx.state;
3583
- const { maintainScrollAtEnd } = state.props;
3584
- const measuredLength = layout[state.props.horizontal ? "width" : "height"];
3594
+ const { maintainScrollAtEnd, useWindowScroll } = state.props;
3595
+ const scrollAxis = state.props.horizontal ? "width" : "height";
3596
+ const otherAxis = state.props.horizontal ? "height" : "width";
3597
+ let layout = layoutParam;
3598
+ if (useWindowScroll) {
3599
+ const windowScrollAxisLength = getWindowSize()[scrollAxis];
3600
+ layout = windowScrollAxisLength > 0 ? { ...layoutParam, [scrollAxis]: windowScrollAxisLength } : layoutParam;
3601
+ }
3602
+ const measuredLength = layout[scrollAxis];
3585
3603
  const previousLength = state.scrollLength;
3586
3604
  const scrollLength = measuredLength > 0 ? measuredLength : previousLength;
3587
- const otherAxisSize = layout[state.props.horizontal ? "height" : "width"];
3605
+ const otherAxisSize = layout[otherAxis];
3588
3606
  const needsCalculate = !state.lastLayout || scrollLength > state.scrollLength || state.lastLayout.x !== layout.x || state.lastLayout.y !== layout.y;
3589
3607
  state.lastLayout = layout;
3590
3608
  const prevOtherAxisSize = state.otherAxisSize;
package/react.mjs CHANGED
@@ -3556,14 +3556,32 @@ function doInitialAllocateContainers(ctx) {
3556
3556
  }
3557
3557
  }
3558
3558
 
3559
+ // src/platform/getWindowSize.ts
3560
+ function getWindowSize() {
3561
+ if (typeof window === "undefined") {
3562
+ return { height: 0, width: 0 };
3563
+ }
3564
+ return {
3565
+ height: window.innerHeight,
3566
+ width: window.innerWidth
3567
+ };
3568
+ }
3569
+
3559
3570
  // src/core/handleLayout.ts
3560
- function handleLayout(ctx, layout, setCanRender) {
3571
+ function handleLayout(ctx, layoutParam, setCanRender) {
3561
3572
  const state = ctx.state;
3562
- const { maintainScrollAtEnd } = state.props;
3563
- const measuredLength = layout[state.props.horizontal ? "width" : "height"];
3573
+ const { maintainScrollAtEnd, useWindowScroll } = state.props;
3574
+ const scrollAxis = state.props.horizontal ? "width" : "height";
3575
+ const otherAxis = state.props.horizontal ? "height" : "width";
3576
+ let layout = layoutParam;
3577
+ if (useWindowScroll) {
3578
+ const windowScrollAxisLength = getWindowSize()[scrollAxis];
3579
+ layout = windowScrollAxisLength > 0 ? { ...layoutParam, [scrollAxis]: windowScrollAxisLength } : layoutParam;
3580
+ }
3581
+ const measuredLength = layout[scrollAxis];
3564
3582
  const previousLength = state.scrollLength;
3565
3583
  const scrollLength = measuredLength > 0 ? measuredLength : previousLength;
3566
- const otherAxisSize = layout[state.props.horizontal ? "height" : "width"];
3584
+ const otherAxisSize = layout[otherAxis];
3567
3585
  const needsCalculate = !state.lastLayout || scrollLength > state.scrollLength || state.lastLayout.x !== layout.x || state.lastLayout.y !== layout.y;
3568
3586
  state.lastLayout = layout;
3569
3587
  const prevOtherAxisSize = state.otherAxisSize;