@legendapp/list 1.0.0-beta.21 → 1.0.0-beta.22
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/animated.d.mts +1 -1
- package/animated.d.ts +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/index.js +17 -1
- package/index.mjs +17 -1
- package/package.json +1 -1
package/animated.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _legendapp_list from '@legendapp/list';
|
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { Animated } from 'react-native';
|
|
5
5
|
|
|
6
|
-
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "
|
|
6
|
+
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "maintainVisibleContentPosition" | "stickyHeaderIndices" | "contentInset" | "contentOffset"> & {
|
|
7
7
|
data: readonly T[];
|
|
8
8
|
initialScrollOffset?: number;
|
|
9
9
|
initialScrollIndex?: number;
|
package/animated.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _legendapp_list from '@legendapp/list';
|
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { Animated } from 'react-native';
|
|
5
5
|
|
|
6
|
-
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "
|
|
6
|
+
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "maintainVisibleContentPosition" | "stickyHeaderIndices" | "contentInset" | "contentOffset"> & {
|
|
7
7
|
data: readonly T[];
|
|
8
8
|
initialScrollOffset?: number;
|
|
9
9
|
initialScrollIndex?: number;
|
package/index.d.mts
CHANGED
|
@@ -253,7 +253,7 @@ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqua
|
|
|
253
253
|
};
|
|
254
254
|
declare const typedMemo: TypedMemo;
|
|
255
255
|
|
|
256
|
-
declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "
|
|
256
|
+
declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "maintainVisibleContentPosition" | "stickyHeaderIndices" | "contentInset" | "contentOffset"> & {
|
|
257
257
|
data: readonly T[];
|
|
258
258
|
initialScrollOffset?: number;
|
|
259
259
|
initialScrollIndex?: number;
|
package/index.d.ts
CHANGED
|
@@ -253,7 +253,7 @@ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqua
|
|
|
253
253
|
};
|
|
254
254
|
declare const typedMemo: TypedMemo;
|
|
255
255
|
|
|
256
|
-
declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "
|
|
256
|
+
declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "maintainVisibleContentPosition" | "stickyHeaderIndices" | "contentInset" | "contentOffset"> & {
|
|
257
257
|
data: readonly T[];
|
|
258
258
|
initialScrollOffset?: number;
|
|
259
259
|
initialScrollIndex?: number;
|
package/index.js
CHANGED
|
@@ -239,6 +239,7 @@ var Container = ({
|
|
|
239
239
|
const itemKey = use$(`containerItemKey${id}`);
|
|
240
240
|
const data = use$(`containerItemData${id}`);
|
|
241
241
|
const extraData = use$("extraData");
|
|
242
|
+
const refLastSize = React6.useRef();
|
|
242
243
|
const otherAxisPos = numColumns > 1 ? `${(column - 1) / numColumns * 100}%` : 0;
|
|
243
244
|
const otherAxisSize = numColumns > 1 ? `${1 / numColumns * 100}%` : void 0;
|
|
244
245
|
let verticalPaddingStyles;
|
|
@@ -271,6 +272,18 @@ var Container = ({
|
|
|
271
272
|
[itemKey, data, extraData]
|
|
272
273
|
);
|
|
273
274
|
const { index, renderedItem } = renderedItemInfo || {};
|
|
275
|
+
React6.useEffect(() => {
|
|
276
|
+
if (itemKey) {
|
|
277
|
+
const timeout = setTimeout(() => {
|
|
278
|
+
if (refLastSize.current) {
|
|
279
|
+
updateItemSize(id, itemKey, refLastSize.current);
|
|
280
|
+
}
|
|
281
|
+
}, 16);
|
|
282
|
+
return () => {
|
|
283
|
+
clearTimeout(timeout);
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}, [itemKey]);
|
|
274
287
|
const onLayout = (event) => {
|
|
275
288
|
if (itemKey !== void 0) {
|
|
276
289
|
const layout = event.nativeEvent.layout;
|
|
@@ -286,6 +299,7 @@ var Container = ({
|
|
|
286
299
|
}
|
|
287
300
|
return;
|
|
288
301
|
}
|
|
302
|
+
refLastSize.current = size;
|
|
289
303
|
updateItemSize(id, itemKey, size);
|
|
290
304
|
}
|
|
291
305
|
};
|
|
@@ -687,11 +701,13 @@ function updateViewableItemsWithConfig(data, viewabilityConfigCallbackPair, getI
|
|
|
687
701
|
}
|
|
688
702
|
}
|
|
689
703
|
function isViewable(state, ctx, viewabilityConfig, key, scrollSize, item, index) {
|
|
690
|
-
const { sizes, positions, scroll } = state;
|
|
704
|
+
const { sizes, positions, scroll: scrollState, scrollAdjustHandler } = state;
|
|
691
705
|
const topPad = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
|
|
692
706
|
const { itemVisiblePercentThreshold, viewAreaCoveragePercentThreshold } = viewabilityConfig;
|
|
693
707
|
const viewAreaMode = viewAreaCoveragePercentThreshold != null;
|
|
694
708
|
const viewablePercentThreshold = viewAreaMode ? viewAreaCoveragePercentThreshold : itemVisiblePercentThreshold;
|
|
709
|
+
const previousScrollAdjust = scrollAdjustHandler.getAppliedAdjust();
|
|
710
|
+
const scroll = scrollState - previousScrollAdjust - topPad;
|
|
695
711
|
const top = positions.get(key) - scroll + topPad;
|
|
696
712
|
const size = sizes.get(key) || 0;
|
|
697
713
|
const bottom = top + size;
|
package/index.mjs
CHANGED
|
@@ -218,6 +218,7 @@ var Container = ({
|
|
|
218
218
|
const itemKey = use$(`containerItemKey${id}`);
|
|
219
219
|
const data = use$(`containerItemData${id}`);
|
|
220
220
|
const extraData = use$("extraData");
|
|
221
|
+
const refLastSize = useRef();
|
|
221
222
|
const otherAxisPos = numColumns > 1 ? `${(column - 1) / numColumns * 100}%` : 0;
|
|
222
223
|
const otherAxisSize = numColumns > 1 ? `${1 / numColumns * 100}%` : void 0;
|
|
223
224
|
let verticalPaddingStyles;
|
|
@@ -250,6 +251,18 @@ var Container = ({
|
|
|
250
251
|
[itemKey, data, extraData]
|
|
251
252
|
);
|
|
252
253
|
const { index, renderedItem } = renderedItemInfo || {};
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
if (itemKey) {
|
|
256
|
+
const timeout = setTimeout(() => {
|
|
257
|
+
if (refLastSize.current) {
|
|
258
|
+
updateItemSize(id, itemKey, refLastSize.current);
|
|
259
|
+
}
|
|
260
|
+
}, 16);
|
|
261
|
+
return () => {
|
|
262
|
+
clearTimeout(timeout);
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}, [itemKey]);
|
|
253
266
|
const onLayout = (event) => {
|
|
254
267
|
if (itemKey !== void 0) {
|
|
255
268
|
const layout = event.nativeEvent.layout;
|
|
@@ -265,6 +278,7 @@ var Container = ({
|
|
|
265
278
|
}
|
|
266
279
|
return;
|
|
267
280
|
}
|
|
281
|
+
refLastSize.current = size;
|
|
268
282
|
updateItemSize(id, itemKey, size);
|
|
269
283
|
}
|
|
270
284
|
};
|
|
@@ -666,11 +680,13 @@ function updateViewableItemsWithConfig(data, viewabilityConfigCallbackPair, getI
|
|
|
666
680
|
}
|
|
667
681
|
}
|
|
668
682
|
function isViewable(state, ctx, viewabilityConfig, key, scrollSize, item, index) {
|
|
669
|
-
const { sizes, positions, scroll } = state;
|
|
683
|
+
const { sizes, positions, scroll: scrollState, scrollAdjustHandler } = state;
|
|
670
684
|
const topPad = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
|
|
671
685
|
const { itemVisiblePercentThreshold, viewAreaCoveragePercentThreshold } = viewabilityConfig;
|
|
672
686
|
const viewAreaMode = viewAreaCoveragePercentThreshold != null;
|
|
673
687
|
const viewablePercentThreshold = viewAreaMode ? viewAreaCoveragePercentThreshold : itemVisiblePercentThreshold;
|
|
688
|
+
const previousScrollAdjust = scrollAdjustHandler.getAppliedAdjust();
|
|
689
|
+
const scroll = scrollState - previousScrollAdjust - topPad;
|
|
674
690
|
const top = positions.get(key) - scroll + topPad;
|
|
675
691
|
const size = sizes.get(key) || 0;
|
|
676
692
|
const bottom = top + size;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/list",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.22",
|
|
4
4
|
"description": "Legend List aims to be a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|