import { Table as NativeTable, Row } from "react-native-reanimated-table"; import { styles } from "@/styles/components/table"; import { Skeleton } from "moti/skeleton"; import { colors } from "@/constants/skeleton"; import { ScrollView, Text, View, type DimensionValue } from "react-native"; import type { ReactNode } from "react"; interface Props { headerRow: Array; rows: Array>; rowWidth: Array; rowHeight?: DimensionValue; disableAnimations?: boolean; } export default function SkeletonTable({ headerRow, rows, rowWidth, rowHeight, disableAnimations, }: Props) { const updatedHeaderRow = headerRow.map((row, index) => ( key={index} style={{ ...styles.rowText, ...styles.headerRow, }} > {row} )); return ( {rows.map((row, index) => { let rowStyle = { ...styles.row, ...(rowHeight && { height: rowHeight }), }; if (index === 0) rowStyle = { ...styles.row, ...styles.firstRow, ...(rowHeight && { height: rowHeight }), }; if (index === rows.length - 1) rowStyle = { ...styles.row, ...styles.lastRow, ...(rowHeight && { height: rowHeight }), }; const rowData = row.map((data, index) => { return ( <> {disableAnimations ? ( key={index} style={{ backgroundColor: colors[1], height: 14, width: data, borderRadius: 8, }} /> ) : ( key={index} colors={colors} height={14} width={data} /> )} ); }); return ( ); })} ); }