@legendapp/list 1.0.0-beta.1 → 1.0.0-beta.2
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 +1 -0
- package/index.d.ts +1 -0
- package/index.js +9 -3
- package/index.mjs +9 -3
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -61,6 +61,7 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
61
61
|
* @default (props) => <ScrollView {...props} />
|
|
62
62
|
*/
|
|
63
63
|
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
64
|
+
extraData?: any;
|
|
64
65
|
};
|
|
65
66
|
type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
|
|
66
67
|
interface InternalState {
|
package/index.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
61
61
|
* @default (props) => <ScrollView {...props} />
|
|
62
62
|
*/
|
|
63
63
|
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
64
|
+
extraData?: any;
|
|
64
65
|
};
|
|
65
66
|
type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
|
|
66
67
|
interface InternalState {
|
package/index.js
CHANGED
|
@@ -115,7 +115,8 @@ var Container = ({
|
|
|
115
115
|
const lastItemKey = use$("lastItemKey");
|
|
116
116
|
const itemKey = use$(`containerItemKey${id}`);
|
|
117
117
|
const data = use$(`containerItemData${id}`);
|
|
118
|
-
const
|
|
118
|
+
const extraData = use$("extraData");
|
|
119
|
+
const renderedItem = React4.useMemo(() => itemKey !== void 0 && getRenderedItem(itemKey, id), [itemKey, data, extraData]);
|
|
119
120
|
return /* @__PURE__ */ React4__namespace.default.createElement(
|
|
120
121
|
reactNative.View,
|
|
121
122
|
{
|
|
@@ -494,6 +495,7 @@ var LegendListInner = React4.forwardRef(function LegendListInner2(props, forward
|
|
|
494
495
|
onItemSizeChanged,
|
|
495
496
|
scrollEventThrottle,
|
|
496
497
|
refScrollView,
|
|
498
|
+
extraData,
|
|
497
499
|
...rest
|
|
498
500
|
} = props;
|
|
499
501
|
const { style, contentContainerStyle } = props;
|
|
@@ -597,6 +599,7 @@ var LegendListInner = React4.forwardRef(function LegendListInner2(props, forward
|
|
|
597
599
|
}
|
|
598
600
|
}
|
|
599
601
|
set$(ctx, "scrollAdjust", 0);
|
|
602
|
+
set$(ctx, "extraData", extraData);
|
|
600
603
|
}
|
|
601
604
|
const getAnchorElementIndex = () => {
|
|
602
605
|
const state = refState.current;
|
|
@@ -818,9 +821,9 @@ var LegendListInner = React4.forwardRef(function LegendListInner2(props, forward
|
|
|
818
821
|
endBuffered,
|
|
819
822
|
endNoBuffer
|
|
820
823
|
});
|
|
821
|
-
const nextTop = Math.ceil(startBuffered ? positions.get(startBufferedId) + scrollBuffer : 0);
|
|
824
|
+
const nextTop = Math.ceil(startBuffered !== null ? positions.get(startBufferedId) + scrollBuffer : 0);
|
|
822
825
|
const nextBottom = Math.floor(
|
|
823
|
-
endBuffered ? (positions.get(getId(endBuffered + 1)) || 0) - scrollLength - scrollBuffer : 0
|
|
826
|
+
endBuffered !== null ? (positions.get(getId(endBuffered + 1)) || 0) - scrollLength - scrollBuffer : 0
|
|
824
827
|
);
|
|
825
828
|
if (state.enableScrollForNextCalculateItemsInView) {
|
|
826
829
|
state.scrollForNextCalculateItemsInView = nextTop >= 0 && nextBottom >= 0 ? {
|
|
@@ -1079,6 +1082,9 @@ var LegendListInner = React4.forwardRef(function LegendListInner2(props, forward
|
|
|
1079
1082
|
!isFirst
|
|
1080
1083
|
);
|
|
1081
1084
|
}, [isFirst, data, numColumnsProp]);
|
|
1085
|
+
React4.useEffect(() => {
|
|
1086
|
+
set$(ctx, "extraData", extraData);
|
|
1087
|
+
}, [extraData]);
|
|
1082
1088
|
refState.current.renderItem = renderItem;
|
|
1083
1089
|
const lastItemKey = getId(data[data.length - 1]);
|
|
1084
1090
|
const stylePaddingTop = (_d = (_c = (_a = reactNative.StyleSheet.flatten(style)) == null ? void 0 : _a.paddingTop) != null ? _c : (_b = reactNative.StyleSheet.flatten(contentContainerStyle)) == null ? void 0 : _b.paddingTop) != null ? _d : 0;
|
package/index.mjs
CHANGED
|
@@ -94,7 +94,8 @@ var Container = ({
|
|
|
94
94
|
const lastItemKey = use$("lastItemKey");
|
|
95
95
|
const itemKey = use$(`containerItemKey${id}`);
|
|
96
96
|
const data = use$(`containerItemData${id}`);
|
|
97
|
-
const
|
|
97
|
+
const extraData = use$("extraData");
|
|
98
|
+
const renderedItem = useMemo(() => itemKey !== void 0 && getRenderedItem(itemKey, id), [itemKey, data, extraData]);
|
|
98
99
|
return /* @__PURE__ */ React4__default.createElement(
|
|
99
100
|
View,
|
|
100
101
|
{
|
|
@@ -473,6 +474,7 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
473
474
|
onItemSizeChanged,
|
|
474
475
|
scrollEventThrottle,
|
|
475
476
|
refScrollView,
|
|
477
|
+
extraData,
|
|
476
478
|
...rest
|
|
477
479
|
} = props;
|
|
478
480
|
const { style, contentContainerStyle } = props;
|
|
@@ -576,6 +578,7 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
576
578
|
}
|
|
577
579
|
}
|
|
578
580
|
set$(ctx, "scrollAdjust", 0);
|
|
581
|
+
set$(ctx, "extraData", extraData);
|
|
579
582
|
}
|
|
580
583
|
const getAnchorElementIndex = () => {
|
|
581
584
|
const state = refState.current;
|
|
@@ -797,9 +800,9 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
797
800
|
endBuffered,
|
|
798
801
|
endNoBuffer
|
|
799
802
|
});
|
|
800
|
-
const nextTop = Math.ceil(startBuffered ? positions.get(startBufferedId) + scrollBuffer : 0);
|
|
803
|
+
const nextTop = Math.ceil(startBuffered !== null ? positions.get(startBufferedId) + scrollBuffer : 0);
|
|
801
804
|
const nextBottom = Math.floor(
|
|
802
|
-
endBuffered ? (positions.get(getId(endBuffered + 1)) || 0) - scrollLength - scrollBuffer : 0
|
|
805
|
+
endBuffered !== null ? (positions.get(getId(endBuffered + 1)) || 0) - scrollLength - scrollBuffer : 0
|
|
803
806
|
);
|
|
804
807
|
if (state.enableScrollForNextCalculateItemsInView) {
|
|
805
808
|
state.scrollForNextCalculateItemsInView = nextTop >= 0 && nextBottom >= 0 ? {
|
|
@@ -1058,6 +1061,9 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
1058
1061
|
!isFirst
|
|
1059
1062
|
);
|
|
1060
1063
|
}, [isFirst, data, numColumnsProp]);
|
|
1064
|
+
useEffect(() => {
|
|
1065
|
+
set$(ctx, "extraData", extraData);
|
|
1066
|
+
}, [extraData]);
|
|
1061
1067
|
refState.current.renderItem = renderItem;
|
|
1062
1068
|
const lastItemKey = getId(data[data.length - 1]);
|
|
1063
1069
|
const stylePaddingTop = (_d = (_c = (_a = StyleSheet.flatten(style)) == null ? void 0 : _a.paddingTop) != null ? _c : (_b = StyleSheet.flatten(contentContainerStyle)) == null ? void 0 : _b.paddingTop) != null ? _d : 0;
|