@legendapp/list 2.0.0-next.17 → 2.0.0-next.18

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 +15 -15
  2. package/index.mjs +15 -15
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -2453,7 +2453,7 @@ function getRenderedItem(ctx, state, key) {
2453
2453
  return null;
2454
2454
  }
2455
2455
  let renderedItem = null;
2456
- if (renderItem2) {
2456
+ if (renderItem2 && data[index]) {
2457
2457
  const itemProps = {
2458
2458
  extraData: peek$(ctx, "extraData"),
2459
2459
  index,
@@ -2750,20 +2750,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2750
2750
  refState.current.positions.clear();
2751
2751
  }
2752
2752
  }
2753
- React3.useLayoutEffect(() => {
2754
- if (IsNewArchitecture) {
2755
- let measured;
2756
- refScroller.current.measure((x, y, width, height) => {
2757
- measured = { height, width, x, y };
2758
- });
2759
- if (measured) {
2760
- const size = Math.floor(measured[horizontal ? "width" : "height"] * 8) / 8;
2761
- if (size) {
2762
- handleLayout(ctx, state, measured, setCanRender);
2763
- }
2764
- }
2765
- }
2766
- }, [dataProp]);
2767
2753
  const onLayoutHeader = React3.useCallback((rect, fromLayoutEffect) => {
2768
2754
  const size = rect[horizontal ? "width" : "height"];
2769
2755
  set$(ctx, "headerSize", size);
@@ -2796,6 +2782,20 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2796
2782
  React3.useLayoutEffect(() => {
2797
2783
  set$(ctx, "extraData", extraData);
2798
2784
  }, [extraData]);
2785
+ React3.useLayoutEffect(() => {
2786
+ if (IsNewArchitecture) {
2787
+ let measured;
2788
+ refScroller.current.measure((x, y, width, height) => {
2789
+ measured = { height, width, x, y };
2790
+ });
2791
+ if (measured) {
2792
+ const size = Math.floor(measured[horizontal ? "width" : "height"] * 8) / 8;
2793
+ if (size) {
2794
+ handleLayout(ctx, state, measured, setCanRender);
2795
+ }
2796
+ }
2797
+ }
2798
+ }, []);
2799
2799
  React3.useLayoutEffect(initializeStateVars, [
2800
2800
  memoizedLastItemKeys.join(","),
2801
2801
  numColumnsProp,
package/index.mjs CHANGED
@@ -2432,7 +2432,7 @@ function getRenderedItem(ctx, state, key) {
2432
2432
  return null;
2433
2433
  }
2434
2434
  let renderedItem = null;
2435
- if (renderItem2) {
2435
+ if (renderItem2 && data[index]) {
2436
2436
  const itemProps = {
2437
2437
  extraData: peek$(ctx, "extraData"),
2438
2438
  index,
@@ -2729,20 +2729,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2729
2729
  refState.current.positions.clear();
2730
2730
  }
2731
2731
  }
2732
- useLayoutEffect(() => {
2733
- if (IsNewArchitecture) {
2734
- let measured;
2735
- refScroller.current.measure((x, y, width, height) => {
2736
- measured = { height, width, x, y };
2737
- });
2738
- if (measured) {
2739
- const size = Math.floor(measured[horizontal ? "width" : "height"] * 8) / 8;
2740
- if (size) {
2741
- handleLayout(ctx, state, measured, setCanRender);
2742
- }
2743
- }
2744
- }
2745
- }, [dataProp]);
2746
2732
  const onLayoutHeader = useCallback((rect, fromLayoutEffect) => {
2747
2733
  const size = rect[horizontal ? "width" : "height"];
2748
2734
  set$(ctx, "headerSize", size);
@@ -2775,6 +2761,20 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2775
2761
  useLayoutEffect(() => {
2776
2762
  set$(ctx, "extraData", extraData);
2777
2763
  }, [extraData]);
2764
+ useLayoutEffect(() => {
2765
+ if (IsNewArchitecture) {
2766
+ let measured;
2767
+ refScroller.current.measure((x, y, width, height) => {
2768
+ measured = { height, width, x, y };
2769
+ });
2770
+ if (measured) {
2771
+ const size = Math.floor(measured[horizontal ? "width" : "height"] * 8) / 8;
2772
+ if (size) {
2773
+ handleLayout(ctx, state, measured, setCanRender);
2774
+ }
2775
+ }
2776
+ }
2777
+ }, []);
2778
2778
  useLayoutEffect(initializeStateVars, [
2779
2779
  memoizedLastItemKeys.join(","),
2780
2780
  numColumnsProp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "2.0.0-next.17",
3
+ "version": "2.0.0-next.18",
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,