@legendapp/list 2.0.0-next.2 → 2.0.0-next.21
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/{dist/animated.d.mts → animated.d.mts} +10 -3
- package/{dist/animated.d.ts → animated.d.ts} +10 -3
- package/{dist/animated.js → animated.js} +2 -2
- package/{dist/animated.mjs → animated.mjs} +2 -2
- package/{dist/index.d.mts → index.d.mts} +86 -167
- package/{dist/index.d.ts → index.d.ts} +86 -167
- package/{dist/index.js → index.js} +1594 -1098
- package/{dist/index.mjs → index.mjs} +1596 -1100
- package/keyboard-controller.d.mts +148 -0
- package/keyboard-controller.d.ts +148 -0
- package/{dist/keyboard-controller.js → keyboard-controller.js} +4 -4
- package/{dist/keyboard-controller.mjs → keyboard-controller.mjs} +4 -4
- package/package.json +34 -88
- package/{dist/reanimated.d.mts → reanimated.d.mts} +2 -2
- package/{dist/reanimated.d.ts → reanimated.d.ts} +2 -2
- package/reanimated.js +60 -0
- package/reanimated.mjs +53 -0
- package/.claude/settings.local.json +0 -8
- package/.cursor/rules/changelog.mdc +0 -60
- package/.github/FUNDING.yml +0 -15
- package/.gitignore +0 -5
- package/.prettierrc.json +0 -5
- package/.vscode/settings.json +0 -14
- package/CLAUDE.md +0 -126
- package/biome.json +0 -46
- package/bun.lock +0 -1289
- package/bunfig.toml +0 -2
- package/dist/CHANGELOG.md +0 -119
- package/dist/LICENSE +0 -21
- package/dist/README.md +0 -139
- package/dist/keyboard-controller.d.mts +0 -261
- package/dist/keyboard-controller.d.ts +0 -261
- package/dist/package.json +0 -35
- package/dist/reanimated.js +0 -58
- package/dist/reanimated.mjs +0 -51
- package/example/README.md +0 -40
- package/example/api/data/genres.json +0 -23
- package/example/api/data/playlist/10402-10749.json +0 -1
- package/example/api/data/playlist/10402-10770.json +0 -1
- package/example/api/data/playlist/10402-37.json +0 -1
- package/example/api/data/playlist/10749-10752.json +0 -1
- package/example/api/data/playlist/10749-10770.json +0 -1
- package/example/api/data/playlist/10749-37.json +0 -1
- package/example/api/data/playlist/10749-878.json +0 -1
- package/example/api/data/playlist/10751-10402.json +0 -1
- package/example/api/data/playlist/10751-10752.json +0 -1
- package/example/api/data/playlist/10751-37.json +0 -1
- package/example/api/data/playlist/10751-53.json +0 -1
- package/example/api/data/playlist/10751-878.json +0 -1
- package/example/api/data/playlist/10751-9648.json +0 -1
- package/example/api/data/playlist/10752-37.json +0 -1
- package/example/api/data/playlist/12-10402.json +0 -1
- package/example/api/data/playlist/12-10749.json +0 -1
- package/example/api/data/playlist/12-18.json +0 -1
- package/example/api/data/playlist/12-27.json +0 -1
- package/example/api/data/playlist/12-35.json +0 -1
- package/example/api/data/playlist/14-36.json +0 -1
- package/example/api/data/playlist/14-878.json +0 -1
- package/example/api/data/playlist/16-10751.json +0 -1
- package/example/api/data/playlist/16-10770.json +0 -1
- package/example/api/data/playlist/16-35.json +0 -1
- package/example/api/data/playlist/16-36.json +0 -1
- package/example/api/data/playlist/16-53.json +0 -1
- package/example/api/data/playlist/18-10751.json +0 -1
- package/example/api/data/playlist/18-10752.json +0 -1
- package/example/api/data/playlist/18-37.json +0 -1
- package/example/api/data/playlist/18-53.json +0 -1
- package/example/api/data/playlist/18-878.json +0 -1
- package/example/api/data/playlist/27-10749.json +0 -1
- package/example/api/data/playlist/27-10770.json +0 -1
- package/example/api/data/playlist/28-10749.json +0 -1
- package/example/api/data/playlist/28-10751.json +0 -1
- package/example/api/data/playlist/28-10770.json +0 -1
- package/example/api/data/playlist/28-16.json +0 -1
- package/example/api/data/playlist/28-18.json +0 -1
- package/example/api/data/playlist/28-36.json +0 -1
- package/example/api/data/playlist/28-37.json +0 -1
- package/example/api/data/playlist/28-53.json +0 -1
- package/example/api/data/playlist/28-80.json +0 -1
- package/example/api/data/playlist/28-99.json +0 -1
- package/example/api/data/playlist/35-10749.json +0 -1
- package/example/api/data/playlist/35-10751.json +0 -1
- package/example/api/data/playlist/35-10752.json +0 -1
- package/example/api/data/playlist/35-27.json +0 -1
- package/example/api/data/playlist/35-36.json +0 -1
- package/example/api/data/playlist/35-53.json +0 -1
- package/example/api/data/playlist/35-80.json +0 -1
- package/example/api/data/playlist/36-37.json +0 -1
- package/example/api/data/playlist/36-878.json +0 -1
- package/example/api/data/playlist/36-9648.json +0 -1
- package/example/api/data/playlist/53-10752.json +0 -1
- package/example/api/data/playlist/80-10770.json +0 -1
- package/example/api/data/playlist/80-14.json +0 -1
- package/example/api/data/playlist/80-18.json +0 -1
- package/example/api/data/playlist/80-37.json +0 -1
- package/example/api/data/playlist/878-37.json +0 -1
- package/example/api/data/playlist/9648-10770.json +0 -1
- package/example/api/data/playlist/9648-37.json +0 -1
- package/example/api/data/playlist/9648-53.json +0 -1
- package/example/api/data/playlist/9648-878.json +0 -1
- package/example/api/data/playlist/99-10749.json +0 -1
- package/example/api/data/playlist/99-14.json +0 -1
- package/example/api/data/playlist/99-18.json +0 -1
- package/example/api/data/playlist/99-27.json +0 -1
- package/example/api/data/playlist/99-53.json +0 -1
- package/example/api/data/playlist/99-9648.json +0 -1
- package/example/api/data/playlist/index.ts +0 -73
- package/example/api/data/rows.json +0 -1
- package/example/api/index.ts +0 -36
- package/example/app/(tabs)/_layout.tsx +0 -60
- package/example/app/(tabs)/cards.tsx +0 -81
- package/example/app/(tabs)/index.tsx +0 -205
- package/example/app/(tabs)/moviesL.tsx +0 -7
- package/example/app/(tabs)/moviesLR.tsx +0 -7
- package/example/app/+not-found.tsx +0 -32
- package/example/app/_layout.tsx +0 -34
- package/example/app/accurate-scrollto/index.tsx +0 -125
- package/example/app/accurate-scrollto-2/index.tsx +0 -52
- package/example/app/accurate-scrollto-huge/index.tsx +0 -128
- package/example/app/add-to-end/index.tsx +0 -82
- package/example/app/ai-chat/index.tsx +0 -236
- package/example/app/bidirectional-infinite-list/index.tsx +0 -133
- package/example/app/cards-columns/index.tsx +0 -37
- package/example/app/cards-flashlist/index.tsx +0 -122
- package/example/app/cards-flatlist/index.tsx +0 -94
- package/example/app/cards-no-recycle/index.tsx +0 -110
- package/example/app/cards-renderItem.tsx +0 -354
- package/example/app/chat-example/index.tsx +0 -167
- package/example/app/chat-infinite/index.tsx +0 -239
- package/example/app/chat-keyboard/index.tsx +0 -248
- package/example/app/chat-resize-outer/index.tsx +0 -247
- package/example/app/columns/index.tsx +0 -78
- package/example/app/countries/index.tsx +0 -182
- package/example/app/countries-flashlist/index.tsx +0 -163
- package/example/app/countries-reorder/index.tsx +0 -187
- package/example/app/extra-data/index.tsx +0 -86
- package/example/app/filter-elements/filter-data-provider.tsx +0 -55
- package/example/app/filter-elements/index.tsx +0 -118
- package/example/app/initial-scroll-index/index.tsx +0 -106
- package/example/app/initial-scroll-index/renderFixedItem.tsx +0 -215
- package/example/app/initial-scroll-index-free-height/index.tsx +0 -70
- package/example/app/initial-scroll-index-keyed/index.tsx +0 -62
- package/example/app/lazy-list/index.tsx +0 -123
- package/example/app/movies-flashlist/index.tsx +0 -7
- package/example/app/mutable-cells/index.tsx +0 -104
- package/example/app/video-feed/index.tsx +0 -119
- package/example/app.config.js +0 -22
- package/example/app.json +0 -45
- package/example/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/example/assets/images/adaptive-icon.png +0 -0
- package/example/assets/images/favicon.png +0 -0
- package/example/assets/images/icon.png +0 -0
- package/example/assets/images/partial-react-logo.png +0 -0
- package/example/assets/images/react-logo.png +0 -0
- package/example/assets/images/react-logo@2x.png +0 -0
- package/example/assets/images/react-logo@3x.png +0 -0
- package/example/assets/images/splash-icon.png +0 -0
- package/example/autoscroll.sh +0 -101
- package/example/bun.lock +0 -2266
- package/example/bunfig.toml +0 -2
- package/example/components/Breathe.tsx +0 -54
- package/example/components/Circle.tsx +0 -69
- package/example/components/Collapsible.tsx +0 -44
- package/example/components/ExternalLink.tsx +0 -24
- package/example/components/HapticTab.tsx +0 -18
- package/example/components/HelloWave.tsx +0 -37
- package/example/components/Movies.tsx +0 -179
- package/example/components/ParallaxScrollView.tsx +0 -81
- package/example/components/ThemedText.tsx +0 -60
- package/example/components/ThemedView.tsx +0 -14
- package/example/components/__tests__/ThemedText-test.tsx +0 -10
- package/example/components/__tests__/__snapshots__/ThemedText-test.tsx.snap +0 -24
- package/example/components/ui/IconSymbol.ios.tsx +0 -32
- package/example/components/ui/IconSymbol.tsx +0 -43
- package/example/components/ui/TabBarBackground.ios.tsx +0 -22
- package/example/components/ui/TabBarBackground.tsx +0 -6
- package/example/constants/Colors.ts +0 -26
- package/example/constants/constants.ts +0 -5
- package/example/constants/useScrollTest.ts +0 -19
- package/example/hooks/useColorScheme.ts +0 -1
- package/example/hooks/useColorScheme.web.ts +0 -8
- package/example/hooks/useThemeColor.ts +0 -22
- package/example/ios/.xcode.env +0 -11
- package/example/ios/Podfile +0 -64
- package/example/ios/Podfile.lock +0 -2767
- package/example/ios/Podfile.properties.json +0 -5
- package/example/ios/listtest/AppDelegate.swift +0 -70
- package/example/ios/listtest/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
- package/example/ios/listtest/Images.xcassets/AppIcon.appiconset/Contents.json +0 -14
- package/example/ios/listtest/Images.xcassets/Contents.json +0 -6
- package/example/ios/listtest/Images.xcassets/SplashScreenBackground.colorset/Contents.json +0 -20
- package/example/ios/listtest/Images.xcassets/SplashScreenLogo.imageset/Contents.json +0 -23
- package/example/ios/listtest/Images.xcassets/SplashScreenLogo.imageset/image.png +0 -0
- package/example/ios/listtest/Images.xcassets/SplashScreenLogo.imageset/image@2x.png +0 -0
- package/example/ios/listtest/Images.xcassets/SplashScreenLogo.imageset/image@3x.png +0 -0
- package/example/ios/listtest/Info.plist +0 -85
- package/example/ios/listtest/PrivacyInfo.xcprivacy +0 -48
- package/example/ios/listtest/SplashScreen.storyboard +0 -42
- package/example/ios/listtest/Supporting/Expo.plist +0 -12
- package/example/ios/listtest/listtest-Bridging-Header.h +0 -3
- package/example/ios/listtest/listtest.entitlements +0 -5
- package/example/ios/listtest.xcodeproj/project.pbxproj +0 -547
- package/example/ios/listtest.xcodeproj/xcshareddata/xcschemes/listtest.xcscheme +0 -88
- package/example/ios/listtest.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/metro.config.js +0 -16
- package/example/package.json +0 -73
- package/example/scripts/reset-project.js +0 -84
- package/example/tsconfig.json +0 -26
- package/posttsup.ts +0 -24
- package/src/Container.tsx +0 -176
- package/src/Containers.tsx +0 -85
- package/src/ContextContainer.ts +0 -145
- package/src/DebugView.tsx +0 -83
- package/src/LazyLegendList.tsx +0 -41
- package/src/LeanView.tsx +0 -18
- package/src/LegendList.tsx +0 -558
- package/src/ListComponent.tsx +0 -191
- package/src/ScrollAdjust.tsx +0 -24
- package/src/ScrollAdjustHandler.ts +0 -26
- package/src/Separator.tsx +0 -14
- package/src/animated.tsx +0 -6
- package/src/calculateItemsInView.ts +0 -363
- package/src/calculateOffsetForIndex.ts +0 -23
- package/src/calculateOffsetWithOffsetPosition.ts +0 -26
- package/src/checkAllSizesKnown.ts +0 -17
- package/src/checkAtBottom.ts +0 -36
- package/src/checkAtTop.ts +0 -27
- package/src/checkThreshold.ts +0 -30
- package/src/constants.ts +0 -11
- package/src/createColumnWrapperStyle.ts +0 -16
- package/src/doInitialAllocateContainers.ts +0 -40
- package/src/doMaintainScrollAtEnd.ts +0 -34
- package/src/findAvailableContainers.ts +0 -98
- package/src/finishScrollTo.ts +0 -8
- package/src/getId.ts +0 -21
- package/src/getItemSize.ts +0 -52
- package/src/getRenderedItem.ts +0 -34
- package/src/getScrollVelocity.ts +0 -47
- package/src/handleLayout.ts +0 -70
- package/src/helpers.ts +0 -39
- package/src/index.ts +0 -11
- package/src/keyboard-controller.tsx +0 -63
- package/src/onScroll.ts +0 -66
- package/src/prepareMVCP.ts +0 -50
- package/src/reanimated.tsx +0 -63
- package/src/requestAdjust.ts +0 -41
- package/src/scrollTo.ts +0 -40
- package/src/scrollToIndex.ts +0 -34
- package/src/setDidLayout.ts +0 -25
- package/src/setPaddingTop.ts +0 -28
- package/src/state.tsx +0 -304
- package/src/types.ts +0 -610
- package/src/updateAlignItemsPaddingTop.ts +0 -18
- package/src/updateAllPositions.ts +0 -130
- package/src/updateItemSize.ts +0 -203
- package/src/updateTotalSize.ts +0 -44
- package/src/useAnimatedValue.ts +0 -6
- package/src/useCombinedRef.ts +0 -22
- package/src/useInit.ts +0 -17
- package/src/useSyncLayout.tsx +0 -68
- package/src/useValue$.ts +0 -53
- package/src/viewability.ts +0 -279
- package/tsconfig.json +0 -59
- package/tsup.config.ts +0 -21
package/src/DebugView.tsx
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useEffect, useReducer } from "react";
|
|
3
|
-
import { Text, View } from "react-native";
|
|
4
|
-
import { getContentSize, useArr$, useStateContext } from "./state";
|
|
5
|
-
import type { InternalState } from "./types";
|
|
6
|
-
|
|
7
|
-
const DebugRow = ({ children }: React.PropsWithChildren) => {
|
|
8
|
-
return (
|
|
9
|
-
<View style={{ flexDirection: "row", alignItems: "center", justifyContent: "space-between" }}>{children}</View>
|
|
10
|
-
);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const DebugView = React.memo(function DebugView({ state }: { state: InternalState }) {
|
|
14
|
-
const ctx = useStateContext();
|
|
15
|
-
|
|
16
|
-
const [totalSize = 0, scrollAdjust = 0, rawScroll = 0, scroll = 0, numContainers = 0, numContainersPooled = 0] =
|
|
17
|
-
useArr$([
|
|
18
|
-
"totalSize",
|
|
19
|
-
"scrollAdjust",
|
|
20
|
-
"debugRawScroll",
|
|
21
|
-
"debugComputedScroll",
|
|
22
|
-
"numContainers",
|
|
23
|
-
"numContainersPooled",
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
const contentSize = getContentSize(ctx);
|
|
27
|
-
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
|
28
|
-
|
|
29
|
-
useInterval(() => {
|
|
30
|
-
forceUpdate();
|
|
31
|
-
}, 100);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<View
|
|
35
|
-
style={{
|
|
36
|
-
position: "absolute",
|
|
37
|
-
top: 0,
|
|
38
|
-
right: 0,
|
|
39
|
-
paddingLeft: 4,
|
|
40
|
-
paddingBottom: 4,
|
|
41
|
-
// height: 100,
|
|
42
|
-
backgroundColor: "#FFFFFFCC",
|
|
43
|
-
padding: 4,
|
|
44
|
-
borderRadius: 4,
|
|
45
|
-
}}
|
|
46
|
-
pointerEvents="none"
|
|
47
|
-
>
|
|
48
|
-
<DebugRow>
|
|
49
|
-
<Text>TotalSize:</Text>
|
|
50
|
-
<Text>{totalSize.toFixed(2)}</Text>
|
|
51
|
-
</DebugRow>
|
|
52
|
-
<DebugRow>
|
|
53
|
-
<Text>ContentSize:</Text>
|
|
54
|
-
<Text>{contentSize.toFixed(2)}</Text>
|
|
55
|
-
</DebugRow>
|
|
56
|
-
<DebugRow>
|
|
57
|
-
<Text>At end:</Text>
|
|
58
|
-
<Text>{String(state.isAtEnd)}</Text>
|
|
59
|
-
</DebugRow>
|
|
60
|
-
<Text />
|
|
61
|
-
<DebugRow>
|
|
62
|
-
<Text>ScrollAdjust:</Text>
|
|
63
|
-
<Text>{scrollAdjust.toFixed(2)}</Text>
|
|
64
|
-
</DebugRow>
|
|
65
|
-
<Text />
|
|
66
|
-
<DebugRow>
|
|
67
|
-
<Text>RawScroll: </Text>
|
|
68
|
-
<Text>{rawScroll.toFixed(2)}</Text>
|
|
69
|
-
</DebugRow>
|
|
70
|
-
<DebugRow>
|
|
71
|
-
<Text>ComputedScroll: </Text>
|
|
72
|
-
<Text>{scroll.toFixed(2)}</Text>
|
|
73
|
-
</DebugRow>
|
|
74
|
-
</View>
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
function useInterval(callback: () => void, delay: number) {
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
const interval = setInterval(callback, delay);
|
|
81
|
-
return () => clearInterval(interval);
|
|
82
|
-
}, [delay]);
|
|
83
|
-
}
|
package/src/LazyLegendList.tsx
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { AnimatedLegendList } from "@legendapp/list/animated";
|
|
2
|
-
import type { AnimatedLegendList as ReanimatedLegendList } from "@legendapp/list/reanimated";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { type ForwardedRef, forwardRef } from "react";
|
|
5
|
-
import { LegendList as LegendListBase } from "./LegendList";
|
|
6
|
-
import { isArray } from "./helpers";
|
|
7
|
-
import type { LegendListProps, LegendListRef, LegendListRenderItemProps } from "./types";
|
|
8
|
-
|
|
9
|
-
// biome-ignore lint/complexity/noBannedTypes: This is a workaround for the fact that forwardRef is not typed
|
|
10
|
-
type TypedForwardRef = <T, P = {}>(
|
|
11
|
-
render: (props: P, ref: React.Ref<T>) => React.ReactNode,
|
|
12
|
-
) => (props: P & React.RefAttributes<T>) => React.ReactNode;
|
|
13
|
-
|
|
14
|
-
const typedForwardRef = forwardRef as TypedForwardRef;
|
|
15
|
-
|
|
16
|
-
export interface LazyLegendListProps<ItemT, ListT>
|
|
17
|
-
extends Omit<LegendListProps<ItemT>, "data" | "keyExtractor" | "renderItem"> {
|
|
18
|
-
children?: React.ReactNode | undefined;
|
|
19
|
-
LegendList?: ListT;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const renderItem = ({ item }: LegendListRenderItemProps<any>) => item;
|
|
23
|
-
|
|
24
|
-
export const LazyLegendList = typedForwardRef(function LazyLegendList<
|
|
25
|
-
ItemT,
|
|
26
|
-
ListT extends
|
|
27
|
-
| typeof LegendListBase
|
|
28
|
-
| typeof AnimatedLegendList
|
|
29
|
-
| typeof ReanimatedLegendList = typeof LegendListBase,
|
|
30
|
-
>(props: LazyLegendListProps<ItemT, ListT>, forwardedRef: ForwardedRef<LegendListRef>) {
|
|
31
|
-
const { LegendList: LegendListProp, children, ...rest } = props;
|
|
32
|
-
|
|
33
|
-
const LegendListComponent = LegendListProp ?? LegendListBase;
|
|
34
|
-
|
|
35
|
-
const data = (isArray(children) ? children : React.Children.toArray(children)).flat(1);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
// @ts-expect-error TODO: Fix this type
|
|
39
|
-
<LegendListComponent {...rest} data={data} renderItem={renderItem} ref={forwardedRef} />
|
|
40
|
-
);
|
|
41
|
-
});
|
package/src/LeanView.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Platform, View, type ViewProps } from "react-native";
|
|
3
|
-
|
|
4
|
-
// Thanks to @hirbod
|
|
5
|
-
// https://gist.github.com/hirbod/03d487f40b4c091d2c56ebfb17dba7ed
|
|
6
|
-
|
|
7
|
-
const LeanViewComponent = React.forwardRef<View, ViewProps>((props, ref) => {
|
|
8
|
-
return React.createElement("RCTView", { ...props, ref });
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
LeanViewComponent.displayName = "RCTView";
|
|
12
|
-
|
|
13
|
-
// LeanView doesn't work well on web, and not sure how it works on other platforms,
|
|
14
|
-
// so just use it on iOS and Android for now. Could expand this later if we know it's safe
|
|
15
|
-
// for specific other platforms.
|
|
16
|
-
const LeanView = Platform.OS === "android" || Platform.OS === "ios" ? LeanViewComponent : View;
|
|
17
|
-
|
|
18
|
-
export { LeanView };
|