@legendapp/list 0.5.6 → 0.5.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/index.d.mts CHANGED
@@ -155,7 +155,7 @@ interface ViewabilityConfig {
155
155
  /**
156
156
  * A unique ID to identify this viewability config
157
157
  */
158
- id: string;
158
+ id?: string;
159
159
  /**
160
160
  * Minimum amount of time (in milliseconds) that an item must be physically viewable before the
161
161
  * viewability callback will be fired. A high number means that scrolling through content without
package/index.d.ts CHANGED
@@ -155,7 +155,7 @@ interface ViewabilityConfig {
155
155
  /**
156
156
  * A unique ID to identify this viewability config
157
157
  */
158
- id: string;
158
+ id?: string;
159
159
  /**
160
160
  * Minimum amount of time (in milliseconds) that an item must be physically viewable before the
161
161
  * viewability callback will be fired. A high number means that scrolling through content without
package/index.js CHANGED
@@ -161,6 +161,8 @@ var Container = ({
161
161
  if (key !== void 0) {
162
162
  const size = event.nativeEvent.layout[horizontal ? "width" : "height"];
163
163
  onLayout(key, size);
164
+ const otherAxisSize = horizontal ? event.nativeEvent.layout.width : event.nativeEvent.layout.height;
165
+ set$(ctx, "otherAxisSize", Math.max(otherAxisSize, peek$(ctx, "otherAxisSize") || 0));
164
166
  const measured = peek$(ctx, `containerDidLayout${id}`);
165
167
  if (!measured) {
166
168
  requestAnimationFrame(() => {
@@ -260,6 +262,7 @@ var ListComponent = React7__namespace.memo(function ListComponent2({
260
262
  ...rest
261
263
  }) {
262
264
  const ctx = useStateContext();
265
+ use$("otherAxisSize") || 0;
263
266
  return /* @__PURE__ */ React7__namespace.createElement(
264
267
  $ScrollView,
265
268
  {
@@ -496,7 +499,6 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
496
499
  maintainVisibleContentPosition = false,
497
500
  onScroll: onScrollProp,
498
501
  numColumns: numColumnsProp = 1,
499
- style: styleProp,
500
502
  keyExtractor,
501
503
  renderItem,
502
504
  estimatedItemSize,
@@ -506,7 +508,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
506
508
  ListEmptyComponent,
507
509
  ...rest
508
510
  } = props;
509
- const { contentContainerStyle } = props;
511
+ const { style, contentContainerStyle } = props;
510
512
  const ctx = useStateContext();
511
513
  const internalRef = React7.useRef(null);
512
514
  const refScroller = internalRef;
@@ -808,18 +810,6 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
808
810
  );
809
811
  }
810
812
  }, []);
811
- const style = React7.useMemo(() => {
812
- const extraStyle = {};
813
- if (data.length > 0) {
814
- const size = getItemSize(getId(0), 0, data[0]);
815
- if (horizontal) {
816
- extraStyle.minHeight = size;
817
- } else {
818
- extraStyle.minWidth = size;
819
- }
820
- }
821
- return reactNative.StyleSheet.compose(styleProp, extraStyle);
822
- }, []);
823
813
  const doUpdatePaddingTop = () => {
824
814
  if (alignItemsAtEnd) {
825
815
  const { scrollLength, totalSize } = refState.current;
package/index.mjs CHANGED
@@ -140,6 +140,8 @@ var Container = ({
140
140
  if (key !== void 0) {
141
141
  const size = event.nativeEvent.layout[horizontal ? "width" : "height"];
142
142
  onLayout(key, size);
143
+ const otherAxisSize = horizontal ? event.nativeEvent.layout.width : event.nativeEvent.layout.height;
144
+ set$(ctx, "otherAxisSize", Math.max(otherAxisSize, peek$(ctx, "otherAxisSize") || 0));
143
145
  const measured = peek$(ctx, `containerDidLayout${id}`);
144
146
  if (!measured) {
145
147
  requestAnimationFrame(() => {
@@ -239,6 +241,7 @@ var ListComponent = React7.memo(function ListComponent2({
239
241
  ...rest
240
242
  }) {
241
243
  const ctx = useStateContext();
244
+ use$("otherAxisSize") || 0;
242
245
  return /* @__PURE__ */ React7.createElement(
243
246
  $ScrollView,
244
247
  {
@@ -475,7 +478,6 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
475
478
  maintainVisibleContentPosition = false,
476
479
  onScroll: onScrollProp,
477
480
  numColumns: numColumnsProp = 1,
478
- style: styleProp,
479
481
  keyExtractor,
480
482
  renderItem,
481
483
  estimatedItemSize,
@@ -485,7 +487,7 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
485
487
  ListEmptyComponent,
486
488
  ...rest
487
489
  } = props;
488
- const { contentContainerStyle } = props;
490
+ const { style, contentContainerStyle } = props;
489
491
  const ctx = useStateContext();
490
492
  const internalRef = useRef(null);
491
493
  const refScroller = internalRef;
@@ -787,18 +789,6 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
787
789
  );
788
790
  }
789
791
  }, []);
790
- const style = useMemo(() => {
791
- const extraStyle = {};
792
- if (data.length > 0) {
793
- const size = getItemSize(getId(0), 0, data[0]);
794
- if (horizontal) {
795
- extraStyle.minHeight = size;
796
- } else {
797
- extraStyle.minWidth = size;
798
- }
799
- }
800
- return StyleSheet.compose(styleProp, extraStyle);
801
- }, []);
802
792
  const doUpdatePaddingTop = () => {
803
793
  if (alignItemsAtEnd) {
804
794
  const { scrollLength, totalSize } = refState.current;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "legend-list",
5
5
  "sideEffects": false,
6
6
  "private": false,