import React, { useCallback } from "react";
import ContentLoader, { Circle, Rect } from "react-content-loader/native";
import { Dimensions, FlatList } from "react-native";
import { View } from "tamagui";
import { ArticleList, ArticleListDisplayMode } from "@/ui/components/content/article/ArticleList";
const { width: screenWidth } = Dimensions.get("window");
const data: number[] = new Array(5).fill(0);
type ArticleSkeletonListProps = {
horizontal?: boolean;
displayMode?: ArticleListDisplayMode;
};
const OverviewCardSkeleton = (props: any) => (
);
const MagazineCardSkeleton = (props: any) => (
);
const TextOnlyCardSkeleton = (props: any) => (
);
const keyExtractor = (_: number, index: number) => index.toString();
const selectSkeletonComponent = (displayMode: ArticleListDisplayMode) => {
switch (displayMode) {
case "magazine":
return MagazineCardSkeleton;
case "text-only":
return TextOnlyCardSkeleton;
default:
return OverviewCardSkeleton;
}
};
export const ArticleSkeletonList = (props: ArticleSkeletonListProps) => {
const { horizontal = false, displayMode = "magazine" } = props;
const ItemSeparator = horizontal ? ArticleList.HorizontalSeparator : ArticleList.VerticalSeparator;
const renderItem = useCallback(() => {
const itemWidth = horizontal ? screenWidth * 0.7 : screenWidth;
const SkeletonComponent = selectSkeletonComponent(displayMode);
return (
);
}, [horizontal, displayMode]);
return (
);
};